Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Static Public Member Functions | Public Attributes | Static Protected Member Functions | Protected Attributes | List of all members
core\plugininfo\base Class Reference
Inheritance diagram for core\plugininfo\base:
core\plugininfo\antivirus core\plugininfo\auth core\plugininfo\availability core\plugininfo\block core\plugininfo\cachelock core\plugininfo\cachestore core\plugininfo\calendartype core\plugininfo\coursereport core\plugininfo\customfield core\plugininfo\dataformat core\plugininfo\editor core\plugininfo\enrol core\plugininfo\fileconverter core\plugininfo\filter core\plugininfo\format core\plugininfo\general core\plugininfo\gradeexport core\plugininfo\gradeimport core\plugininfo\gradereport core\plugininfo\gradingform core\plugininfo\local core\plugininfo\media core\plugininfo\message core\plugininfo\mlbackend core\plugininfo\mnetservice core\plugininfo\mod core\plugininfo\orphaned core\plugininfo\plagiarism core\plugininfo\portfolio core\plugininfo\profilefield core\plugininfo\qbehaviour core\plugininfo\qformat core\plugininfo\qtype core\plugininfo\report core\plugininfo\repository core\plugininfo\search core\plugininfo\theme core\plugininfo\tool core\plugininfo\webservice editor_atto\plugininfo\atto editor_tinymce\plugininfo\tinymce mod_assign\plugininfo\assignfeedback mod_assign\plugininfo\assignsubmission mod_assignment\plugininfo\assignment mod_book\plugininfo\booktool mod_data\plugininfo\datafield mod_data\plugininfo\datapreset mod_forum\plugininfo\forumreport mod_lti\plugininfo\ltiservice mod_lti\plugininfo\ltisource mod_quiz\plugininfo\quiz mod_quiz\plugininfo\quizaccess mod_scorm\plugininfo\scormreport mod_workshop\plugininfo\workshopallocation mod_workshop\plugininfo\workshopeval mod_workshop\plugininfo\workshopform tool_log\plugininfo\logstore

Public Member Functions

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

Static Public Member Functions

static get_enabled_plugins ()
 Finds all enabled plugins, the result may include missing plugins. More...
 
static get_manage_url ()
 Return URL used for management of plugins of this type. More...
 
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. More...
 

Public Attributes

array $dependencies
 other plugins that this one depends on, lazy-loaded by get_other_required_plugins()
 
string $displayname
 the localized plugin name
 
int $instances
 number of instances of the plugin - not supported yet
 
string $name
 the plugin name, eg. More...
 
core_plugin_manager $pluginman
 the plugin manager this plugin info is part of
 
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
 
string $type
 the plugintype name, eg. More...
 
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

 

Static Protected Member Functions

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

Protected Attributes

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

Member Function Documentation

◆ __get()

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

Magic method getter, redirects to read only values.

Parameters
string$name
Return values
mixed

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

◆ available_updates()

core\plugininfo\base::available_updates ( )

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

◆ full_path()

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

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_default_uninstall_url()

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

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 ( )

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

Return values
string

◆ get_enabled_plugins()

static core\plugininfo\base::get_enabled_plugins ( )
static

◆ get_manage_url()

static core\plugininfo\base::get_manage_url ( )
static

◆ get_other_required_plugins()

core\plugininfo\base::get_other_required_plugins ( )

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 ( )

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 
)
static

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\orphaned, core\plugininfo\format, and core\plugininfo\dataformat.

◆ get_return_url_after_uninstall()

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

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

Parameters
string$return
Return values
moodle_url

◆ get_settings_section_name()

core\plugininfo\base::get_settings_section_name ( )

◆ get_settings_url()

core\plugininfo\base::get_settings_url ( )

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_status()

core\plugininfo\base::get_status ( )

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 ( )

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

Return values
string

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

◆ init_is_standard()

core\plugininfo\base::init_is_standard ( )

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_dependency_satisfied()

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

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

Parameters
string | int | double$moodleversion
Return values
bool

◆ is_enabled()

core\plugininfo\base::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 in mod_assignment\plugininfo\assignment, core\plugininfo\tool, core\plugininfo\orphaned, core\plugininfo\mnetservice, and tool_log\plugininfo\logstore.

◆ is_installed_and_upgraded()

core\plugininfo\base::is_installed_and_upgraded ( )

Is this plugin already installed and updated?

Return values
booltrue if plugin installed and upgraded.

◆ is_standard()

core\plugininfo\base::is_standard ( )

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 ( )

Is this is a subplugin?

Return values
boolean

◆ is_uninstall_allowed()

core\plugininfo\base::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!

Return values
bool

Reimplemented in mod_workshop\plugininfo\workshopform, mod_workshop\plugininfo\workshopeval, mod_workshop\plugininfo\workshopallocation, mod_scorm\plugininfo\scormreport, mod_quiz\plugininfo\quizaccess, mod_quiz\plugininfo\quiz, mod_lti\plugininfo\ltisource, mod_lti\plugininfo\ltiservice, mod_forum\plugininfo\forumreport, mod_data\plugininfo\datapreset, mod_data\plugininfo\datafield, mod_book\plugininfo\booktool, mod_assign\plugininfo\assignsubmission, mod_assign\plugininfo\assignfeedback, editor_tinymce\plugininfo\tinymce, editor_atto\plugininfo\atto, core\plugininfo\webservice, core\plugininfo\tool, core\plugininfo\theme, core\plugininfo\search, core\plugininfo\repository, core\plugininfo\report, core\plugininfo\qtype, core\plugininfo\qformat, core\plugininfo\qbehaviour, core\plugininfo\profilefield, core\plugininfo\portfolio, core\plugininfo\plagiarism, core\plugininfo\orphaned, core\plugininfo\mod, core\plugininfo\mlbackend, core\plugininfo\message, core\plugininfo\media, core\plugininfo\local, core\plugininfo\gradingform, core\plugininfo\gradereport, core\plugininfo\gradeimport, core\plugininfo\gradeexport, core\plugininfo\general, core\plugininfo\format, core\plugininfo\filter, core\plugininfo\fileconverter, core\plugininfo\enrol, core\plugininfo\editor, core\plugininfo\dataformat, core\plugininfo\customfield, core\plugininfo\coursereport, core\plugininfo\calendartype, core\plugininfo\cachestore, core\plugininfo\cachelock, core\plugininfo\block, core\plugininfo\availability, core\plugininfo\auth, core\plugininfo\antivirus, and tool_log\plugininfo\logstore.

◆ load_db_version()

core\plugininfo\base::load_db_version ( )

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 ( )

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()

core\plugininfo\base::load_settings ( \part_of_admin_tree  $adminroot,
  $parentnodename,
  $hassiteconfig 
)

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)

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

Reimplemented in mod_lti\plugininfo\ltisource, mod_assign\plugininfo\assignsubmission, mod_assign\plugininfo\assignfeedback, editor_atto\plugininfo\atto, core\plugininfo\tool, core\plugininfo\mlbackend, core\plugininfo\media, core\plugininfo\local, core\plugininfo\fileconverter, core\plugininfo\customfield, and core\plugininfo\availability.

◆ make_plugin_instance()

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

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

◆ uninstall()

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

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()

core\plugininfo\base::uninstall_cleanup ( )

Member Data Documentation

◆ $name

string core\plugininfo\base::$name

the plugin name, eg.

assignment, ldap

◆ $type

string core\plugininfo\base::$type

the plugintype name, eg.

mod, auth or workshopform


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