From: moodler Date: Sat, 4 Sep 2004 15:47:30 +0000 (+0000) Subject: All upgrades now print a warning, allowing people to avoid accidental upgrading X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=69817927629eecf8aa2b37f6e6af065840ac8627;p=moodle.git All upgrades now print a warning, allowing people to avoid accidental upgrading --- diff --git a/admin/index.php b/admin/index.php index db0b1e7843..72825ab6e5 100644 --- a/admin/index.php +++ b/admin/index.php @@ -123,53 +123,46 @@ } -/// Insert default values for any important configuration variables - - include_once("$CFG->dirroot/lib/defaults.php"); - - foreach ($defaults as $name => $value) { - if (!isset($CFG->$name)) { - $CFG->$name = $value; - set_config($name, $value); - $configchange = true; - } - } - -/// If any new configurations were found then send to the config page to check - - if (!empty($configchange)) { - redirect("config.php"); - } - - /// Check version of Moodle code on disk compared with database /// and upgrade if possible. include_once("$CFG->dirroot/version.php"); # defines $version include_once("$CFG->dirroot/lib/db/$CFG->dbtype.php"); # defines upgrades + $stradministration = get_string("administration"); + if ($CFG->version) { if ($version > $CFG->version) { // upgrade - $a->oldversion = $CFG->version; - $a->newversion = $version; + + $a->oldversion = "$CFG->release ($CFG->version)"; + $a->newversion = "$release ($version)"; $strdatabasechecking = get_string("databasechecking", "", $a); - $strdatabasesuccess = get_string("databasesuccess"); - print_header($strdatabasechecking, $strdatabasechecking, $strdatabasechecking, - "", "", false, " ", " "); - print_heading($strdatabasechecking); - $db->debug=true; - if (main_upgrade($CFG->version)) { - $db->debug=false; - if (set_config("version", $version)) { - notify($strdatabasesuccess, "green"); - print_continue("index.php"); - die; + + if (empty($_GET['confirmupgrade'])) { + print_header($strdatabasechecking, $stradministration, $strdatabasechecking, + "", "", false, " ", " "); + notice_yesno(get_string('upgradesure', 'admin', $a->newversion), 'index.php?confirmupgrade=yes', 'index.php'); + exit; + + } else { + $strdatabasesuccess = get_string("databasesuccess"); + print_header($strdatabasechecking, $stradministration, $strdatabasechecking, + "", "", false, " ", " "); + print_heading($strdatabasechecking); + $db->debug=true; + if (main_upgrade($CFG->version)) { + $db->debug=false; + if (set_config("version", $version)) { + notify($strdatabasesuccess, "green"); + print_continue("index.php"); + exit; + } else { + notify("Upgrade failed! (Could not update version in config table)"); + } } else { - notify("Upgrade failed! (Could not update version in config table)"); + $db->debug=false; + notify("Upgrade failed! See /version.php"); } - } else { - $db->debug=false; - notify("Upgrade failed! See /version.php"); } } else if ($version < $CFG->version) { notify("WARNING!!! The code you are using is OLDER than the version that made these databases!"); @@ -177,11 +170,11 @@ } else { $strcurrentversion = get_string("currentversion"); - print_header($strcurrentversion, $strcurrentversion, $strcurrentversion, + print_header($strcurrentversion, $stradministration, $strcurrentversion, "", "", false, " ", " "); if (set_config("version", $version)) { - print_heading("You are currently using Moodle version $version (Release $release)"); + print_heading("Moodle $release ($version)"); print_continue("index.php"); die; } else { @@ -195,6 +188,7 @@ } } + /// Updated human-readable release version if necessary if ($release <> $CFG->release) { // Update the release version @@ -213,6 +207,27 @@ } + +/// Insert default values for any important configuration variables + + include_once("$CFG->dirroot/lib/defaults.php"); + + foreach ($defaults as $name => $value) { + if (!isset($CFG->$name)) { + $CFG->$name = $value; + set_config($name, $value); + $configchange = true; + } + } + +/// If any new configurations were found then send to the config page to check + + if (!empty($configchange)) { + redirect("config.php"); + } + + + /// Upgrade backup/restore system if necessary require_once("$CFG->dirroot/backup/lib.php"); upgrade_backup_db("$CFG->wwwroot/$CFG->admin/index.php"); // Return here afterwards diff --git a/lang/en/admin.php b/lang/en/admin.php index 1308c24106..714316d4ee 100755 --- a/lang/en/admin.php +++ b/lang/en/admin.php @@ -7,6 +7,10 @@ $string['filteruploadedfiles'] = 'Filter uploaded files'; $string['upgradelogs'] = 'For full functionality, your old logs need to be upgraded. More information'; $string['upgradelogsinfo'] = 'Some changes have recently been made in the way logs are stored. To be able to view all of your old logs on a per-activity basis, your old logs need to be upgraded. Depending on your site this can take a long time (eg several hours) and can be quite taxing on the database for large sites. Once you start this process you should let it finish (by keeping the browser window open). Don\'t worry - your site will work fine for other people while the logs are being upgraded.

Do you want to upgrade your logs now?'; +$string['upgradesure'] = 'Your Moodle files have been changed, and you are about to automatically upgrade your server to this version: +

$a

+

Once you do this you can not go back again.

+

Are you sure you want to upgrade this server to this version?

'; $string['upgradinglogs'] = 'Upgrading logs'; ?> diff --git a/version.php b/version.php index 51f1681676..14dbddcee5 100644 --- a/version.php +++ b/version.php @@ -5,7 +5,7 @@ // database to determine whether upgrades should // be performed (see lib/db/*.php) -$version = 2004090300; // The current version is a date (YYYYMMDDXX) +$version = 2004090402; // The current version is a date (YYYYMMDDXX) $release = "1.5 unstable development"; // User-friendly version number