$CFG->version = "";
}
-/// Turn off time limits and try to flush everything all the time, sometimes upgrades can be slow.
-
- @set_time_limit(0);
- @ob_implicit_flush(true);
- @ob_end_flush();
-
/// Check if the main tables have been installed yet or not.
if (! $tables = $db->Metatables() ) { // No tables yet at all.
} else {
error("Error: Your database ($CFG->dbtype) is not yet fully supported by Moodle. See the lib/db directory.");
}
- upgrade_log_finish();
print_continue("index.php");
die;
}
if (set_config("version", $version)) {
remove_dir($CFG->dataroot . '/cache', true); // flush cache
notify($strdatabasesuccess, "green");
- upgrade_log_finish();
print_continue("index.php");
exit;
} else {
upgrade_log_finish();
}
} else if ($version < $CFG->version) {
+ upgrade_log_start();
notify("WARNING!!! The code you are using is OLDER than the version that made these databases!");
+ upgrade_log_finish();
}
} else {
upgrade_log_start();
$db->debug=true;
if (main_upgrade(0)) {
- upgrade_log_finish();
print_continue("index.php");
exit;
} else {
if (set_config("backup_version", $backup_version) and set_config("backup_release", $backup_release)) {
notify(get_string("databasesuccess"), "green");
notify(get_string("databaseupgradebackups", "", $backup_version), "green");
- upgrade_log_finish();
print_continue($continueto);
exit;
} else {
if (set_config("backup_version", $backup_version) and set_config("backup_release", $backup_release)) {
notify(get_string("databasesuccess"), "green");
notify(get_string("databaseupgradebackups", "", $backup_version), "green");
- upgrade_log_finish();
print_continue($continueto);
exit;
} else {
} else if ($backup_version < $CFG->backup_version) {
upgrade_log_start();
notify("WARNING!!! The code you are using is OLDER than the version that made these databases!");
+ upgrade_log_finish();
}
}
session_write_close(); // from now on user can reload page - will be displayed warning
make_upload_directory('upgradelogs');
ob_start('upgrade_log_callback', 2); // function for logging to disk; flush each line of text ASAP
+ register_shutdown_function('upgrade_log_finish'); // in case somebody forgets to stop logging
}
/**
if (set_config('blocks_version', $blocks_version)) {
notify(get_string('databasesuccess'), 'notifysuccess');
notify(get_string('databaseupgradeblocks', '', $blocks_version), 'notifysuccess');
- upgrade_log_finish();
print_continue($continueto);
exit;
} else {
if (set_config('blocks_version', $blocks_version)) {
notify(get_string('databasesuccess'), 'notifysuccess');
notify(get_string('databaseupgradeblocks', '', $blocks_version), 'notifysuccess');
- upgrade_log_finish();
print_continue($continueto);
exit;
} else {
} else if ($blocks_version < $CFG->blocks_version) {
upgrade_log_start();
notify('WARNING!!! The Blocks version you are using is OLDER than the version that made these databases!');
+ upgrade_log_finish();
}
}
if (set_config('local_version', $local_version)) {
notify(get_string('databasesuccess'), 'notifysuccess');
notify(get_string('databaseupgradelocal', '', $local_version));
- upgrade_log_finish();
print_continue($continueto);
exit;
} else {
global $CFG;
+ // in case we are logging upgrade in admin/index.php stop it
+ if (function_exists('upgrade_log_finish')) {
+ upgrade_log_finish();
+ }
+
$output = '';
if (!$link) {
print_simple_box($message, '', '', '', '', 'errorbox');
+ // in case we are logging upgrade in admin/index.php stop it
+ if (function_exists('upgrade_log_finish')) {
+ upgrade_log_finish();
+ }
+
if (!$link) {
if ( !empty($SESSION->fromurl) ) {
$link = $SESSION->fromurl;
echo ' ';
}
- // clean upgrade indicator if needed; buffer and log file will be closed automatically
- if (!empty($_SESSION['upgraderunning'])) {
- $_SESSION['upgraderunning'] = 0;
- }
-
die;
}