Moodle  2.2.1
http://www.collinsharper.com
plugin_manager Class Reference

Public Member Functions

 get_plugins ($disablecache=false)
 get_subplugins ($disablecache=false)
 get_parent_of_subplugin ($subplugintype)
 plugin_name ($plugin)
 plugintype_name_plural ($type)
 get_plugin_info ($component)
 other_plugins_that_require ($component)
 are_dependencies_satisfied ($dependencies)
 all_plugins_ok ($moodleversion)

Static Public Member Functions

static instance ()
static is_deleted_standard_plugin ($type, $name)
static standard_plugins_list ($type)

Data Fields

const PLUGIN_SOURCE_STANDARD = 'std'
const PLUGIN_SOURCE_EXTENSION = 'ext'
const PLUGIN_STATUS_NODB = 'nodb'
const PLUGIN_STATUS_UPTODATE = 'uptodate'
const PLUGIN_STATUS_NEW = 'new'
const PLUGIN_STATUS_UPGRADE = 'upgrade'
const PLUGIN_STATUS_DELETE = 'delete'
const PLUGIN_STATUS_DOWNGRADE = 'downgrade'
const PLUGIN_STATUS_MISSING = 'missing'

Protected Member Functions

 __construct ()
 __clone ()

Protected Attributes

 $pluginsinfo = null
 $subpluginsinfo = null

Static Protected Attributes

static $singletoninstance

Detailed Description

Singleton class providing general plugins management functionality

Definition at line 35 of file pluginlib.php.


Constructor & Destructor Documentation

__construct ( ) [protected]

Direct initiation not allowed, use the factory method self::instance()

Todo:
we might want to specify just a single plugin type to work with

Definition at line 69 of file pluginlib.php.

Here is the call graph for this function:


Member Function Documentation

__clone ( ) [protected]

Sorry, this is singleton

Definition at line 76 of file pluginlib.php.

all_plugins_ok ( moodleversion)

Checks all dependencies for all installed plugins. Used by install and upgrade.

Parameters:
int$moodleversionthe version from version.php.
Returns:
bool true if all the dependencies are satisfied for all plugins.

Definition at line 277 of file pluginlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

are_dependencies_satisfied ( dependencies)

Check a dependencies list against the list of installed plugins.

Parameters:
array$dependenciescompenent name to required version or ANY_VERSION.
Returns:
bool true if all the dependencies are satisfied.

Definition at line 257 of file pluginlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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
Returns:
false|string the name of the parent plugin, eg. mod_workshop

Definition at line 167 of file pluginlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

get_plugin_info ( component)
Parameters:
string$componentfrankenstyle component name.
Returns:
plugin_information|null the corresponding plugin information.

Definition at line 224 of file pluginlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

get_plugins ( disablecache = false)

Returns a tree of known plugins and information about them

Parameters:
bool$disablecacheforce reload, cache can be used otherwise
Returns:
array 2D 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 plugin_information objects.

Definition at line 101 of file pluginlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

get_subplugins ( disablecache = false)

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

At the moment, only activity modules can define subplugins.

Parameters:
bool$disablecacheforce reload, cache can be used otherwise
Returns:
array with keys like 'mod_quiz', and values the data from the corresponding db/subplugins.php file.

Definition at line 136 of file pluginlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static instance ( ) [static]

Factory method for this class

Returns:
plugin_manager the singleton instance

Definition at line 84 of file pluginlib.php.

static 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
Returns:
bool

Definition at line 304 of file pluginlib.php.

Here is the caller graph for this function:

other_plugins_that_require ( component)

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

Parameters:
string$componentfrankenstyle component name.
Returns:
array of frankensyle component names that require this one.

Definition at line 239 of file pluginlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

plugin_name ( plugin)

Returns a localized name of a given plugin

Parameters:
string$pluginname of the plugin, eg mod_workshop or auth_ldap
Returns:
string

Definition at line 186 of file pluginlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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
Returns:
string

Definition at line 201 of file pluginlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static standard_plugins_list ( type) [static]

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

Parameters:
string$type
Returns:
false|array array of standard plugins or false if the type is unknown

Definition at line 322 of file pluginlib.php.

Here is the caller graph for this function:


Field Documentation

$pluginsinfo = null [protected]

Definition at line 60 of file pluginlib.php.

$singletoninstance [static, protected]

Definition at line 58 of file pluginlib.php.

$subpluginsinfo = null [protected]

Definition at line 62 of file pluginlib.php.

const PLUGIN_SOURCE_EXTENSION = 'ext'

the plugin is added extension

Definition at line 40 of file pluginlib.php.

const PLUGIN_SOURCE_STANDARD = 'std'

the plugin is shipped with standard Moodle distribution

Definition at line 38 of file pluginlib.php.

the standard plugin is about to be deleted

Definition at line 51 of file pluginlib.php.

const PLUGIN_STATUS_DOWNGRADE = 'downgrade'

the version at the disk is lower than the one already installed

Definition at line 53 of file pluginlib.php.

const PLUGIN_STATUS_MISSING = 'missing'

the plugin is installed but missing from disk

Definition at line 55 of file pluginlib.php.

const PLUGIN_STATUS_NEW = 'new'

the plugin is about to be installed

Definition at line 47 of file pluginlib.php.

const PLUGIN_STATUS_NODB = 'nodb'

the plugin uses neither database nor capabilities, no versions

Definition at line 43 of file pluginlib.php.

const PLUGIN_STATUS_UPGRADE = 'upgrade'

the plugin is about to be upgraded

Definition at line 49 of file pluginlib.php.

const PLUGIN_STATUS_UPTODATE = 'uptodate'

the plugin is up-to-date

Definition at line 45 of file pluginlib.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations