upgrade logging cleanup, fixes - more improvements ahead

This commit is contained in:
skodak
2006-08-17 22:37:34 +00:00
parent 031c8ae5a0
commit dedb2304cd
6 changed files with 15 additions and 19 deletions
+2 -9
View File
@@ -80,12 +80,6 @@
$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.
@@ -143,7 +137,6 @@
} 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;
}
@@ -191,7 +184,6 @@
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 {
@@ -204,7 +196,9 @@
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 {
@@ -216,7 +210,6 @@
upgrade_log_start();
$db->debug=true;
if (main_upgrade(0)) {
upgrade_log_finish();
print_continue("index.php");
exit;
} else {
+1 -2
View File
@@ -336,7 +336,6 @@
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 {
@@ -362,7 +361,6 @@
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 {
@@ -376,6 +374,7 @@
} 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();
}
}
+1
View File
@@ -441,6 +441,7 @@ function upgrade_log_start() {
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
}
/**
+1 -2
View File
@@ -919,7 +919,6 @@ function upgrade_blocks_db($continueto) {
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 {
@@ -945,7 +944,6 @@ function upgrade_blocks_db($continueto) {
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 {
@@ -959,6 +957,7 @@ function upgrade_blocks_db($continueto) {
} 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();
}
}
-1
View File
@@ -102,7 +102,6 @@ function upgrade_local_db($continueto) {
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 {
+10 -5
View File
@@ -2612,6 +2612,11 @@ function print_continue($link, $return=false) {
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) {
@@ -4240,6 +4245,11 @@ function error ($message, $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;
@@ -4254,11 +4264,6 @@ function error ($message, $link='') {
echo ' ';
}
// clean upgrade indicator if needed; buffer and log file will be closed automatically
if (!empty($_SESSION['upgraderunning'])) {
$_SESSION['upgraderunning'] = 0;
}
die;
}