/// Check all blocks and load (or upgrade them if necessary) /// first old *.php update and then the new upgrade.php script upgrade_blocks_plugins("{$CFG->wwwroot}/{$CFG->admin}/index.php"); // Return here afterwards /// Check all enrolment plugins and upgrade if necessary /// first old *.php update and then the new upgrade.php script upgrade_plugins('enrol', 'enrol', "{$CFG->wwwroot}/{$CFG->admin}/index.php"); // Return here afterwards /// Check all auth plugins and upgrade if necessary upgrade_plugins('auth', 'auth', "{$CFG->wwwroot}/{$CFG->admin}/index.php"); /// Check all course formats and upgrade if necessary upgrade_plugins('format', 'course/format', "{$CFG->wwwroot}/{$CFG->admin}/index.php"); /// Check for local database customisations /// first old *.php update and then the new upgrade.php script require_once "{$CFG->dirroot}/lib/locallib.php"; upgrade_local_db("{$CFG->wwwroot}/{$CFG->admin}/index.php"); // Return here afterwards /// Check for changes to RPC functions require_once "{$CFG->dirroot}/{$CFG->admin}/mnet/adminlib.php"; upgrade_RPC_functions("{$CFG->wwwroot}/{$CFG->admin}/index.php"); // Return here afterwards /// Upgrade all plugins for gradebook upgrade_plugins('gradeexport', 'grade/export', "{$CFG->wwwroot}/{$CFG->admin}/index.php"); upgrade_plugins('gradeimport', 'grade/import', "{$CFG->wwwroot}/{$CFG->admin}/index.php"); upgrade_plugins('gradereport', 'grade/report', "{$CFG->wwwroot}/{$CFG->admin}/index.php"); /// Check all message output plugins and upgrade if necessary upgrade_plugins('message', 'message/output', "{$CFG->wwwroot}/{$CFG->admin}/index.php"); /// Check all course report plugins and upgrade if necessary upgrade_plugins('coursereport', 'course/report', "{$CFG->wwwroot}/{$CFG->admin}/index.php"); /// Check all admin report plugins and upgrade if necessary upgrade_plugins('report', $CFG->admin . '/report', "{$CFG->wwwroot}/{$CFG->admin}/index.php");
moodle_install_roles(); // Install core event handlers events_update_definition(); // Install core message providers message_update_providers(); message_update_providers('message'); // Write default settings unconditionally (i.e. even if a setting is already set, overwrite it) admin_apply_default_settings(NULL, true); /// upgrade all plugins types $upgradedplugins = false; $plugintypes = get_plugin_types(); foreach ($plugintypes as $type => $location) { $upgradedplugins = upgrade_plugins($type, $location) || $upgradedplugins; } /// Check for changes to RPC functions if ($CFG->mnet_dispatcher_mode != 'off') { require_once "{$CFG->dirroot}/{$CFG->admin}/mnet/adminlib.php"; upgrade_RPC_functions($return_url); // Return here afterwards } /// Check for local database customisations /// first old *.php update and then the new upgrade.php script require_once "{$CFG->dirroot}/lib/locallib.php"; upgrade_local_db($return_url); // Return here afterwards /// just make sure upgrade logging is properly terminated upgrade_finished(); /// make sure admin user is created - this is the last step because we need /// session to be working properly in order to edit admin account create_admin_user(); redirect('index.php');
} /// Check for changes to RPC functions if ($CFG->mnet_dispatcher_mode != 'off') { try { // this needs a full rewrite, sorry to mention that :-( require_once "{$CFG->dirroot}/{$CFG->admin}/mnet/adminlib.php"; upgrade_RPC_functions(); // Return here afterwards } catch (Exception $ex) { upgrade_handle_exception($ex); } } /// Check for local database customisations try { require_once "{$CFG->dirroot}/lib/locallib.php"; upgrade_local_db('print_upgrade_part_start', 'print_upgrade_part_end'); } catch (Exception $ex) { upgrade_handle_exception($ex); } /// indicate that this site is fully configured except the admin password if (empty($CFG->rolesactive)) { set_config('rolesactive', 1); set_config('adminsetuppending', 1); // we neeed this redirect to setup proper session upgrade_finished("index.php?sessionstarted=1&lang={$CFG->lang}"); } /// make sure admin user is created - this is the last step because we need /// session to be working properly in order to edit admin account if (!empty($CFG->adminsetuppending)) { $sessionstarted = optional_param('sessionstarted', 0, PARAM_BOOL); if (!$sessionstarted) {
} upgrade_plugins('enrol', 'enrol', ''); // Don't return anywhere /// Check all course formats and upgrade if necessary if ($verbose > CLI_NO) { print_heading(get_string('upgradingcourseformatplugin', 'install'), '', 1); } upgrade_plugins('format', 'course/format', ''); // Don't return anywhere /// Check for local database customisations /// first old *.php update and then the new upgrade.php script require_once "{$CFG->dirroot}/lib/locallib.php"; if ($verbose > CLI_NO) { print_heading(get_string('upgradinglocaldb', 'install'), '', 1); } upgrade_local_db(''); // Don't return anywhere /// Check for changes to RPC functions require_once "{$CFG->dirroot}/{$CFG->admin}/mnet/adminlib.php"; if ($verbose > CLI_NO) { print_heading(get_string('upgradingrpcfunctions', 'install'), '', 1); } upgrade_RPC_functions(''); // Don't return anywhere /// Upgrade all plugins for gradebook if ($verbose > CLI_NO) { print_heading(get_string('upgradinggradeexportplugin', 'install'), '', 1); } upgrade_plugins('gradeexport', 'grade/export', ''); // Don't return anywhere if ($verbose > CLI_NO) {