]> git.mjollnir.org Git - moodle.git/commitdiff
All upgrades now print a warning, allowing people to avoid accidental upgrading
authormoodler <moodler>
Sat, 4 Sep 2004 15:47:30 +0000 (15:47 +0000)
committermoodler <moodler>
Sat, 4 Sep 2004 15:47:30 +0000 (15:47 +0000)
admin/index.php
lang/en/admin.php
version.php

index db0b1e7843dfce81b4cc77f5a73d37ebd178b7da..72825ab6e5fa67f5e28f99c77426a80346e59f46 100644 (file)
     }
 
 
-/// 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, "&nbsp;", "&nbsp;");
-            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, "&nbsp;", "&nbsp;");
+                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, "&nbsp;", "&nbsp;");
+                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!");
        
     } else {
         $strcurrentversion = get_string("currentversion");
-        print_header($strcurrentversion, $strcurrentversion, $strcurrentversion, 
+        print_header($strcurrentversion, $stradministration, $strcurrentversion, 
                      "", "", false, "&nbsp;", "&nbsp;");
 
         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 {
         }
     }
 
+
 /// Updated human-readable release version if necessary
 
     if ($release <> $CFG->release) {  // Update the release version
     }
 
 
+
+/// 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
index 1308c24106e2f2505138674c5fbe4f690fd305a1..714316d4ee5bc7efd320202d77c867992a0a4eef 100755 (executable)
@@ -7,6 +7,10 @@ $string['filteruploadedfiles'] = 'Filter uploaded files';
 $string['upgradelogs'] = 'For full functionality, your old logs need to be upgraded.  <a href=\"$a\">More information</a>';
 $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.<br /><br />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:
+<p><b>$a</b></p>
+<p>Once you do this you can not go back again.</p> 
+<p>Are you sure you want to upgrade this server to this version?</p>';
 $string['upgradinglogs'] = 'Upgrading logs';
 
 ?>
index 51f1681676fed5cb25d85e37748b7be9c8ded805..14dbddcee5ef951224d781802058b7fd06f0daa8 100644 (file)
@@ -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