}
-/// 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!");
} 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 {
}
}
+
/// 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