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

View file

@ -45,6 +45,10 @@ $string[courses] = "Courses";
$string[createaccount] = "Create my new account"; $string[createaccount] = "Create my new account";
$string[createuserandpass] = "Create a new username and password to log in with"; $string[createuserandpass] = "Create a new username and password to log in with";
$string[currentlocaltime] = "your current local time"; $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[defaultcoursefullname] = "Course Fullname 101";
$string[defaultcourseshortname] = "CF101"; $string[defaultcourseshortname] = "CF101";
$string[defaultcoursestudent] = "Student"; $string[defaultcoursestudent] = "Student";
@ -295,6 +299,8 @@ $string[success] = "Success";
$string[summary] = "Summary"; $string[summary] = "Summary";
$string[summaryof] = "Summary of \$a"; $string[summaryof] = "Summary of \$a";
$string[supplyinfo] = "Please supply some information about yourself"; $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[teacherforum] = "Teacher forum";
$string[teacheronly] = "for the \$a only"; $string[teacheronly] = "for the \$a only";
$string[textformat] = "Plain text format"; $string[textformat] = "Plain text format";

View file

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