/** * Install core moodle tables and initialize * @param float $version target version * @param bool $verbose * @return void, may throw exception */ function install_core($version, $verbose) { global $CFG, $DB; // We can not call purge_all_caches() yet, make sure the temp and cache dirs exist and are empty. remove_dir($CFG->cachedir.'', true); make_cache_directory('', true); remove_dir($CFG->localcachedir.'', true); make_localcache_directory('', true); remove_dir($CFG->tempdir.'', true); make_temp_directory('', true); remove_dir($CFG->dataroot.'/muc', true); make_writable_directory($CFG->dataroot.'/muc', true); try { core_php_time_limit::raise(600); print_upgrade_part_start('moodle', true, $verbose); // does not store upgrade running flag $DB->get_manager()->install_from_xmldb_file("$CFG->libdir/db/install.xml"); upgrade_started(); // we want the flag to be stored in config table ;-) // set all core default records and default settings require_once("$CFG->libdir/db/install.php"); xmldb_main_install(); // installs the capabilities too // store version upgrade_main_savepoint(true, $version, false); // Continue with the installation log_update_descriptions('moodle'); external_update_descriptions('moodle'); events_update_definition('moodle'); \core\task\manager::reset_scheduled_tasks_for_component('moodle'); message_update_providers('moodle'); \core\message\inbound\manager::update_handlers_for_component('moodle'); // Write default settings unconditionally admin_apply_default_settings(NULL, true); print_upgrade_part_end(null, true, $verbose); // Purge all caches. They're disabled but this ensures that we don't have any persistent data just in case something // during installation didn't use APIs. cache_helper::purge_all(); } catch (exception $ex) { upgrade_handle_exception($ex); } }
/** * Install core moodle tables and initialize * @param float $version target version * @param bool $verbose * @return void, may throw exception */ function install_core($version, $verbose) { global $CFG, $DB; try { set_time_limit(600); print_upgrade_part_start('moodle', true, $verbose); // does not store upgrade running flag $DB->get_manager()->install_from_xmldb_file("$CFG->libdir/db/install.xml"); upgrade_started(); // we want the flag to be stored in config table ;-) // set all core default records and default settings require_once("$CFG->libdir/db/install.php"); xmldb_main_install(); // installs the capabilities too // store version upgrade_main_savepoint(true, $version, false); // Continue with the installation log_update_descriptions('moodle'); external_update_descriptions('moodle'); events_update_definition('moodle'); message_update_providers('moodle'); // Write default settings unconditionally admin_apply_default_settings(NULL, true); print_upgrade_part_end(null, true, $verbose); } catch (exception $ex) { upgrade_handle_exception($ex); } }
/** * Try to upgrade the given language pack (or current language) */ function upgrade_language_pack($lang = '') { global $CFG; if (empty($lang)) { $lang = current_language(); } if ($lang == 'en_utf8') { return true; // Nothing to do } upgrade_started(false); print_heading(get_string('langimport', 'admin') . ': ' . $lang); @mkdir($CFG->dataroot . '/temp/'); //make it in case it's a fresh install, it might not be there @mkdir($CFG->dataroot . '/lang/'); require_once $CFG->libdir . '/componentlib.class.php'; if ($cd = new component_installer('http://download.moodle.org', 'lang16', $lang . '.zip', 'languages.md5', 'lang')) { $status = $cd->install(); //returns COMPONENT_(ERROR | UPTODATE | INSTALLED) if ($status == COMPONENT_INSTALLED) { @unlink($CFG->dataroot . '/cache/languages'); if ($parentlang = get_parent_language($lang)) { if ($cd = new component_installer('http://download.moodle.org', 'lang16', $parentlang . '.zip', 'languages.md5', 'lang')) { $cd->install(); } } notify(get_string('success'), 'notifysuccess'); } } print_upgrade_separator(); }
die; } $strdatabasesetup = get_string("databasesetup"); $navigation = build_navigation(array(array('name' => $strdatabasesetup, 'link' => null, 'type' => 'misc'))); print_header($strinstallation . ' - Moodle ' . $CFG->target_release, $strinstallation, $navigation, "", upgrade_get_javascript(), false, " ", " "); if (!$DB->setup_is_unicodedb()) { if (!$DB->change_db_encoding()) { // If could not convert successfully, throw error, and prevent installation print_error('unicoderequired', 'admin'); } } try { print_upgrade_part_start('moodle', true); // does not store upgrade running flag $DB->get_manager()->install_from_xmldb_file("{$CFG->libdir}/db/install.xml"); upgrade_started(); // we want the flag to be stored in config table ;-) /// set all core default records and default settings require_once "{$CFG->libdir}/db/install.php"; xmldb_main_install(); /// store version upgrade_main_savepoint(true, $version, false); /// Continue with the instalation events_update_definition('moodle'); message_update_providers('moodle'); message_update_providers('message'); /// Write default settings unconditionlly admin_apply_default_settings(NULL, true); print_upgrade_part_end(null, true); } catch (exception $ex) { upgrade_handle_exception($ex);
/** * Install core moodle tables and initialize * @param float $version target version * @param bool $verbose * @return void, may throw exception */ function install_core($version, $verbose) { global $CFG, $DB; try { // Disable the use of cache stores here. We will reset the factory after we've performed the installation. // This ensures that we don't permanently cache anything during installation. cache_factory::disable_stores(); set_time_limit(600); print_upgrade_part_start('moodle', true, $verbose); // does not store upgrade running flag $DB->get_manager()->install_from_xmldb_file("$CFG->libdir/db/install.xml"); upgrade_started(); // we want the flag to be stored in config table ;-) // set all core default records and default settings require_once("$CFG->libdir/db/install.php"); xmldb_main_install(); // installs the capabilities too // store version upgrade_main_savepoint(true, $version, false); // Continue with the installation log_update_descriptions('moodle'); external_update_descriptions('moodle'); events_update_definition('moodle'); message_update_providers('moodle'); // Write default settings unconditionally admin_apply_default_settings(NULL, true); print_upgrade_part_end(null, true, $verbose); // Purge all caches. They're disabled but this ensures that we don't have any persistent data just in case something // during installation didn't use APIs. cache_helper::purge_all(); } catch (exception $ex) { upgrade_handle_exception($ex); } }