[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/lib/classes/ -> plugin_manager.php (summary)

Defines classes used for plugins management This library provides a unified interface to various plugin types in Moodle. It is mainly used by the plugins management admin page and the plugins check page during the upgrade.

Copyright: 2011 David Mudrak <[email protected]>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 1306 lines (46 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 1 file
 version.php

Defines 1 class

core_plugin_manager:: (36 methods):
  __construct()
  __clone()
  instance()
  reset_caches()
  get_plugin_types()
  load_installed_plugins()
  get_installed_plugins()
  load_enabled_plugins()
  get_enabled_plugins()
  load_present_plugins()
  get_present_plugins()
  get_plugins()
  get_plugins_of_type()
  init_pluginsinfo_property()
  resolve_plugininfo_class()
  get_subplugins_of_plugin()
  get_subplugins()
  get_parent_of_subplugin()
  plugin_name()
  plugintype_name()
  plugintype_name_plural()
  get_plugin_info()
  plugin_external_source()
  other_plugins_that_require()
  are_dependencies_satisfied()
  all_plugins_ok()
  can_uninstall_plugin()
  get_uninstall_url()
  uninstall_plugin()
  some_plugins_updatable()
  is_plugin_folder_removable()
  is_deleted_standard_plugin()
  standard_plugins_list()
  reorder_plugin_types()
  is_directory_removable()
  common_uninstall_check()


Class: core_plugin_manager  - X-Ref

Singleton class providing general plugins management functionality.

__construct()   X-Ref
Direct initiation not allowed, use the factory method {@link self::instance()}


__clone()   X-Ref
Sorry, this is singleton


instance()   X-Ref
Factory method for this class

return: core_plugin_manager the singleton instance

reset_caches($phpunitreset = false)   X-Ref
Reset all caches.

param: bool $phpunitreset

get_plugin_types()   X-Ref
Returns the result of {@link core_component::get_plugin_types()} ordered for humans

return: array (string)name => (string)location

load_installed_plugins()   X-Ref
Load list of installed plugins,
always call before using $this->installedplugins.

This method is caching results for all plugins.

get_installed_plugins($type)   X-Ref
Return list of installed plugins of given type.

param: string $type
return: array $name=>$version

load_enabled_plugins()   X-Ref
Load list of all enabled plugins,
call before using $this->enabledplugins.

This method is caching results from individual plugin info classes.

get_enabled_plugins($type)   X-Ref
Get list of enabled plugins of given type,
the result may contain missing plugins.

param: string $type
return: array|null  list of enabled plugins of this type, null if unknown

load_present_plugins()   X-Ref
Load list of all present plugins - call before using $this->presentplugins.


get_present_plugins($type)   X-Ref
Get list of present plugins of given type.

param: string $type
return: array|null  list of presnet plugins $name=>$diskversion, null if unknown

get_plugins()   X-Ref
Returns a tree of known plugins and information about them

return: array 2D array. The first keys are plugin type names (e.g. qtype);

get_plugins_of_type($type)   X-Ref
Returns list of known plugins of the given type.

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

param: string $type plugin type, e.g. 'mod' or 'workshopallocation'
return: \core\plugininfo\base[] (string)plugin name (e.g. 'workshop') => corresponding subclass of {@link \core\plugininfo\base}

init_pluginsinfo_property()   X-Ref
Init placeholder array for plugin infos.


resolve_plugininfo_class($type)   X-Ref
Find the plugin info class for given type.

param: string $type
return: string name of pluginfo class for give plugin type

get_subplugins_of_plugin($component)   X-Ref
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.

param: string $component full component name, e.g. 'mod_workshop'
return: array (string) component name (e.g. 'workshopallocation_random') => subclass of {@link \core\plugininfo\base}

get_subplugins()   X-Ref
Returns list of plugins that define their subplugins and the information
about them from the db/subplugins.php file.

return: array with keys like 'mod_quiz', and values the data from the

get_parent_of_subplugin($subplugintype)   X-Ref
Returns the name of the plugin that defines the given subplugin type

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

param: string $subplugintype the name of subplugin type, eg. workshopform or quiz
return: false|string the name of the parent plugin, eg. mod_workshop

plugin_name($component)   X-Ref
Returns a localized name of a given plugin

param: string $component name of the plugin, eg mod_workshop or auth_ldap
return: string

plugintype_name($type)   X-Ref
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.

param: string $type the type of the plugin, e.g. mod or workshopform
return: string

plugintype_name_plural($type)   X-Ref
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.

param: string $type the type of the plugin, e.g. mod or workshopform
return: string

get_plugin_info($component)   X-Ref
Returns information about the known plugin, or null

param: string $component frankenstyle component name.
return: \core\plugininfo\base|null the corresponding plugin information.

plugin_external_source($component)   X-Ref
Check to see if the current version of the plugin seems to be a checkout of an external repository.

param: string $component frankenstyle component name
return: false|string

other_plugins_that_require($component)   X-Ref
Get a list of any other plugins that require this one.

param: string $component frankenstyle component name.
return: array of frankensyle component names that require this one.

are_dependencies_satisfied($dependencies)   X-Ref
Check a dependencies list against the list of installed plugins.

param: array $dependencies compenent name to required version or ANY_VERSION.
return: bool true if all the dependencies are satisfied.

all_plugins_ok($moodleversion, &$failedplugins = array()   X-Ref
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).

param: int $moodleversion the version from version.php.
param: array $failedplugins to return the list of plugins with non-satisfied dependencies
return: bool true if all the dependencies are satisfied for all plugins.

can_uninstall_plugin($component)   X-Ref
Is it possible to uninstall the given plugin?

False is returned if the plugininfo subclass declares the uninstall should
not be allowed via {@link \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).

param: string $component full frankenstyle name, e.g. mod_foobar
return: bool

get_uninstall_url($component, $return = 'overview')   X-Ref
Returns uninstall URL if exists.

param: string $component
param: string $return either 'overview' or 'manage'
return: moodle_url uninstall URL, null if uninstall not supported

uninstall_plugin($component, progress_trace $progress)   X-Ref
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 {@link 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.

param: string $component
param: progress_trace $progress traces the process
return: bool true on success, false on errors/problems

some_plugins_updatable()   X-Ref
Checks if there are some plugins with a known available update

return: bool true if there is at least one available update

is_plugin_folder_removable($component)   X-Ref
Check to see if the given plugin folder can be removed by the web server process.

param: string $component full frankenstyle component
return: bool

is_deleted_standard_plugin($type, $name)   X-Ref
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.

param: string $type plugin type
param: string $name plugin name
return: bool

standard_plugins_list($type)   X-Ref
Defines a white list of all plugins shipped in the standard Moodle distribution

param: string $type
return: false|array array of standard plugins or false if the type is unknown

reorder_plugin_types(array $types)   X-Ref
Reorders plugin types into a sequence to be displayed

For technical reasons, plugin types returned by {@link 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.

param: array $types associative array
return: array same array with altered order of items

is_directory_removable($fullpath)   X-Ref
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.

param: string $fullpath
return: boolean

common_uninstall_check(\core\plugininfo\base $pluginfo)   X-Ref
Helper method that implements common uninstall prerequisites

param: \core\plugininfo\base $pluginfo
return: bool



Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1