Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
core_plugin_manager Class Reference

Public Member Functions

 all_plugins_ok ($moodleversion, &$failedplugins=array(), $branch=null)
 Checks all dependencies for all installed plugins.
 
 archive_plugin_version (\core\plugininfo\base $plugin)
 Archive the current on-disk plugin code.
 
 are_dependencies_satisfied ($dependencies)
 Check a dependencies list against the list of installed plugins.
 
 available_updates ()
 Returns a list of all available updates to be installed.
 
 can_cancel_plugin_installation (\core\plugininfo\base $plugin)
 Can the installation of the new plugin be cancelled?
 
 can_cancel_plugin_upgrade (\core\plugininfo\base $plugin)
 Can the upgrade of the existing plugin be cancelled?
 
 can_uninstall_plugin ($component)
 Is it possible to uninstall the given plugin?
 
 cancel_plugin_installation ($component)
 Removes the plugin code directory if it is not installed yet.
 
 check_explicitly_supported ($plugin, $branch)
 Helper method to determine whether a moodle version is explicitly supported.
 
 filter_installable ($remoteinfos)
 Given the list of remote plugin infos, return just those installable.
 
 get_enabled_plugins ($type)
 Get list of enabled plugins of given type, the result may contain missing plugins.
 
 get_installed_plugins ($type)
 Return list of installed plugins of given type.
 
 get_parent_of_subplugin ($subplugintype)
 Returns the name of the plugin that defines the given subplugin type.
 
 get_plugin_info ($component)
 Returns information about the known plugin, or null.
 
 get_plugin_types ()
 Returns the result of core_component::get_plugin_types() ordered for humans.
 
 get_plugin_zip_root_dir ($zipfilepath)
 Detects the plugin's name from its ZIP file.
 
 get_plugins ()
 Returns a tree of known plugins and information about them.
 
 get_plugins_of_type ($type)
 Returns list of known plugins of the given type.
 
 get_plugintype_root ($plugintype)
 Returns the full path of the root of the given plugin type.
 
 get_present_plugins ($type)
 Get list of present plugins of given type.
 
 get_remote_plugin_info ($component, $version, $exactmatch)
 Returns information about a plugin in the plugins directory.
 
 get_remote_plugin_zip ($url, $md5)
 Obtain the plugin ZIP file from the given URL.
 
 get_subplugins ()
 Returns list of plugins that define their subplugins and the information about them from the db/subplugins.json file.
 
 get_subplugins_of_plugin ($component)
 Returns list of all known subplugins of the given plugin.
 
 get_uninstall_url ($component, $return='overview')
 Returns uninstall URL if exists.
 
 install_plugins (array $plugins, $confirmed, $silent)
 Perform the installation of plugins.
 
 is_directory_removable ($fullpath)
 Check if the given directory can be removed by the web server process.
 
 is_plugin_folder_removable ($component)
 Check to see if the given plugin folder can be removed by the web server process.
 
 is_plugintype_writable ($plugintype)
 Is it possible to create a new plugin directory for the given plugin type?
 
 is_remote_plugin_available ($component, $version, $exactmatch)
 Is the given plugin version available in the plugins directory?
 
 is_remote_plugin_installable ($component, $version, &$reason=null, $checkremote=true)
 Can the given plugin version be installed via the admin UI?
 
 list_cancellable_installations ()
 Returns plugins, the installation of which can be cancelled.
 
 list_restorable_archives ()
 Returns list of all archives that can be installed to cancel the plugin upgrade.
 
 load_available_updates_for_plugin ($component)
 Returns list of available updates for the given component.
 
 missing_dependencies ($availableonly=false)
 Return a list of missing dependencies.
 
 other_plugins_that_require ($component)
 Get a list of any other plugins that require this one.
 
 plugin_external_source ($component)
 Check to see if the current version of the plugin seems to be a checkout of an external repository.
 
 plugin_name ($component)
 Returns a localized name of a given plugin.
 
 plugintype_name ($type)
 Returns a localized name of a plugin typed in singular form.
 
 plugintype_name_plural ($type)
 Returns a localized name of a plugin type in plural form.
 
 remove_plugin_folder (\core\plugininfo\base $plugin)
 Remove the current plugin code from the dirroot.
 
 resolve_requirements (\core\plugininfo\base $plugin, $moodleversion=null, $moodlebranch=null)
 Resolve requirements and dependencies of a plugin.
 
 some_plugins_updatable ()
 Checks if there are some plugins with a known available update.
 
 uninstall_plugin ($component, progress_trace $progress)
 Uninstall the given plugin.
 
 unzip_plugin_file ($zipfilepath, $targetdir, $rootdir='')
 Extracts the saved plugin ZIP file.
 

Static Public Member Functions

static instance ()
 Factory method for this class.
 
static is_deleted_standard_plugin ($type, $name)
 Defines a list of all plugins that were originally shipped in the standard Moodle distribution, but are not anymore and are deleted during upgrades.
 
static reset_caches ($phpunitreset=false)
 Reset all caches.
 
static resolve_plugininfo_class ($type)
 Find the plugin info class for given type.
 
static standard_plugins_list ($type)
 Defines a white list of all plugins shipped in the standard Moodle distribution.
 

Public Attributes

const PLUGIN_SOURCE_EXTENSION = 'ext'
 the plugin is added extension
 
const PLUGIN_SOURCE_STANDARD = 'std'
 the plugin is shipped with standard Moodle distribution
 
const PLUGIN_STATUS_DELETE = 'delete'
 the standard plugin is about to be deleted
 
const PLUGIN_STATUS_DOWNGRADE = 'downgrade'
 the version at the disk is lower than the one already installed
 
const PLUGIN_STATUS_MISSING = 'missing'
 the plugin is installed but missing from disk
 
const PLUGIN_STATUS_NEW = 'new'
 the plugin is about to be installed
 
const PLUGIN_STATUS_NODB = 'nodb'
 the plugin uses neither database nor capabilities, no versions
 
const PLUGIN_STATUS_UPGRADE = 'upgrade'
 the plugin is about to be upgraded
 
const PLUGIN_STATUS_UPTODATE = 'uptodate'
 the plugin is up-to-date
 
const REQUIREMENT_AVAILABLE = 'available'
 the required dependency is available in the plugins directory
 
const REQUIREMENT_STATUS_MISSING = 'missing'
 the required dependency is not installed
 
const REQUIREMENT_STATUS_NEWER = 'newer'
 the current Moodle version is too high for plugin.
 
const REQUIREMENT_STATUS_OK = 'ok'
 the given requirement/dependency is fulfilled
 
const REQUIREMENT_STATUS_OUTDATED = 'outdated'
 the plugin requires higher core/other plugin version than is currently installed
 
const REQUIREMENT_UNAVAILABLE = 'unavailable'
 the required dependency is available in the plugins directory
 
const VERSION_NO_SUPPORTS = 'nosupports'
 the plugin does not specify supports
 
const VERSION_NOT_SUPPORTED = 'notsupported'
 the moodle version is not explicitly supported
 
const VERSION_SUPPORTED = 'supported'
 the moodle version is explicitly supported
 

Protected Member Functions

 __construct ()
 Direct initiation not allowed, use the factory method self::instance().
 
 __clone ()
 Sorry, this is singleton.
 
 common_uninstall_check (\core\plugininfo\base $pluginfo)
 Helper method that implements common uninstall prerequisites.
 
 get_code_manager ()
 Returns a code_manager instance to be used for the plugins code operations.
 
 get_update_api_client ()
 Returns a client for https://download.moodle.org/api/.
 
 init_pluginsinfo_property ()
 Init placeholder array for plugin infos.
 
 load_enabled_plugins ()
 Load list of all enabled plugins, call before using $this->enabledplugins.
 
 load_installed_plugins ()
 Load list of installed plugins, always call before using $this->installedplugins.
 
 load_present_plugins ()
 Load list of all present plugins - call before using $this->presentplugins.
 
 mtrace ($msg, $eol=PHP_EOL, $debug=null)
 Outputs the given message via mtrace().
 
 reorder_plugin_types (array $types)
 Reorders plugin types into a sequence to be displayed.
 
 resolve_core_requirements (\core\plugininfo\base $plugin, $moodleversion, $moodlebranch)
 Helper method to resolve plugin's requirements on the moodle core.
 
 resolve_dependency_requirements (\core\plugininfo\base $plugin, $otherpluginname, $requiredversion, $moodlebranch)
 Helper method to resolve plugin's dependecies on other plugins.
 

Protected Attributes

core update code_manager $codemanager = null
 code manager to use for plugins code operations
 
array $enabledplugins = null
 list of all enabled plugins $name=>$name
 
array $installedplugins = null
 list of installed plugins $name=>$version
 
array $pluginsinfo = null
 of raw plugins information
 
array $plugintypes = null
 reordered list of plugin types
 
array $presentplugins = null
 list of all enabled plugins $name=>$diskversion
 
array $remotepluginsinfoatleast = null
 cache information about availability in the plugins directory if requesting "at least" version
 
array $remotepluginsinfoexact = null
 cache information about availability in the plugins directory if requesting exact version
 
array $subpluginsinfo = null
 of raw subplugins information
 
core update api $updateapiclient = null
 client instance to use for accessing download.moodle.org/api/
 

Static Protected Attributes

static core_plugin_manager $singletoninstance
 holds the singleton instance
 

Member Function Documentation

◆ all_plugins_ok()

core_plugin_manager::all_plugins_ok ( $moodleversion,
& $failedplugins = array(),
$branch = null )

Checks all dependencies for all installed plugins.

This is used by install and upgrade. The array passed by reference as the second argument is populated with the list of plugins that have failed dependencies (note that a single plugin can appear multiple times in the $failedplugins).

Parameters
int$moodleversionthe version from version.php.
array$failedpluginsto return the list of plugins with non-satisfied dependencies
int$branchthe current moodle branch, null if not provided
Return values
booltrue if all the dependencies are satisfied for all plugins.

◆ archive_plugin_version()

core_plugin_manager::archive_plugin_version ( \core\plugininfo\base $plugin)

Archive the current on-disk plugin code.

Parameters
core\plugiinfo\base$plugin
Return values
bool

◆ are_dependencies_satisfied()

core_plugin_manager::are_dependencies_satisfied ( $dependencies)

Check a dependencies list against the list of installed plugins.

Parameters
array$dependenciescompenent name to required version or ANY_VERSION.
Return values
booltrue if all the dependencies are satisfied.

◆ available_updates()

core_plugin_manager::available_updates ( )

Returns a list of all available updates to be installed.

This is used when "update all plugins" action is performed at the administration UI screen.

Returns array of remote info objects indexed by the plugin component. If there are multiple updates available (typically a mix of stable and non-stable ones), we pick the most mature most recent one.

Plugins without explicit maturity are considered more mature than release candidates but less mature than explicit stable (this should be pretty rare case).

Return values
array(string)component => (core\update\remote_info)remoteinfo

◆ can_cancel_plugin_installation()

core_plugin_manager::can_cancel_plugin_installation ( \core\plugininfo\base $plugin)

Can the installation of the new plugin be cancelled?

Subplugins can be cancelled only via their parent plugin, not separately (they are considered as implicit requirements if distributed together with the main package).

Parameters
core\plugininfo\base$plugin
Return values
bool

◆ can_cancel_plugin_upgrade()

core_plugin_manager::can_cancel_plugin_upgrade ( \core\plugininfo\base $plugin)

Can the upgrade of the existing plugin be cancelled?

Subplugins can be cancelled only via their parent plugin, not separately (they are considered as implicit requirements if distributed together with the main package).

Parameters
core\plugininfo\base$plugin
Return values
bool

◆ can_uninstall_plugin()

core_plugin_manager::can_uninstall_plugin ( $component)

Is it possible to uninstall the given plugin?

False is returned if the plugininfo subclass declares the uninstall should not be allowed via core::plugininfo::base::is_uninstall_allowed() or if the core vetoes it (e.g. becase the plugin or some of its subplugins is required by some other installed plugin).

Parameters
string$componentfull frankenstyle name, e.g. mod_foobar
Return values
bool

◆ cancel_plugin_installation()

core_plugin_manager::cancel_plugin_installation ( $component)

Removes the plugin code directory if it is not installed yet.

This is intended for the plugins check screen to give the admin a chance to cancel the installation of just unzipped plugin before the database upgrade happens.

Parameters
string$component

◆ check_explicitly_supported()

core_plugin_manager::check_explicitly_supported ( $plugin,
$branch )

Helper method to determine whether a moodle version is explicitly supported.

Parameters
core\plugininfo\base$pluginthe plugin we are checking
int$branchthe moodle branch to check support for
Return values
string

◆ common_uninstall_check()

core_plugin_manager::common_uninstall_check ( \core\plugininfo\base $pluginfo)
protected

Helper method that implements common uninstall prerequisites.

Parameters
core\plugininfo\base$pluginfo
Return values
bool

◆ filter_installable()

core_plugin_manager::filter_installable ( $remoteinfos)

Given the list of remote plugin infos, return just those installable.

This is typically used on lists returned by self::available_updates() or self::missing_dependencies() to perform bulk installation of remote plugins.

Parameters
array$remoteinfoslist of core::update::remote_info
Return values
array

◆ get_code_manager()

core_plugin_manager::get_code_manager ( )
protected

Returns a code_manager instance to be used for the plugins code operations.

Return values
core\update\code_manager

◆ get_enabled_plugins()

core_plugin_manager::get_enabled_plugins ( $type)

Get list of enabled plugins of given type, the result may contain missing plugins.

Parameters
string$type
Return values
array|nulllist of enabled plugins of this type, null if unknown

◆ get_installed_plugins()

core_plugin_manager::get_installed_plugins ( $type)

Return list of installed plugins of given type.

Parameters
string$type
Return values
array\$name,=>$version

◆ get_parent_of_subplugin()

core_plugin_manager::get_parent_of_subplugin ( $subplugintype)

Returns the name of the plugin that defines the given subplugin type.

If the given subplugin type is not actually a subplugin, returns false.

Parameters
string$subplugintypethe name of subplugin type, eg. workshopform or quiz
Return values
false|stringthe name of the parent plugin, eg. mod_workshop

◆ get_plugin_info()

core_plugin_manager::get_plugin_info ( $component)

Returns information about the known plugin, or null.

Parameters
string$componentfrankenstyle component name.
Return values
core\plugininfo\base|nullthe corresponding plugin information.

◆ get_plugin_types()

core_plugin_manager::get_plugin_types ( )

Returns the result of core_component::get_plugin_types() ordered for humans.

See also
self\reorder_plugin_types()
Return values
array(string)name => (string)location

◆ get_plugin_zip_root_dir()

core_plugin_manager::get_plugin_zip_root_dir ( $zipfilepath)

Detects the plugin's name from its ZIP file.

Plugin ZIP packages are expected to contain a single directory and the directory name would become the plugin name once extracted to the Moodle dirroot.

Parameters
string$zipfilepathfull path to the ZIP files
Return values
string|boolfalse on error

◆ get_plugins()

core_plugin_manager::get_plugins ( )

Returns a tree of known plugins and information about them.

Return values
array2D array. The first keys are plugin type names (e.g. qtype); the second keys are the plugin local name (e.g. multichoice); and the values are the corresponding objects extending core::plugininfo::base

◆ get_plugins_of_type()

core_plugin_manager::get_plugins_of_type ( $type)

Returns list of known plugins of the given type.

This method returns the subset of the tree returned by self::get_plugins(). If the given type is not known, empty array is returned.

Parameters
string$typeplugin type, e.g. 'mod' or 'workshopallocation'
Return values
core\plugininfo\base[](string)plugin name (e.g. 'workshop') => corresponding subclass of core\plugininfo\base

◆ get_plugintype_root()

core_plugin_manager::get_plugintype_root ( $plugintype)

Returns the full path of the root of the given plugin type.

Null is returned if the plugin type is not known. False is returned if the plugin type root is expected but not found. Otherwise, string is returned.

Parameters
string$plugintype
Return values
string|bool|null

◆ get_present_plugins()

core_plugin_manager::get_present_plugins ( $type)

Get list of present plugins of given type.

Parameters
string$type
Return values
array|nulllist of presnet plugins $name=>$diskversion, null if unknown

◆ get_remote_plugin_info()

core_plugin_manager::get_remote_plugin_info ( $component,
$version,
$exactmatch )

Returns information about a plugin in the plugins directory.

This is typically used when checking for available dependencies (in which case the $version represents minimal version we need), or when installing an available update or a new plugin from the plugins directory (in which case the $version is exact version we are interested in). The interpretation of the $version is controlled by the $exactmatch argument.

If a plugin with the given component name is found, data about the plugin are returned as an object. The ->version property of the object contains the information about the particular plugin version that matches best the given critera. The ->version property is false if no suitable version of the plugin was found (yet the plugin itself is known).

See core::update::api::validate_pluginfo_format() for the returned data structure.

Parameters
string$componentplugin frankenstyle name
string | int$versionANY_VERSION or the version number
bool$exactmatchfalse if "given version or higher" is requested
Return values
core\update\remote_info|bool

◆ get_remote_plugin_zip()

core_plugin_manager::get_remote_plugin_zip ( $url,
$md5 )

Obtain the plugin ZIP file from the given URL.

The caller is supposed to know both downloads URL and the MD5 hash of the ZIP contents in advance, typically by using the API requests against the plugins directory.

Parameters
string$url
string$md5
Return values
string|boolfull path to the file, false on error

◆ get_subplugins()

core_plugin_manager::get_subplugins ( )

Returns list of plugins that define their subplugins and the information about them from the db/subplugins.json file.

Return values
arraywith keys like 'mod_quiz', and values the data from the corresponding db/subplugins.json file.

◆ get_subplugins_of_plugin()

core_plugin_manager::get_subplugins_of_plugin ( $component)

Returns list of all known subplugins of the given plugin.

For plugins that do not provide subplugins (i.e. there is no support for it), empty array is returned.

Parameters
string$componentfull component name, e.g. 'mod_workshop'
Return values
array(string) component name (e.g. 'workshopallocation_random') => subclass of core::plugininfo::base

◆ get_uninstall_url()

core_plugin_manager::get_uninstall_url ( $component,
$return = 'overview' )

Returns uninstall URL if exists.

Parameters
string$component
string$returneither 'overview' or 'manage'
Return values
moodle_urluninstall URL, null if uninstall not supported

◆ get_update_api_client()

core_plugin_manager::get_update_api_client ( )
protected

Returns a client for https://download.moodle.org/api/.

Return values
core\update\api

◆ install_plugins()

core_plugin_manager::install_plugins ( array $plugins,
$confirmed,
$silent )

Perform the installation of plugins.

If used for installation of remote plugins from the Moodle Plugins directory, the $plugins must be list of core::update::remote_info object that represent installable remote plugins. The caller can use self::filter_installable() to prepare the list.

If used for installation of plugins from locally available ZIP files, the $plugins should be list of objects with properties ->component and ->zipfilepath.

The method uses mtrace() to produce direct output and can be used in both web and cli interfaces.

Parameters
array$pluginslist of plugins
bool$confirmedshould the files be really deployed into the dirroot?
bool$silentperform without output
Return values
booltrue on success

◆ instance()

static core_plugin_manager::instance ( )
static

Factory method for this class.

Return values
staticthe singleton instance

◆ is_deleted_standard_plugin()

static core_plugin_manager::is_deleted_standard_plugin ( $type,
$name )
static

Defines a list of all plugins that were originally shipped in the standard Moodle distribution, but are not anymore and are deleted during upgrades.

The main purpose of this list is to hide missing plugins during upgrade.

Parameters
string$typeplugin type
string$nameplugin name
Return values
bool

◆ is_directory_removable()

core_plugin_manager::is_directory_removable ( $fullpath)

Check if the given directory can be removed by the web server process.

This recursively checks that the given directory and all its contents it writable.

Parameters
string$fullpath
Return values
boolean

◆ is_plugin_folder_removable()

core_plugin_manager::is_plugin_folder_removable ( $component)

Check to see if the given plugin folder can be removed by the web server process.

Parameters
string$componentfull frankenstyle component
Return values
bool

◆ is_plugintype_writable()

core_plugin_manager::is_plugintype_writable ( $plugintype)

Is it possible to create a new plugin directory for the given plugin type?

Exceptions
coding_exceptionfor invalid plugin types or non-existing plugin type locations
Parameters
string$plugintype
Return values
boolean

◆ is_remote_plugin_available()

core_plugin_manager::is_remote_plugin_available ( $component,
$version,
$exactmatch )

Is the given plugin version available in the plugins directory?

See self::get_remote_plugin_info() for the full explanation of how the $version parameter is interpretted.

Parameters
string$componentplugin frankenstyle name
string | int$versionANY_VERSION or the version number
bool$exactmatchfalse if "given version or higher" is requested
Return values
boolean

◆ is_remote_plugin_installable()

core_plugin_manager::is_remote_plugin_installable ( $component,
$version,
& $reason = null,
$checkremote = true )

Can the given plugin version be installed via the admin UI?

This check should be used whenever attempting to install a plugin from the plugins directory (new install, available update, missing dependency).

Parameters
string$component
int$versionversion number
string$reasonreturned code of the reason why it is not
bool$checkremotecheck this version availability on moodle server
Return values
boolean

◆ list_cancellable_installations()

core_plugin_manager::list_cancellable_installations ( )

Returns plugins, the installation of which can be cancelled.

Return values
array[(string)component] => (core\plugininfo\base)plugin

◆ list_restorable_archives()

core_plugin_manager::list_restorable_archives ( )

Returns list of all archives that can be installed to cancel the plugin upgrade.

Return values
array[(string)component] => {(string)->component, (string)->zipfilepath}

◆ load_available_updates_for_plugin()

core_plugin_manager::load_available_updates_for_plugin ( $component)

Returns list of available updates for the given component.

This method should be considered as internal API and is supposed to be called by core::plugininfo::base::available_updates() only to lazy load the data once they are first requested.

Parameters
string$componentfrankenstyle name of the plugin
Return values
null|arrayarray of core\update\info objects or null

◆ load_enabled_plugins()

core_plugin_manager::load_enabled_plugins ( )
protected

Load list of all enabled plugins, call before using $this->enabledplugins.

This method is caching results from individual plugin info classes.

◆ load_installed_plugins()

core_plugin_manager::load_installed_plugins ( )
protected

Load list of installed plugins, always call before using $this->installedplugins.

This method is caching results for all plugins.

◆ missing_dependencies()

core_plugin_manager::missing_dependencies ( $availableonly = false)

Return a list of missing dependencies.

This should provide the full list of plugins that should be installed to fulfill the requirements of all plugins, if possible.

Parameters
bool$availableonlyreturn only available missing dependencies
Return values
arrayof core\update\remote_info|bool indexed by the component name

◆ mtrace()

core_plugin_manager::mtrace ( $msg,
$eol = PHP_EOL,
$debug = null )
protected

Outputs the given message via mtrace().

If $debug is provided, then the message is displayed only at the given debugging level (e.g. DEBUG_DEVELOPER to display the message only if the site has developer debugging level selected).

Parameters
string$msgmessage
string$eolend of line
null | int$debugnull to display always, int only on given debug level

◆ other_plugins_that_require()

core_plugin_manager::other_plugins_that_require ( $component)

Get a list of any other plugins that require this one.

Parameters
string$componentfrankenstyle component name.
Return values
arrayof frankensyle component names that require this one.

◆ plugin_external_source()

core_plugin_manager::plugin_external_source ( $component)

Check to see if the current version of the plugin seems to be a checkout of an external repository.

Parameters
string$componentfrankenstyle component name
Return values
false|string

◆ plugin_name()

core_plugin_manager::plugin_name ( $component)

Returns a localized name of a given plugin.

Parameters
string$componentname of the plugin, eg mod_workshop or auth_ldap
Return values
string

◆ plugintype_name()

core_plugin_manager::plugintype_name ( $type)

Returns a localized name of a plugin typed in singular form.

Most plugin types define their names in core_plugin lang file. In case of subplugins, we try to ask the parent plugin for the name. In the worst case, we will return the value of the passed $type parameter.

Parameters
string$typethe type of the plugin, e.g. mod or workshopform
Return values
string

◆ plugintype_name_plural()

core_plugin_manager::plugintype_name_plural ( $type)

Returns a localized name of a plugin type in plural form.

Most plugin types define their names in core_plugin lang file. In case of subplugins, we try to ask the parent plugin for the name. In the worst case, we will return the value of the passed $type parameter.

Parameters
string$typethe type of the plugin, e.g. mod or workshopform
Return values
string

◆ remove_plugin_folder()

core_plugin_manager::remove_plugin_folder ( \core\plugininfo\base $plugin)

Remove the current plugin code from the dirroot.

If removing the currently installed version (which happens during updates), we archive the code so that the upgrade can be cancelled.

To prevent accidental data-loss, we also archive the existing plugin code if cancelling installation of it, so that the developer does not loose the only version of their work-in-progress.

Parameters
core\plugininfo\base$plugin

◆ reorder_plugin_types()

core_plugin_manager::reorder_plugin_types ( array $types)
protected

Reorders plugin types into a sequence to be displayed.

For technical reasons, plugin types returned by core_component::get_plugin_types() are in a certain order that does not need to fit the expected order for the display. Particularly, activity modules should be displayed first as they represent the real heart of Moodle. They should be followed by other plugin types that are used to build the courses (as that is what one expects from LMS). After that, other supportive plugin types follow.

Parameters
array$typesassociative array
Return values
arraysame array with altered order of items

◆ reset_caches()

static core_plugin_manager::reset_caches ( $phpunitreset = false)
static

Reset all caches.

Parameters
bool$phpunitreset

◆ resolve_core_requirements()

core_plugin_manager::resolve_core_requirements ( \core\plugininfo\base $plugin,
$moodleversion,
$moodlebranch )
protected

Helper method to resolve plugin's requirements on the moodle core.

Parameters
core\plugininfo\base$pluginthe plugin we are checking
string | int | double$moodleversionmoodle core branch to check against
Return values
stdObject

◆ resolve_dependency_requirements()

core_plugin_manager::resolve_dependency_requirements ( \core\plugininfo\base $plugin,
$otherpluginname,
$requiredversion,
$moodlebranch )
protected

Helper method to resolve plugin's dependecies on other plugins.

Parameters
core\plugininfo\base$pluginthe plugin we are checking
string$otherpluginname
string | int$requiredversion
string | int$moodlebranchexplicit moodle core branch to check against, defaults to $CFG->branch
Return values
stdClass

◆ resolve_plugininfo_class()

static core_plugin_manager::resolve_plugininfo_class ( $type)
static

Find the plugin info class for given type.

Parameters
string$type
Return values
stringname of pluginfo class for give plugin type

◆ resolve_requirements()

core_plugin_manager::resolve_requirements ( \core\plugininfo\base $plugin,
$moodleversion = null,
$moodlebranch = null )

Resolve requirements and dependencies of a plugin.

Returns an array of objects describing the requirement/dependency, indexed by the frankenstyle name of the component. The returned array can be empty. The objects in the array have following properties:

->(numeric)hasver ->(numeric)reqver ->(string)status ->(string)availability

Parameters
core\plugininfo\base$pluginthe plugin we are checking
null | string | int | double$moodleversionexplicit moodle core version to check against, defaults to $CFG->version
null | string | int$moodlebranchexplicit moodle core branch to check against, defaults to $CFG->branch
Return values
arrayof objects

◆ some_plugins_updatable()

core_plugin_manager::some_plugins_updatable ( )

Checks if there are some plugins with a known available update.

Return values
booltrue if there is at least one available update

◆ standard_plugins_list()

static core_plugin_manager::standard_plugins_list ( $type)
static

Defines a white list of all plugins shipped in the standard Moodle distribution.

Parameters
string$type
Return values
false|arrayarray of standard plugins or false if the type is unknown

◆ uninstall_plugin()

core_plugin_manager::uninstall_plugin ( $component,
progress_trace $progress )

Uninstall the given plugin.

Automatically cleans-up all remaining configuration data, log records, events, files from the file pool etc.

In the future, the functionality of uninstall_plugin() function may be moved into this method and all the code should be refactored to use it. At the moment, we mimic this future behaviour by wrapping that function call.

Parameters
string$component
progress_trace$progresstraces the process
Return values
booltrue on success, false on errors/problems

◆ unzip_plugin_file()

core_plugin_manager::unzip_plugin_file ( $zipfilepath,
$targetdir,
$rootdir = '' )

Extracts the saved plugin ZIP file.

Returns the list of files found in the ZIP. The format of that list is array of (string)filerelpath => (bool|string) where the array value is either true or a string describing the problematic file.

See also
zip_packer\extract_to_pathname()
Parameters
string$zipfilepathfull path to the saved ZIP file
string$targetdirfull path to the directory to extract the ZIP file to
string$rootdirexplicitly rename the root directory of the ZIP into this non-empty value
Return values
arraylist of extracted files as returned by zip_packer::extract_to_pathname()

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