Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
|
Class for admin tool plugins. More...
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 the node name used in admin settings menu for this plugin settings (if applicable) | |
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 () | |
Should there be a way to uninstall the plugin via the administration UI. | |
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 plugin 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 | 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_manage_url () |
Return URL used for management of plugins of this type. | |
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. | |
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. | |
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 | |
Class for admin tool plugins.
|
inherited |
Magic method getter, redirects to read only values.
string | $name |
mixed |
Reimplemented in core\plugininfo\block, and core\plugininfo\mod.
|
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).
array|null |
|
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.
string | $pluginname | The plugin name to enable/disable. |
int | $direction | The direction to move the plugin. Negative numbers mean up, Positive mean down. |
bool | Whether $pluginname has been updated or not. |
Reimplemented in core\plugininfo\editor, and core\plugininfo\media.
|
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.
string | $pluginname | The plugin name to enable/disable. |
int | $enabled | Whether 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. |
bool | Whether $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.
|
inherited |
Return the full path name of a file within the plugin.
No check is made to see if the file exists.
string | $relativepath | e.g. 'version.php'. |
string | e.g. $CFG->dirroot . '/mod/quiz/version.php'. |
|
finalinherited |
Returns URL to a script that handles common plugin uninstall procedure.
This URL is intended for all plugin uninstallations.
string | $return | either 'overview' or 'manage' |
moodle_url |
|
inherited |
Returns relative directory of the plugin with heading '/'.
string |
|
staticinherited |
Returns current status for a pluginname.
string | $pluginname | The plugin name to check. |
int | The current status (enabled, disabled...) of $pluginname. |
Reimplemented in core\plugininfo\filter, and core\plugininfo\repository.
|
staticinherited |
Finds all enabled plugins, the result may include missing plugins.
array|null | of enabled plugins $pluginname=>$pluginname, null means unknown |
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\orphaned, 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, and mod_bigbluebuttonbn\plugininfo\bbbext.
|
staticinherited |
Return URL used for management of plugins of this type.
moodle_url |
Reimplemented in core\plugininfo\antivirus, core\plugininfo\auth, 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\h5plib, core\plugininfo\local, core\plugininfo\media, core\plugininfo\message, core\plugininfo\mod, core\plugininfo\paygw, core\plugininfo\plagiarism, core\plugininfo\portfolio, core\plugininfo\profilefield, core\plugininfo\qbank, core\plugininfo\qbehaviour, core\plugininfo\qtype, core\plugininfo\report, core\plugininfo\repository, core\plugininfo\theme, core\plugininfo\tool, editor_atto\plugininfo\atto, editor_tiny\plugininfo\tiny, mod_assign\plugininfo\assignfeedback, mod_assign\plugininfo\assignsubmission, tool_log\plugininfo\logstore, and tool_mfa\plugininfo\factor.
|
inherited |
Get the list of other plugins that this plugin requires to be installed.
array | with keys the frankenstyle plugin name, and values either a version string (like '2011101700') or the constant ANY_VERSION. |
|
inherited |
If I am a subplugin, return the name of my parent plugin.
string|bool | false if not a subplugin, name of the parent otherwise |
|
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.
string | $type | the name of the plugintype, eg. mod, auth or workshopform |
string | $typerootdir | full path to the location of the plugin dir |
string | $typeclass | the name of the actually called class |
core_plugin_manager | $pluginman | the plugin manager calling this method |
array | of 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.
|
inherited |
Where should we return after plugin of this type is uninstalled?
string | $return |
moodle_url |
|
inherited |
Returns the node name used in admin settings menu for this plugin settings (if applicable)
null|string | node name or null if plugin does not create settings node (default) |
Reimplemented in core\plugininfo\antivirus, core\plugininfo\auth, core\plugininfo\availability, core\plugininfo\block, core\plugininfo\calendartype, 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\mlbackend, core\plugininfo\mod, core\plugininfo\paygw, core\plugininfo\plagiarism, core\plugininfo\qbank, core\plugininfo\qtype, core\plugininfo\repository, core\plugininfo\search, core\plugininfo\webservice, editor_atto\plugininfo\atto, editor_tiny\plugininfo\tiny, mod_assign\plugininfo\assignfeedback, mod_assign\plugininfo\assignsubmission, mod_bigbluebuttonbn\plugininfo\bbbext, mod_lti\plugininfo\ltisource, tool_log\plugininfo\logstore, and tool_mfa\plugininfo\factor.
|
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.
null|moodle_url |
|
staticinherited |
Finds all enabled plugins, the result may include missing plugins.
bool | $enabledonly | Show all plugins, or only those which are enabled |
array|null | of sorted plugins $pluginname => $pluginname, null means unknown |
Reimplemented in core\plugininfo\editor, and core\plugininfo\media.
|
inherited |
Returns the status of the plugin.
string | one of core_plugin_manager\PLUGIN_STATUS_xxx constants |
|
inherited |
Optional extra warning before uninstallation, for example number of uses in courses.
string |
Reimplemented in core\plugininfo\block, core\plugininfo\contenttype, core\plugininfo\enrol, core\plugininfo\format, and core\plugininfo\mod.
|
inherited |
Sets $displayname property to a localized name of the plugin.
Reimplemented in core\plugininfo\block, core\plugininfo\dataformat, core\plugininfo\filter, core\plugininfo\mod, and core\plugininfo\orphaned.
|
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.
|
inherited |
Returns true if the the given moodle branch is not stated incompatible with the plugin.
int | $branch | the moodle branch number |
bool | true if not incompatible with moodle branch |
|
inherited |
Returns true if the the given Moodle version is enough to run this plugin.
string | int | double | $moodleversion |
bool |
|
inherited |
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.
null|bool |
Reimplemented in core\plugininfo\h5plib, core\plugininfo\mnetservice, core\plugininfo\orphaned, core\plugininfo\tool, tool_log\plugininfo\logstore, and tool_mfa\plugininfo\factor.
|
inherited |
Is this plugin already installed and updated?
bool | true if plugin installed and upgraded. |
|
inherited |
Returns true if the plugin is shipped with the official distribution of the current Moodle version, false otherwise.
bool |
|
inherited |
Is this is a subplugin?
boolean |
core\plugininfo\gradereport::is_uninstall_allowed | ( | ) |
Should there be a way to uninstall the plugin via the administration UI.
By default uninstallation is not allowed, plugin developers must enable it explicitly!
bool |
Reimplemented from core\plugininfo\base.
|
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.
|
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.
|
inherited |
Loads plugin 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)
part_of_admin_tree | $adminroot | |
string | $parentnodename | |
bool | $hassiteconfig | whether the current user has moodle/site:config capability |
Reimplemented in core\plugininfo\availability, core\plugininfo\communication, core\plugininfo\contenttype, core\plugininfo\customfield, core\plugininfo\fileconverter, core\plugininfo\h5plib, core\plugininfo\local, core\plugininfo\media, core\plugininfo\mlbackend, core\plugininfo\paygw, core\plugininfo\qbank, core\plugininfo\tool, editor_atto\plugininfo\atto, editor_tiny\plugininfo\tiny, mod_assign\plugininfo\assignfeedback, mod_assign\plugininfo\assignsubmission, mod_bigbluebuttonbn\plugininfo\bbbext, mod_lti\plugininfo\ltisource, and tool_mfa\plugininfo\factor.
|
staticprotectedinherited |
Makes a new instance of the plugininfo class.
string | $type | the plugin type, eg. 'mod' |
string | $typerootdir | full path to the location of all the plugins of this type |
string | $name | the plugin name, eg. 'workshop' |
string | $namerootdir | full path to the location of the plugin |
string | $typeclass | the name of class that holds the info about the plugin |
core_plugin_manager | $pluginman | the plugin manager of the new instance |
base | the instance of $typeclass |
|
staticinherited |
Whether this plugintype supports its plugins being disabled.
bool |
Reimplemented in core\plugininfo\antivirus, core\plugininfo\auth, core\plugininfo\availability, core\plugininfo\block, core\plugininfo\contenttype, core\plugininfo\customfield, core\plugininfo\dataformat, core\plugininfo\editor, core\plugininfo\enrol, core\plugininfo\fileconverter, core\plugininfo\filter, 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, and tool_log\plugininfo\logstore.
|
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.
bool |
Reimplemented in core\plugininfo\editor, and core\plugininfo\media.
|
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().
progress_trace | $progress | traces the process |
bool | true on success, false on failure |
|
inherited |
Pre-uninstall hook.
This is intended for disabling of plugin, some DB table purging, etc.
NOTE: to be called from uninstall_plugin() only.
Reimplemented in core\plugininfo\antivirus, core\plugininfo\auth, core\plugininfo\block, core\plugininfo\contenttype, core\plugininfo\customfield, core\plugininfo\enrol, core\plugininfo\filter, core\plugininfo\format, core\plugininfo\gradingform, core\plugininfo\message, core\plugininfo\mod, core\plugininfo\portfolio, core\plugininfo\qbehaviour, core\plugininfo\qtype, core\plugininfo\repository, core\plugininfo\theme, mod_assign\plugininfo\assignfeedback, mod_assign\plugininfo\assignsubmission, mod_quiz\plugininfo\quiz, tool_log\plugininfo\logstore, and tool_mfa\plugininfo\factor.
|
inherited |
the plugin name, eg.
assignment, ldap
|
inherited |
the plugintype name, eg.
mod, auth or workshopform