Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
tool_mfa\plugininfo\factor Class Reference
Inheritance diagram for tool_mfa\plugininfo\factor:
core\plugininfo\base

Public Member Functions

 __get ($name)
 Magic method getter, redirects to read only values.
 
 available_updates ()
 If there are updates for this plugin available, returns them.
 
 full_path ($relativepath)
 Return the full path name of a file within the plugin.
 
 get_default_uninstall_url ($return='overview')
 Returns URL to a script that handles common plugin uninstall procedure.
 
 get_dir ()
 Returns relative directory of the plugin with heading '/'.
 
 get_other_required_plugins ()
 Get the list of other plugins that this plugin requires to be installed.
 
 get_parent_plugin ()
 If I am a subplugin, return the name of my parent plugin.
 
 get_return_url_after_uninstall ($return)
 Where should we return after plugin of this type is uninstalled?
 
 get_settings_section_name ()
 Returns section name for settings.
 
 get_settings_url ()
 Returns the URL of the plugin settings screen.
 
 get_status ()
 Returns the status of the plugin.
 
 get_uninstall_extra_warning ()
 Optional extra warning before uninstallation, for example number of uses in courses.
 
 init_display_name ()
 Sets $displayname property to a localized name of the plugin.
 
 init_is_standard ()
 Sets $source property to one of core_plugin_manager\PLUGIN_SOURCE_xxx constants.
 
 is_core_compatible_satisfied (int $branch)
 Returns true if the the given moodle branch is not stated incompatible with the plugin.
 
 is_core_dependency_satisfied ($moodleversion)
 Returns true if the the given Moodle version is enough to run this plugin.
 
 is_enabled ()
 Returns the information about plugin availability.
 
 is_installed_and_upgraded ()
 Is this plugin already installed and updated?
 
 is_standard ()
 Returns true if the plugin is shipped with the official distribution of the current Moodle version, false otherwise.
 
 is_subplugin ()
 Is this is a subplugin?
 
 is_uninstall_allowed ()
 These subplugins can be uninstalled.
 
 load_db_version ()
 Sets $versiondb property to a numerical value representing the currently installed version of the plugin.
 
 load_disk_version ()
 Sets $versiondisk property to a numerical value representing the version of the plugin's source code.
 
 load_settings (\part_of_admin_tree $adminroot, $parentnodename, $hassiteconfig)
 Loads factor settings to the settings tree.
 
 uninstall (\progress_trace $progress)
 Hook method to implement certain steps when uninstalling the plugin.
 
 uninstall_cleanup ()
 Pre-uninstall hook.
 

Static Public Member Functions

static change_plugin_order (string $pluginname, int $direction)
 Change the order of the plugin relative to other plugins in the plugintype.
 
static enable_plugin (string $pluginname, int $enabled)
 Enable or disable a plugin.
 
static factor_exists (string $factorname)
 Checks that given factor exists.
 
static get_active_user_factor_types (mixed $user=null)
 Finds active factors for a user.
 
static get_all_user_login_factors ()
 Returns all factors that require user input.
 
static get_enabled_factors ()
 Finds all enabled factors.
 
static get_enabled_plugin (string $pluginname)
 Returns current status for a pluginname.
 
static get_enabled_plugins ()
 Finds all enabled plugins, the result may include missing plugins.
 
static get_factor (string $name)
 Finds factor by its name.
 
static get_factor_actions ()
 Returns the list of available actions with factor.
 
static get_factors ()
 Finds all MFA factors.
 
static get_instance_from_id (int $factorid)
 Returns instance of any factor from the factorid.
 
static get_manage_url ()
 Return URL used for management of plugins of this type.
 
static get_next_user_login_factor ()
 Returns next factor to authenticate user.
 
static get_plugins ($type, $typerootdir, $typeclass, $pluginman)
 Gathers and returns the information about all plugins of the given type, either on disk or previously installed.
 
static get_sorted_plugins (bool $enabledonly=false)
 Finds all enabled plugins, the result may include missing plugins.
 
static plugintype_supports_disabling ()
 Whether this plugintype supports its plugins being disabled.
 
static plugintype_supports_ordering ()
 Whether this plugintype supports ordering of plugins using native functionality.
 
static sort_factors_by_order (array $unsorted)
 Sorts factors by configured order.
 
static sort_factors_by_state (array $factors, string $state)
 Sorts factors by state.
 
static user_has_more_than_one_active_factors ()
 Check if the current user has more than one active factor.
 

Public Attributes

string $component = ''
 Name of the plugin.
 
array $dependencies
 other plugins that this one depends on, lazy-loaded by get_other_required_plugins()
 
string $displayname
 the localized plugin name
 
int $incompatible
 hold $plugin->incompatible in version.php

 
int $instances
 number of instances of the plugin - not supported yet
 
string $name
 the plugin name, eg.
 
int $pluginincompatible
 first incompatible branch of Moodle core

 
core_plugin_manager $pluginman
 the plugin manager this plugin info is part of
 
array $pluginsupported
 explicitly supported branches of Moodle core

 
mixed $release
 human-readable release information
 
string $rootdir
 fullpath to the location of this plugin
 
int $sortorder
 order of the plugin among other plugins of the same type - not supported yet
 
string $source
 the plugin source, one of core_plugin_manager\PLUGIN_SOURCE_xxx constants
 
array $supported
 hold $plugin->supported in version.php
 
string $type
 the plugintype name, eg.
 
string $typerootdir
 full path to the location of all the plugins of this type
 
int string $versiondb
 the version of the installed plugin
 
int string $versiondisk
 the version of the plugin's source code
 
int float string $versionrequires
 required version of Moodle core

 
int const MOVE_DOWN = 1
 Move a plugin down in the plugin order.
 
int const MOVE_UP = -1
 Move a plugin up in the plugin order.
 
string const STATE_FAIL = 'fail'
 
string const STATE_LOCKED = 'locked'
 Locked state is identical to neutral, but can't be overridden.
 
string const STATE_NEUTRAL = 'neutral'
 
string const STATE_PASS = 'pass'
 
string const STATE_UNKNOWN = 'unknown'
 

Static Protected Member Functions

static make_plugin_instance ($type, $typerootdir, $name, $namerootdir, $typeclass, $pluginman)
 Makes a new instance of the plugininfo class.
 

Protected Attributes

array null $availableupdates
 array of core::update::info for this plugin
 

Member Function Documentation

◆ __get()

core\plugininfo\base::__get ( $name)
inherited

Magic method getter, redirects to read only values.

Parameters
string$name
Return values
mixed

Reimplemented in core\plugininfo\block, and core\plugininfo\mod.

◆ available_updates()

core\plugininfo\base::available_updates ( )
inherited

If there are updates for this plugin available, returns them.

Returns array of core::update::info objects, if some update is available. Returns null if there is no update available or if the update availability is unknown.

Populates the property $availableupdates on first call (lazy loading).

Return values
array|null

◆ change_plugin_order()

static core\plugininfo\base::change_plugin_order ( string $pluginname,
int $direction )
staticinherited

Change the order of the plugin relative to other plugins in the plugintype.

When possible, the change will be stored into the config_log table, to let admins check when/who has modified it.

Parameters
string$pluginnameThe plugin name to enable/disable.
int$directionThe direction to move the plugin. Negative numbers mean up, Positive mean down.
Return values
boolWhether $pluginname has been updated or not.

Reimplemented in core\plugininfo\editor, and core\plugininfo\media.

◆ enable_plugin()

static core\plugininfo\base::enable_plugin ( string $pluginname,
int $enabled )
staticinherited

Enable or disable a plugin.

When possible, the change will be stored into the config_log table, to let admins check when/who has modified it.

Parameters
string$pluginnameThe plugin name to enable/disable.
int$enabledWhether the pluginname should be enabled (1) or not (0). This is an integer because some plugins, such as filters or repositories, might support more statuses than just enabled/disabled.
Return values
boolWhether $pluginname has been updated or not.

Reimplemented in core\plugininfo\antivirus, core\plugininfo\auth, core\plugininfo\availability, core\plugininfo\block, core\plugininfo\communication, core\plugininfo\contenttype, core\plugininfo\customfield, core\plugininfo\dataformat, core\plugininfo\editor, core\plugininfo\enrol, core\plugininfo\fileconverter, core\plugininfo\filter, core\plugininfo\format, core\plugininfo\media, core\plugininfo\message, core\plugininfo\mod, core\plugininfo\paygw, core\plugininfo\portfolio, core\plugininfo\qbank, core\plugininfo\qbehaviour, core\plugininfo\qtype, core\plugininfo\repository, core\plugininfo\webservice, editor_tiny\plugininfo\tiny, mod_assign\plugininfo\assignfeedback, mod_assign\plugininfo\assignsubmission, mod_bigbluebuttonbn\plugininfo\bbbext, and tool_log\plugininfo\logstore.

◆ factor_exists()

static tool_mfa\plugininfo\factor::factor_exists ( string $factorname)
static

Checks that given factor exists.

Parameters
string$factorname
Return values
bool

◆ full_path()

core\plugininfo\base::full_path ( $relativepath)
inherited

Return the full path name of a file within the plugin.

No check is made to see if the file exists.

Parameters
string$relativepathe.g. 'version.php'.
Return values
stringe.g. $CFG->dirroot . '/mod/quiz/version.php'.

◆ get_active_user_factor_types()

static tool_mfa\plugininfo\factor::get_active_user_factor_types ( mixed $user = null)
static

Finds active factors for a user.

If user is not specified, current user is used.

Parameters
mixed$useruser object or null.
Return values
arrayof factor objects.

◆ get_all_user_login_factors()

static tool_mfa\plugininfo\factor::get_all_user_login_factors ( )
static

Returns all factors that require user input.

Return values
arrayof factor objects.

◆ get_default_uninstall_url()

core\plugininfo\base::get_default_uninstall_url ( $return = 'overview')
finalinherited

Returns URL to a script that handles common plugin uninstall procedure.

This URL is intended for all plugin uninstallations.

Parameters
string$returneither 'overview' or 'manage'
Return values
moodle_url

◆ get_dir()

core\plugininfo\base::get_dir ( )
inherited

Returns relative directory of the plugin with heading '/'.

Return values
string

◆ get_enabled_factors()

static tool_mfa\plugininfo\factor::get_enabled_factors ( )
static

Finds all enabled factors.

Return values
arrayof factor objects

◆ get_enabled_plugin()

static core\plugininfo\base::get_enabled_plugin ( string $pluginname)
staticinherited

Returns current status for a pluginname.

Parameters
string$pluginnameThe plugin name to check.
Return values
intThe current status (enabled, disabled...) of $pluginname.

Reimplemented in core\plugininfo\filter, and core\plugininfo\repository.

◆ get_enabled_plugins()

◆ get_factor()

static tool_mfa\plugininfo\factor::get_factor ( string $name)
static

Finds factor by its name.

Parameters
string$name
Return values
mixedfactor object or false if factor not found.

◆ get_factor_actions()

static tool_mfa\plugininfo\factor::get_factor_actions ( )
static

Returns the list of available actions with factor.

Return values
array

◆ get_factors()

static tool_mfa\plugininfo\factor::get_factors ( )
static

Finds all MFA factors.

Return values
arrayof factor objects.

◆ get_instance_from_id()

static tool_mfa\plugininfo\factor::get_instance_from_id ( int $factorid)
static

Returns instance of any factor from the factorid.

Parameters
int$factorid
Return values
stdClass|nullFactor instance or nothing if not found.

◆ get_manage_url()

static tool_mfa\plugininfo\factor::get_manage_url ( )
static

Return URL used for management of plugins of this type.

Return values
moodle_url

Reimplemented from core\plugininfo\base.

◆ get_next_user_login_factor()

static tool_mfa\plugininfo\factor::get_next_user_login_factor ( )
static

Returns next factor to authenticate user.

Only returns factors that require user input.

Return values
mixedfactor object the next factor to be authenticated or false.

◆ get_other_required_plugins()

core\plugininfo\base::get_other_required_plugins ( )
inherited

Get the list of other plugins that this plugin requires to be installed.

Return values
arraywith keys the frankenstyle plugin name, and values either a version string (like '2011101700') or the constant ANY_VERSION.

◆ get_parent_plugin()

core\plugininfo\base::get_parent_plugin ( )
inherited

If I am a subplugin, return the name of my parent plugin.

Return values
string|boolfalse if not a subplugin, name of the parent otherwise

◆ get_plugins()

static core\plugininfo\base::get_plugins ( $type,
$typerootdir,
$typeclass,
$pluginman )
staticinherited

Gathers and returns the information about all plugins of the given type, either on disk or previously installed.

This is supposed to be used exclusively by the plugin manager when it is populating its tree of plugins.

Parameters
string$typethe name of the plugintype, eg. mod, auth or workshopform
string$typerootdirfull path to the location of the plugin dir
string$typeclassthe name of the actually called class
core_plugin_manager$pluginmanthe plugin manager calling this method
Return values
arrayof plugintype classes, indexed by the plugin name

Reimplemented in core\plugininfo\contenttype, core\plugininfo\dataformat, core\plugininfo\format, core\plugininfo\orphaned, and core\plugininfo\qbank.

◆ get_return_url_after_uninstall()

core\plugininfo\base::get_return_url_after_uninstall ( $return)
inherited

Where should we return after plugin of this type is uninstalled?

Parameters
string$return
Return values
moodle_url

◆ get_settings_section_name()

tool_mfa\plugininfo\factor::get_settings_section_name ( )

Returns section name for settings.

Return values
string

Reimplemented from core\plugininfo\base.

◆ get_settings_url()

core\plugininfo\base::get_settings_url ( )
inherited

Returns the URL of the plugin settings screen.

Null value means that the plugin either does not have the settings screen or its location is not available via this library.

Return values
null|moodle_url

◆ get_sorted_plugins()

static core\plugininfo\base::get_sorted_plugins ( bool $enabledonly = false)
staticinherited

Finds all enabled plugins, the result may include missing plugins.

Parameters
bool$enabledonlyShow all plugins, or only those which are enabled
Return values
array|nullof sorted plugins $pluginname => $pluginname, null means unknown

Reimplemented in core\plugininfo\editor, and core\plugininfo\media.

◆ get_status()

core\plugininfo\base::get_status ( )
inherited

Returns the status of the plugin.

Return values
stringone of core_plugin_manager\PLUGIN_STATUS_xxx constants

◆ get_uninstall_extra_warning()

core\plugininfo\base::get_uninstall_extra_warning ( )
inherited

Optional extra warning before uninstallation, for example number of uses in courses.

Return values
string

Reimplemented in core\plugininfo\block, core\plugininfo\contenttype, core\plugininfo\enrol, core\plugininfo\format, and core\plugininfo\mod.

◆ init_display_name()

core\plugininfo\base::init_display_name ( )
inherited

◆ init_is_standard()

core\plugininfo\base::init_is_standard ( )
inherited

Sets $source property to one of core_plugin_manager\PLUGIN_SOURCE_xxx constants.

If the property's value is null after calling this method, then the type of the plugin has not been recognized and you should throw an exception.

◆ is_core_compatible_satisfied()

core\plugininfo\base::is_core_compatible_satisfied ( int $branch)
inherited

Returns true if the the given moodle branch is not stated incompatible with the plugin.

Parameters
int$branchthe moodle branch number
Return values
booltrue if not incompatible with moodle branch

◆ is_core_dependency_satisfied()

core\plugininfo\base::is_core_dependency_satisfied ( $moodleversion)
inherited

Returns true if the the given Moodle version is enough to run this plugin.

Parameters
string | int | double$moodleversion
Return values
bool

◆ is_enabled()

tool_mfa\plugininfo\factor::is_enabled ( )

Returns the information about plugin availability.

True means that the plugin is enabled. False means that the plugin is disabled. Null means that the information is not available, or the plugin does not support configurable availability or the availability can not be changed.

Return values
null|bool

Reimplemented from core\plugininfo\base.

◆ is_installed_and_upgraded()

core\plugininfo\base::is_installed_and_upgraded ( )
inherited

Is this plugin already installed and updated?

Return values
booltrue if plugin installed and upgraded.

◆ is_standard()

core\plugininfo\base::is_standard ( )
inherited

Returns true if the plugin is shipped with the official distribution of the current Moodle version, false otherwise.

Return values
bool

◆ is_subplugin()

core\plugininfo\base::is_subplugin ( )
inherited

Is this is a subplugin?

Return values
boolean

◆ is_uninstall_allowed()

tool_mfa\plugininfo\factor::is_uninstall_allowed ( )

These subplugins can be uninstalled.

Return values
bool

Reimplemented from core\plugininfo\base.

◆ load_db_version()

core\plugininfo\base::load_db_version ( )
inherited

Sets $versiondb property to a numerical value representing the currently installed version of the plugin.

If the value is null after calling this method, either the plugin does not use versioning (typically does not have any database data) or has not been installed yet.

◆ load_disk_version()

core\plugininfo\base::load_disk_version ( )
inherited

Sets $versiondisk property to a numerical value representing the version of the plugin's source code.

If the value is null after calling this method, either the plugin does not use versioning (typically does not have any database data) or is missing from disk.

◆ load_settings()

tool_mfa\plugininfo\factor::load_settings ( \part_of_admin_tree $adminroot,
$parentnodename,
$hassiteconfig )

Loads factor settings to the settings tree.

This function usually includes settings.php file in plugins folder. Alternatively it can create a link to some settings page (instance of admin_externalpage)

Parameters
part_of_admin_tree$adminroot
string$parentnodename
bool$hassiteconfigwhether the current user has moodle/site:config capability

Reimplemented from core\plugininfo\base.

◆ make_plugin_instance()

static core\plugininfo\base::make_plugin_instance ( $type,
$typerootdir,
$name,
$namerootdir,
$typeclass,
$pluginman )
staticprotectedinherited

Makes a new instance of the plugininfo class.

Parameters
string$typethe plugin type, eg. 'mod'
string$typerootdirfull path to the location of all the plugins of this type
string$namethe plugin name, eg. 'workshop'
string$namerootdirfull path to the location of the plugin
string$typeclassthe name of class that holds the info about the plugin
core_plugin_manager$pluginmanthe plugin manager of the new instance
Return values
basethe instance of $typeclass

◆ plugintype_supports_disabling()

◆ plugintype_supports_ordering()

static core\plugininfo\base::plugintype_supports_ordering ( )
staticinherited

Whether this plugintype supports ordering of plugins using native functionality.

Please note that plugintypes which pre-date this native functionality may still support ordering but will not use the built-in functionality.

Return values
bool

Reimplemented in core\plugininfo\editor, and core\plugininfo\media.

◆ sort_factors_by_order()

static tool_mfa\plugininfo\factor::sort_factors_by_order ( array $unsorted)
static

Sorts factors by configured order.

Parameters
array$unsortedof factor objects
Return values
arrayof factor objects
Exceptions
dml_exception

◆ sort_factors_by_state()

static tool_mfa\plugininfo\factor::sort_factors_by_state ( array $factors,
string $state )
static

Sorts factors by state.

Parameters
array$factorsThe factors to sort.
string$stateThe state to sort by.
Return values
array\$factorsThe sorted factors.

◆ uninstall()

core\plugininfo\base::uninstall ( \progress_trace $progress)
inherited

Hook method to implement certain steps when uninstalling the plugin.

This hook is called by core_plugin_manager::uninstall_plugin() so it is basically usable only for those plugin types that use the default uninstall tool provided by self::get_default_uninstall_url().

Parameters
progress_trace$progresstraces the process
Return values
booltrue on success, false on failure

◆ uninstall_cleanup()

tool_mfa\plugininfo\factor::uninstall_cleanup ( )

Pre-uninstall hook.

This is intended for disabling of plugin, some DB table purging, etc.

NOTE: to be called from uninstall_plugin() only.

Reimplemented from core\plugininfo\base.

◆ user_has_more_than_one_active_factors()

static tool_mfa\plugininfo\factor::user_has_more_than_one_active_factors ( )
static

Check if the current user has more than one active factor.

Return values
boolReturns true if there are more than one.

Member Data Documentation

◆ $name

string core\plugininfo\base::$name
inherited

the plugin name, eg.

assignment, ldap

◆ $type

string core\plugininfo\base::$type
inherited

the plugintype name, eg.

mod, auth or workshopform


The documentation for this class was generated from the following file: