[ Index ] |
PHP Cross Reference of moodle-2.8 |
[Source view] [Print] [Project Stats]
Various upgrade/install related functions and classes.
Copyright: | 1999 onwards Martin Dougiamas (http://dougiamas.com) |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 2205 lines (87 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 3 files lib/db/install.php version.php lib/db/upgrade.php |
upgrade_exception:: (1 method):
__construct()
downgrade_exception:: (1 method):
__construct()
upgrade_requires_exception:: (1 method):
__construct()
plugin_defective_exception:: (1 method):
__construct()
plugin_misplaced_exception:: (35 methods):
__construct()
upgrade_set_timeout()
upgrade_main_savepoint()
upgrade_mod_savepoint()
upgrade_block_savepoint()
upgrade_plugin_savepoint()
upgrade_stale_php_files_present()
upgrade_plugins()
upgrade_plugins_modules()
upgrade_plugins_blocks()
log_update_descriptions()
external_update_descriptions()
upgrade_handle_exception()
upgrade_log()
upgrade_started()
upgrade_finished_handler()
upgrade_finished()
upgrade_setup_debug()
print_upgrade_separator()
print_upgrade_part_start()
print_upgrade_part_end()
upgrade_init_javascript()
upgrade_language_pack()
install_core()
upgrade_core()
upgrade_noncore()
core_tables_exist()
upgrade_plugin_mnet_functions()
admin_mnet_method_profile()
upgrade_course_completion_remove_duplicates()
upgrade_save_orphaned_questions()
upgrade_rename_old_backup_files_using_shortname()
upgrade_grade_item_fix_sortorder()
upgrade_fix_missing_root_folders()
upgrade_fix_missing_root_folders_draft()
Class: upgrade_exception - X-Ref
Exception indicating unknown error during upgrade.__construct($plugin, $version, $debuginfo=NULL) X-Ref |
No description |
Class: downgrade_exception - X-Ref
Exception indicating downgrade error during upgrade.__construct($plugin, $oldversion, $newversion) X-Ref |
No description |
Class: upgrade_requires_exception - X-Ref
__construct($plugin, $pluginversion, $currentmoodle, $requiremoodle) X-Ref |
No description |
Class: plugin_misplaced_exception - X-Ref
Misplaced plugin exception.__construct($component, $expected, $current) X-Ref |
Constructor. param: string $component the component from version.php param: string $expected expected directory, null means calculate param: string $current plugin directory path |
upgrade_set_timeout($max_execution_time=300) X-Ref |
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. param: int $max_execution_time in seconds (can not be less than 60 s) |
upgrade_main_savepoint($result, $version, $allowabort=true) X-Ref |
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. param: bool $result false if upgrade step failed, true if completed param: string or float $version main version param: bool $allowabort allow user to abort script execution here return: void |
upgrade_mod_savepoint($result, $version, $modname, $allowabort=true) X-Ref |
Module upgrade savepoint, marks end of module upgrade blocks It stores module version, resets upgrade timeout and abort upgrade if user cancels page loading. param: bool $result false if upgrade step failed, true if completed param: string or float $version main version param: string $modname name of module param: bool $allowabort allow user to abort script execution here return: void |
upgrade_block_savepoint($result, $version, $blockname, $allowabort=true) X-Ref |
Blocks upgrade savepoint, marks end of blocks upgrade blocks It stores block version, resets upgrade timeout and abort upgrade if user cancels page loading. param: bool $result false if upgrade step failed, true if completed param: string or float $version main version param: string $blockname name of block param: bool $allowabort allow user to abort script execution here return: void |
upgrade_plugin_savepoint($result, $version, $type, $plugin, $allowabort=true) X-Ref |
Plugins upgrade savepoint, marks end of blocks upgrade blocks It stores plugin version, resets upgrade timeout and abort upgrade if user cancels page loading. param: bool $result false if upgrade step failed, true if completed param: string or float $version main version param: string $type name of plugin param: string $dir location of plugin param: bool $allowabort allow user to abort script execution here return: void |
upgrade_stale_php_files_present() X-Ref |
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). return: bool true means borked upgrade, false means previous PHP files were properly removed |
upgrade_plugins($type, $startcallback, $endcallback, $verbose) X-Ref |
Upgrade plugins param: string $type The type of plugins that should be updated (e.g. 'enrol', 'qtype') |
upgrade_plugins_modules($startcallback, $endcallback, $verbose) X-Ref |
Find and check all modules and load them up or upgrade them if necessary |
upgrade_plugins_blocks($startcallback, $endcallback, $verbose) X-Ref |
This function finds all available blocks and install them into blocks table or do all the upgrade process if newer. |
log_update_descriptions($component) X-Ref |
Log_display description function used during install and upgrade. param: string $component name of component (moodle, mod_assignment, etc.) return: void |
external_update_descriptions($component) X-Ref |
Web service discovery function used during install and upgrade. param: string $component name of component (moodle, mod_assignment, etc.) return: void |
upgrade_handle_exception($ex, $plugin = null) X-Ref |
upgrade logging functions |
upgrade_log($type, $plugin, $info, $details=null, $backtrace=null) X-Ref |
Adds log entry into upgrade_log table param: int $type UPGRADE_LOG_NORMAL, UPGRADE_LOG_NOTICE or UPGRADE_LOG_ERROR param: string $plugin frankenstyle component name param: string $info short description text of log entry param: string $details long problem description param: string $backtrace string used for errors only return: void |
upgrade_started($preinstall=false) X-Ref |
Marks start of upgrade, blocks any other access to site. The upgrade is finished at the end of script or after timeout. |
upgrade_finished_handler() X-Ref |
Internal function - executed if upgrade interrupted. |
upgrade_finished($continueurl=null) X-Ref |
Indicates upgrade is finished. This function may be called repeatedly. |
upgrade_setup_debug($starting) X-Ref |
print_upgrade_separator() X-Ref |
No description |
print_upgrade_part_start($plugin, $installation, $verbose) X-Ref |
Default start upgrade callback param: string $plugin param: bool $installation true if installation, false means upgrade |
print_upgrade_part_end($plugin, $installation, $verbose) X-Ref |
Default end upgrade callback param: string $plugin param: bool $installation true if installation, false means upgrade |
upgrade_init_javascript() X-Ref |
Sets up JS code required for all upgrade scripts. |
upgrade_language_pack($lang = null) X-Ref |
Try to upgrade the given language pack (or current language) param: string $lang the code of the language to update, defaults to the current language |
install_core($version, $verbose) X-Ref |
Install core moodle tables and initialize param: float $version target version param: bool $verbose return: void, may throw exception |
upgrade_core($version, $verbose) X-Ref |
Upgrade moodle core param: float $version target version param: bool $verbose return: void, may throw exception |
upgrade_noncore($verbose) X-Ref |
Upgrade/install other parts of moodle param: bool $verbose return: void, may throw exception |
core_tables_exist() X-Ref |
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! return: bool |
upgrade_plugin_mnet_functions($component) X-Ref |
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 param: string $component the plugin to upgrade, eg auth_mnet |
admin_mnet_method_profile(Zend_Server_Reflection_Function_Abstract $function) X-Ref |
Given some sort of Zend Reflection function/method object, return a profile array, ready to be serialized and stored param: Zend_Server_Reflection_Function_Abstract $function can be any subclass of this object type return: array |
upgrade_course_completion_remove_duplicates($table, $uniques, $fieldstocheck = array() X-Ref |
This function finds duplicate records (based on combinations of fields that should be unique) and then progamatically generated a "most correct" version of the data, update and removing records as appropriate Thanks to Dan Marsden for help param: string $table Table name param: array $uniques Array of field names that should be unique param: array $fieldstocheck Array of fields to generate "correct" data from (optional) return: void |
upgrade_save_orphaned_questions() X-Ref |
Find questions missing an existing category and associate them with a category which purpose is to gather them. return: void |
upgrade_rename_old_backup_files_using_shortname() X-Ref |
Rename old backup files to current backup files. When added the setting 'backup_shortname' (MDL-28657) the backup file names did not contain the id of the course. Further we fixed that behaviour by forcing the id to be always present in the file name (MDL-33812). This function will explore the backup directory and attempt to rename the previously created files to include the id in the name. Doing this will put them back in the process of deleting the excess backups for each course. This function manually recreates the file name, instead of using {@link backup_plan_dbops::get_default_backup_filename()}, use it carefully if you're using it outside of the usual upgrade process. return: void |
upgrade_grade_item_fix_sortorder() X-Ref |
Detect duplicate grade item sortorders and resort the items to remove them. |
upgrade_fix_missing_root_folders() X-Ref |
Detect file areas with missing root directory records and add them. |
upgrade_fix_missing_root_folders_draft() X-Ref |
Detect draft file areas with missing root directory records and add them. |
Generated: Fri Nov 28 20:29:05 2014 | Cross-referenced by PHPXref 0.7.1 |