Fixes to languages for admin (setting up and upgrading databases)

This commit is contained in:
martin 2002-08-15 05:44:37 +00:00
parent 0bfa3ba286
commit 169d3404a3
3 changed files with 30 additions and 16 deletions

View file

@ -9,21 +9,23 @@
// Check databases and modules and install as needed.
if (! $db->Metatables() ) {
print_header("Setting up database", "Setting up database", "Setting up databases for the first time");
$strdatabasesetup = get_string("databasesetup");
$strdatabasesuccess = get_string("databasesuccess");
print_header($strdatabasesetup, $strdatabasesetup, $strdatabasesetup);
if (file_exists("$CFG->libdir/db/$CFG->dbtype.sql")) {
$db->debug = true;
if (modify_database("$CFG->libdir/db/$CFG->dbtype.sql")) {
$db->debug = false;
notify("Main databases set up successfully");
notify($strdatabasesuccess);
} else {
$db->debug = false;
error("Error: Main databases NOT set up successfully");
}
} else {
error("Error: Your database ($CFG->dbtype) is not yet supported by Moodle. See the lib/db directory.");
error("Error: Your database ($CFG->dbtype) is not yet fully supported by Moodle. See the lib/db directory.");
}
print_heading("<A HREF=\"index.php\">Continue</A>");
print_continue("index.php");
die;
}
@ -34,14 +36,18 @@
if ($dversion = get_field("config", "value", "name", "version")) {
if ($version > $dversion) { // upgrade
print_header("Upgrading database", "Upgrading database", "Upgrading main databases");
notify("Upgrading databases from version $dversion to $version...");
$a->oldversion = $dversion;
$a->newversion = $version;
$strdatabasechecking = get_string("databasechecking", "", $a);
$strdatabasesuccess = get_string("databasesuccess");
print_header($strdatabaseupgrades, $strdatabaseupgrades, $strdatabaseupgrades);
notify($strdatabasechecking);
$db->debug=true;
if (upgrade_moodle($dversion)) {
$db->debug=false;
if (set_field("config", "value", "$version", "name", "version")) {
notify("Databases were successfully upgraded");
print_heading("<A HREF=\"index.php\">Continue</A>");
notify($strdatabasesuccess);
print_continue("$CFG->wwwroot");
die;
} else {
notify("Upgrade failed! (Could not update version in config table)");
@ -57,15 +63,16 @@
} else {
$dversion->name = "version";
$dversion->value = $version;
print_header("Upgrading database", "Upgrading database", "Upgrading main databases");
$strdatabaseupgrades = get_string("databaseupgrades");
print_header($strdatabaseupgrades, $strdatabaseupgrades, $strdatabaseupgrades);
if (insert_record("config", $dversion)) {
notify("You are currently using Moodle version $version");
print_heading("<A HREF=\"index.php\">Continue</A>");
print_continue("index.php");
die;
} else {
$db->debug=true;
if (upgrade_moodle(0)) {
print_heading("<A HREF=\"index.php\">Continue</A>");
print_continue("index.php");
} else {
error("A problem occurred inserting current version into databases");
}
@ -109,7 +116,7 @@
if (! update_record("modules", $module)) {
error("Could not update $module->name record in modules table!");
}
notify("$module->name module was successfully upgraded");
notify(get_string("modulesuccess", "", $module->name));
} else {
$db->debug=false;
notify("Upgrading $module->name from $currmodule->version to $module->version FAILED!");
@ -122,14 +129,15 @@
} else { // module not installed yet, so install it
if (!$updated_modules) {
print_header("Setting up database", "Setting up database", "Setting up module tables", "");
$strmodulesetup = get_string("modulesetup");
print_header($strmodulesetup, $strmodulesetup, $strmodulesetup);
}
$updated_modules = true;
$db->debug = true;
if (modify_database("$fullmod/db/$CFG->dbtype.sql")) {
$db->debug = false;
if ($module->id = insert_record("modules", $module)) {
notify("$module->name tables have been set up correctly");
notify(get_string("modulesuccess", "", $module->name));
} else {
error("$module->name module could not be added to the module list!");
}
@ -140,7 +148,7 @@
}
if ($updated_modules) {
print_heading("<A HREF=\"index.php\">Continue</A>");
print_continue("index.php");
die;
}

View file

@ -45,6 +45,10 @@ $string[courses] = "Courses";
$string[createaccount] = "Create my new account";
$string[createuserandpass] = "Create a new username and password to log in with";
$string[currentlocaltime] = "your current local time";
$string[databasechecking] = "Upgrading Moodle database from version \$a->oldversion to \$a->newversion...";
$string[databasesetup] = "Setting up database";
$string[databasesuccess] = "Database was successfully upgraded";
$string[databaseupgrades] = "Upgrading database";
$string[defaultcoursefullname] = "Course Fullname 101";
$string[defaultcourseshortname] = "CF101";
$string[defaultcoursestudent] = "Student";
@ -295,6 +299,8 @@ $string[success] = "Success";
$string[summary] = "Summary";
$string[summaryof] = "Summary of \$a";
$string[supplyinfo] = "Please supply some information about yourself";
$string[modulesetup] = "Setting up module tables";
$string[modulesuccess] = "\$a tables have been set up correctly";
$string[teacherforum] = "Teacher forum";
$string[teacheronly] = "for the \$a only";
$string[textformat] = "Plain text format";

View file

@ -17,7 +17,7 @@
// If there's something it cannot do itself, it
// will tell you what you need to do.
$version = 2002080800;
$version = 2002081503;
function upgrade_moodle($oldversion=0) {