Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
|
Classes | |
class | core_upgrade_time |
Static class monitors performance of upgrade steps. More... | |
class | downgrade_exception |
Exception indicating downgrade error during upgrade. More... | |
class | plugin_defective_exception |
class | plugin_incompatible_exception |
Exception thrown when attempting to install a plugin that declares incompatibility with moodle version. More... | |
class | plugin_misplaced_exception |
Misplaced plugin exception. More... | |
class | upgrade_exception |
Exception indicating unknown error during upgrade. More... | |
class | upgrade_requires_exception |
Functions | |
admin_mnet_method_get_docblock (ReflectionFunctionAbstract $function) | |
Given some sort of reflection function/method object, return an array of docblock lines, where each line is an array of keywords/descriptions. | |
admin_mnet_method_get_help (ReflectionFunctionAbstract $function) | |
Given some sort of reflection function/method object, return just the help text. | |
admin_mnet_method_profile (ReflectionFunctionAbstract $function) | |
Given some sort of reflection function/method object, return a profile array, ready to be serialized and stored. | |
check_admin_dir_usage (environment_results $result) | |
Check whether the admin directory has been configured and warn if so. | |
check_async_backup (environment_results $result) | |
Check if asynchronous backups are enabled. | |
check_database_storage_engine (environment_results $result) | |
This function verifies that the database is not using an unsupported storage engine. | |
check_database_tables_row_format (environment_results $result) | |
This function verifies if the database has tables using innoDB Antelope row format. | |
check_db_prefix_length (environment_results $result) | |
This function checks that the database prefix ($CFG->prefix) is <= xmldb_table\PREFIX_MAX_LENGTH. | |
check_igbinary322_version (environment_results $result) | |
Check if the igbinary extension installed is buggy one. | |
check_is_https (environment_results $result) | |
Check if the site is being served using an ssl url. | |
check_libcurl_version (environment_results $result) | |
Check if recommended version of libcurl is installed or not. | |
check_max_input_vars (environment_results $result) | |
Environment check for the php setting max_input_vars. | |
check_mod_assignment (environment_results $result) | |
Check whether the mod_assignment is currently being used. | |
check_mysql_file_format (environment_results $result) | |
This function verfies that the database has tables using InnoDB Antelope row format. | |
check_mysql_file_per_table (environment_results $result) | |
This function verfies that the database has a setting of one file per table. | |
check_mysql_incomplete_unicode_support (environment_results $result) | |
This function checks the database to see if it is using incomplete unicode support. | |
check_mysql_large_prefix (environment_results $result) | |
This function verfies that the database has the setting of large prefix enabled. | |
check_oracle_usage (environment_results $result) | |
Check whether the Oracle database is currently being used and warn if so. | |
check_sixtyfour_bits (environment_results $result) | |
Check if the site is using 64 bits PHP. | |
check_slasharguments (environment_results $result) | |
Method used to check the usage of slasharguments config and display a warning message. | |
check_tls_libraries (environment_results $result) | |
Checks for up-to-date TLS libraries. | |
check_unoconv_version (environment_results $result) | |
Method used to check the installed unoconv version. | |
check_upgrade_key ($upgradekeyhash) | |
Assert the upgrade key is provided, if it is defined. | |
check_xmlrpc_usage (environment_results $result) | |
Check whether the XML-RPC protocol is enabled and warn if so. | |
core_tables_exist () | |
Checks if the main tables have been installed yet or not. | |
external_update_descriptions ($component) | |
Web service discovery function used during install and upgrade. | |
external_update_services () | |
Allow plugins and subsystems to add external functions to other plugins or built-in services. | |
install_core ($version, $verbose) | |
Install core moodle tables and initialize. | |
log_update_descriptions ($component) | |
Log_display description function used during install and upgrade. | |
print_upgrade_part_end ($plugin, $installation, $verbose) | |
Default end upgrade callback. | |
print_upgrade_part_start ($plugin, $installation, $verbose) | |
Default start upgrade callback. | |
print_upgrade_separator () | |
upgrade_block_savepoint ($result, $version, $blockname, $allowabort=true) | |
Blocks upgrade savepoint, marks end of blocks upgrade blocks It stores block version, resets upgrade timeout and abort upgrade if user cancels page loading. | |
upgrade_component_updated (string $component, string $messageplug='', bool $coreinstall=false) | |
After upgrading a module, block, or generic plugin, various parts of the system need to be informed. | |
upgrade_core ($version, $verbose) | |
Upgrade moodle core. | |
object | upgrade_finished ($continueurl=null) |
Indicates upgrade is finished. | |
upgrade_finished_handler () | |
Internal function - executed if upgrade interrupted. | |
upgrade_handle_exception ($ex, $plugin=null) | |
upgrade logging functions | |
object | upgrade_init_javascript () |
Sets up JS code required for all upgrade scripts. | |
upgrade_install_plugins (array $installable, $confirmed, $heading='', $continue=null, $return=null) | |
Helper procedure/macro for installing remote plugins at admin/index.php. | |
upgrade_language_pack ($lang=null) | |
Try to upgrade the given language pack (or current language) | |
upgrade_log ($type, $plugin, $info, $details=null, $backtrace=null) | |
Adds log entry into upgrade_log table. | |
upgrade_main_savepoint ($result, $version, $allowabort=true) | |
Upgrade savepoint, marks end of each upgrade block. | |
upgrade_mod_savepoint ($result, $version, $modname, $allowabort=true) | |
Module upgrade savepoint, marks end of module upgrade blocks It stores module version, resets upgrade timeout and abort upgrade if user cancels page loading. | |
upgrade_noncore ($verbose) | |
Upgrade/install other parts of moodle. | |
upgrade_plugin_mnet_functions ($component) | |
upgrades the mnet rpc definitions for the given component. | |
upgrade_plugin_savepoint ($result, $version, $type, $plugin, $allowabort=true) | |
Plugins upgrade savepoint, marks end of plugin upgrade blocks It stores plugin version, resets upgrade timeout and abort upgrade if user cancels page loading. | |
upgrade_plugins ($type, $startcallback, $endcallback, $verbose) | |
Upgrade plugins. | |
object | upgrade_plugins_blocks ($startcallback, $endcallback, $verbose) |
This function finds all available blocks and install them into blocks table or do all the upgrade process if newer. | |
object | upgrade_plugins_modules ($startcallback, $endcallback, $verbose) |
Find and check all modules and load them up or upgrade them if necessary. | |
upgrade_set_timeout ($max_execution_time=300) | |
Sets maximum expected time needed for upgrade task. | |
object | upgrade_setup_debug ($starting) |
@global object | |
upgrade_stale_php_files_present () | |
Detect if there are leftovers in PHP source files. | |
object | upgrade_started ($preinstall=false) |
Marks start of upgrade, blocks any other access to site. | |
upgrade_themes () | |
Build the current theme so that the user doesn't have to wait for it to build on the first page load after the install / upgrade. | |
Variables | |
const | UPGRADE_LOG_ERROR 2 |
UPGRADE_LOG_ERROR = 2. | |
const | UPGRADE_LOG_NORMAL 0 |
UPGRADE_LOG_NORMAL = 0. | |
const | UPGRADE_LOG_NOTICE 1 |
UPGRADE_LOG_NOTICE = 1. | |
admin_mnet_method_get_docblock | ( | ReflectionFunctionAbstract | $function | ) |
Given some sort of reflection function/method object, return an array of docblock lines, where each line is an array of keywords/descriptions.
ReflectionFunctionAbstract | $function | reflection function/method object from which to extract information |
array | docblock converted in to an array |
admin_mnet_method_get_help | ( | ReflectionFunctionAbstract | $function | ) |
Given some sort of reflection function/method object, return just the help text.
ReflectionFunctionAbstract | $function | reflection function/method object from which to extract information |
string | docblock help text |
admin_mnet_method_profile | ( | ReflectionFunctionAbstract | $function | ) |
Given some sort of reflection function/method object, return a profile array, ready to be serialized and stored.
ReflectionFunctionAbstract | $function | reflection function/method object from which to extract information |
array | associative array with function/method information |
check_admin_dir_usage | ( | environment_results | $result | ) |
Check whether the admin directory has been configured and warn if so.
The admin directory has been deprecated since Moodle 4.0.
environment_results | $result |
null|environment_results |
check_async_backup | ( | environment_results | $result | ) |
Check if asynchronous backups are enabled.
environment_results | $result |
environment_results|null |
check_database_storage_engine | ( | environment_results | $result | ) |
This function verifies that the database is not using an unsupported storage engine.
environment_results | $result | object to update, if relevant |
environment_results|null | updated results object, or null if the storage engine is supported |
check_database_tables_row_format | ( | environment_results | $result | ) |
This function verifies if the database has tables using innoDB Antelope row format.
environment_results | $result |
environment_results|null | updated results object, or null if no Antelope table has been found. |
check_db_prefix_length | ( | environment_results | $result | ) |
This function checks that the database prefix ($CFG->prefix) is <= xmldb_table\PREFIX_MAX_LENGTH.
environment_results | $result |
environment_results|null | updated results object, or null if the prefix check is passing ok. |
check_igbinary322_version | ( | environment_results | $result | ) |
Check if the igbinary extension installed is buggy one.
There are a few php-igbinary versions that are buggy and return any unserialised array with wrong index. This defeats key() and next() operations on them.
This library is used by MUC and also by memcached and redis when available.
Let's inform if there is some problem when:
environment_results | $result | object to update, if relevant. |
environment_results|null | updated results or null. |
check_is_https | ( | environment_results | $result | ) |
Check if the site is being served using an ssl url.
Note this does not really perform any request neither looks for proxies or other situations. Just looks to wwwroot and warn if it's not using https.
environment_results | $result | $result |
environment_results|null | updated results object, or null if the site is https. |
check_libcurl_version | ( | environment_results | $result | ) |
Check if recommended version of libcurl is installed or not.
environment_results | $result | object to update, if relevant. |
environment_results|null | updated results or null. |
check_max_input_vars | ( | environment_results | $result | ) |
Environment check for the php setting max_input_vars.
environment_results | $result |
environment_results|null |
check_mod_assignment | ( | environment_results | $result | ) |
Check whether the mod_assignment is currently being used.
environment_results | $result |
environment_results|null |
check_mysql_file_format | ( | environment_results | $result | ) |
This function verfies that the database has tables using InnoDB Antelope row format.
environment_results | $result |
environment_results|null | updated results object, or null if no Antelope table has been found. |
check_mysql_file_per_table | ( | environment_results | $result | ) |
This function verfies that the database has a setting of one file per table.
This is required for 'utf8mb4'.
environment_results | $result |
environment_results|null | updated results object, or null if innodb_file_per_table = 1. |
check_mysql_incomplete_unicode_support | ( | environment_results | $result | ) |
This function checks the database to see if it is using incomplete unicode support.
environment_results | $result | $result |
environment_results|null | updated results object, or null if unicode is fully supported. |
check_mysql_large_prefix | ( | environment_results | $result | ) |
This function verfies that the database has the setting of large prefix enabled.
This is required for 'utf8mb4'.
environment_results | $result |
environment_results|null | updated results object, or null if innodb_large_prefix = 1. |
check_oracle_usage | ( | environment_results | $result | ) |
Check whether the Oracle database is currently being used and warn if so.
The Oracle database support will be removed in a future version (4.5) as it is no longer supported by PHP.
environment_results | $result | object to update, if relevant |
environment_results|null | updated results or null if the current database is not Oracle. |
check_sixtyfour_bits | ( | environment_results | $result | ) |
Check if the site is using 64 bits PHP.
environment_results | $result |
environment_results|null | updated results object, or null if the site is using 64 bits PHP. |
check_slasharguments | ( | environment_results | $result | ) |
Method used to check the usage of slasharguments config and display a warning message.
environment_results | $result | object to update, if relevant. |
environment_results|null | updated results or null if slasharguments is disabled. |
check_tls_libraries | ( | environment_results | $result | ) |
Checks for up-to-date TLS libraries.
NOTE: this is not currently used, see MDL-57262.
environment_results | $result | object to update, if relevant. |
environment_results|null | updated results or null if unoconv path is not executable. |
check_unoconv_version | ( | environment_results | $result | ) |
Method used to check the installed unoconv version.
environment_results | $result | object to update, if relevant. |
environment_results|null | updated results or null if unoconv path is not executable. |
check_upgrade_key | ( | $upgradekeyhash | ) |
Assert the upgrade key is provided, if it is defined.
The upgrade key can be defined in the main config.php as $CFG->upgradekey. If it is defined there, then its value must be provided every time the site is being upgraded, regardless the administrator is logged in or not.
This is supposed to be used at certain places in /admin/index.php only.
string | null | $upgradekeyhash | the SHA-1 of the value provided by the user |
check_xmlrpc_usage | ( | environment_results | $result | ) |
Check whether the XML-RPC protocol is enabled and warn if so.
The XML-RPC protocol will be removed in a future version (4.1) as it is no longer supported by PHP.
See MDL-70889 for further information.
environment_results | $result |
null|environment_results |
core_tables_exist | ( | ) |
Checks if the main tables have been installed yet or not.
Note: we can not use caches here because they might be stale, use with care!
bool |
external_update_descriptions | ( | $component | ) |
Web service discovery function used during install and upgrade.
string | $component | name of component (moodle, etc.) |
void |
external_update_services | ( | ) |
Allow plugins and subsystems to add external functions to other plugins or built-in services.
This function is executed just after all the plugins have been updated.
install_core | ( | $version, | |
$verbose ) |
Install core moodle tables and initialize.
float | $version | target version |
bool | $verbose |
void,may | throw exception |
log_update_descriptions | ( | $component | ) |
Log_display description function used during install and upgrade.
string | $component | name of component (moodle, etc.) |
void |
print_upgrade_part_end | ( | $plugin, | |
$installation, | |||
$verbose ) |
Default end upgrade callback.
string | $plugin | |
bool | $installation | true if installation, false means upgrade |
print_upgrade_part_start | ( | $plugin, | |
$installation, | |||
$verbose ) |
Default start upgrade callback.
string | $plugin | |
bool | $installation | true if installation, false means upgrade |
upgrade_block_savepoint | ( | $result, | |
$version, | |||
$blockname, | |||
$allowabort = true ) |
Blocks upgrade savepoint, marks end of blocks upgrade blocks It stores block version, resets upgrade timeout and abort upgrade if user cancels page loading.
bool | $result | false if upgrade step failed, true if completed |
string | float | $version | main version |
string | $blockname | name of block |
bool | $allowabort | allow user to abort script execution here |
upgrade_component_updated | ( | string | $component, |
string | $messageplug = '', | ||
bool | $coreinstall = false ) |
After upgrading a module, block, or generic plugin, various parts of the system need to be informed.
string | $component | Frankenstyle component or 'moodle' for core |
string | $messageplug | Set to the name of a message plugin if this is one |
bool | $coreinstall | Set to true if this is the core install |
upgrade_core | ( | $version, | |
$verbose ) |
Upgrade moodle core.
float | $version | target version |
bool | $verbose |
void,may | throw exception |
object upgrade_finished | ( | $continueurl = null | ) |
Indicates upgrade is finished.
This function may be called repeatedly.
@global object
upgrade_install_plugins | ( | array | $installable, |
$confirmed, | |||
$heading = '', | |||
$continue = null, | |||
$return = null ) |
Helper procedure/macro for installing remote plugins at admin/index.php.
Does not return, always redirects or exits.
array | $installable | list of core\update\remote_info |
bool | $confirmed | false: display the validation screen, true: proceed installation |
string | $heading | validation screen heading |
moodle_url | string | null | $continue | URL to proceed with installation at the validation screen |
moodle_url | string | null | $return | URL to go back on cancelling at the validation screen |
upgrade_language_pack | ( | $lang = null | ) |
Try to upgrade the given language pack (or current language)
string | $lang | the code of the language to update, defaults to the current language |
upgrade_log | ( | $type, | |
$plugin, | |||
$info, | |||
$details = null, | |||
$backtrace = null ) |
Adds log entry into upgrade_log table.
int | $type | UPGRADE_LOG_NORMAL, UPGRADE_LOG_NOTICE or UPGRADE_LOG_ERROR |
string | $plugin | frankenstyle component name |
string | $info | short description text of log entry |
string | $details | long problem description |
string | $backtrace | string used for errors only |
void |
upgrade_main_savepoint | ( | $result, | |
$version, | |||
$allowabort = true ) |
Upgrade savepoint, marks end of each upgrade block.
It stores new main version, resets upgrade timeout and abort upgrade if user cancels page loading.
Please do not make large upgrade blocks with lots of operations, for example when adding tables keep only one table operation per block.
bool | $result | false if upgrade step failed, true if completed |
string | or float $version main version | |
bool | $allowabort | allow user to abort script execution here |
void |
upgrade_mod_savepoint | ( | $result, | |
$version, | |||
$modname, | |||
$allowabort = true ) |
Module upgrade savepoint, marks end of module upgrade blocks It stores module version, resets upgrade timeout and abort upgrade if user cancels page loading.
bool | $result | false if upgrade step failed, true if completed |
string | float | $version | main version |
string | $modname | name of module |
bool | $allowabort | allow user to abort script execution here |
upgrade_noncore | ( | $verbose | ) |
Upgrade/install other parts of moodle.
bool | $verbose |
void,may | throw exception |
upgrade_plugin_mnet_functions | ( | $component | ) |
upgrades the mnet rpc definitions for the given component.
this method doesn't return status, an exception will be thrown in the case of an error
string | $component | the plugin to upgrade, eg auth_mnet |
upgrade_plugin_savepoint | ( | $result, | |
$version, | |||
$type, | |||
$plugin, | |||
$allowabort = true ) |
Plugins upgrade savepoint, marks end of plugin upgrade blocks It stores plugin version, resets upgrade timeout and abort upgrade if user cancels page loading.
bool | $result | false if upgrade step failed, true if completed |
string | float | $version | main version |
string | $type | The type of the plugin. |
string | $plugin | The name of the plugin. |
bool | $allowabort | allow user to abort script execution here |
upgrade_plugins | ( | $type, | |
$startcallback, | |||
$endcallback, | |||
$verbose ) |
Upgrade plugins.
string | $type | The type of plugins that should be updated (e.g. 'enrol', 'qtype') return void |
object upgrade_plugins_blocks | ( | $startcallback, | |
$endcallback, | |||
$verbose ) |
This function finds all available blocks and install them into blocks table or do all the upgrade process if newer.
@global object
object upgrade_plugins_modules | ( | $startcallback, | |
$endcallback, | |||
$verbose ) |
Find and check all modules and load them up or upgrade them if necessary.
@global object
upgrade_set_timeout | ( | $max_execution_time = 300 | ) |
Sets maximum expected time needed for upgrade task.
Please always make sure that upgrade will not run longer!
The script may be automatically aborted if upgrade times out.
int | $max_execution_time | in seconds (can not be less than 60 s) |
upgrade_stale_php_files_present | ( | ) |
Detect if there are leftovers in PHP source files.
During main version upgrades administrators MUST move away old PHP source files and start from scratch (or better use git).
bool | true means borked upgrade, false means previous PHP files were properly removed |
object upgrade_started | ( | $preinstall = false | ) |
Marks start of upgrade, blocks any other access to site.
The upgrade is finished at the end of script or after timeout.
@global object @global object