mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
Moodle can now upgrade itself, just like the modules do
This commit is contained in:
parent
dafa318bab
commit
cbd1170e91
6 changed files with 97 additions and 32 deletions
|
@ -24,6 +24,41 @@
|
|||
die;
|
||||
}
|
||||
|
||||
// Check version of Moodle code on disk compared with database
|
||||
// and upgrade if possible.
|
||||
|
||||
include_once("$CFG->dirroot/version.php"); # defines $version and upgrades
|
||||
|
||||
if ($dversion = get_field("config", "value", "name", "version")) {
|
||||
if ($version > $dversion) { // upgrade
|
||||
notify("Upgrading databases from version $dversion to $version...");
|
||||
if (upgrade_moodle($dversion)) {
|
||||
if (set_field("config", "value", "$version", "name", "version")) {
|
||||
notify("Databases were successfully upgraded");
|
||||
print_heading("<A HREF=\"index.php\">Continue</A>");
|
||||
die;
|
||||
} else {
|
||||
notify("Upgrade failed! (Could not update version in config table)");
|
||||
}
|
||||
} else {
|
||||
notify("Upgrade failed! See /version.php");
|
||||
}
|
||||
} else if ($version < $dversion) {
|
||||
notify("WARNING!!! The code you are using is OLDER than the version that made these databases!");
|
||||
}
|
||||
|
||||
} else {
|
||||
$dversion->name = "version";
|
||||
$dversion->value = $version;
|
||||
if (insert_record("config", $dversion)) {
|
||||
notify("You are currently using Moodle version $version");
|
||||
print_heading("<A HREF=\"index.php\">Continue</A>");
|
||||
die;
|
||||
} else {
|
||||
error("A problem occurred inserting current version into databases");
|
||||
}
|
||||
}
|
||||
|
||||
// Find and check all modules and load them up.
|
||||
$dir = opendir("$CFG->dirroot/mod");
|
||||
while ($mod = readdir($dir)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue