Skip to content
Browse files

New upgrading procedure, uses module functions to handle all version …

…changes
  • Loading branch information...
1 parent 12b820c commit 2c4483e5fb8043e13c7ab3c718d75d88e4bea1f1 martin committed Jul 27, 2002
Showing with 16 additions and 3 deletions.
  1. +16 −3 admin/index.php
View
19 admin/index.php
@@ -50,7 +50,20 @@
if ($currmodule->version == $module->version) {
// do nothing
} else if ($currmodule->version < $module->version) {
- notify("$module->name module needs upgrading"); // XXX do the upgrade here
+ notify("$module->name module needs upgrading");
+ $upgrade_function = $module->name."_upgrade";
+ if (function_exists($upgrade_function)) {
+ if ($upgrade_function($currmodule->version, $module)) {
+ // OK so far, now update the modules record
+ $module->id = $currmodule->id;
+ if (! update_record("modules", $module)) {
+ error("Could not update $module->name record in modules table!");
+ }
+ notify("$module->name module was successfully upgraded");
+ } else {
+ notify("Upgrading $module->name from $currmodule->version to $module->version FAILED!");
+ }
+ }
$updated_modules = true;
} else {
error("Version mismatch: $module->name can't downgrade $currmodule->version -> $module->version !");
@@ -67,7 +80,7 @@
} else {
error("$module->name module could not be added to the module list!");
}
- } else {
+ } else {
error("$module->name tables could NOT be set up successfully!");
}
}
@@ -101,7 +114,7 @@
echo "<LI><B><A HREF=\"user.php\">Edit a user's account</A></B>";
echo "<LI><B><A HREF=\"teacher.php\">Assign teachers to courses</A></B>";
echo "<LI><B>Delete a course</B>";
- echo "<LI><B>View Logs</B>";
+ echo "<LI><B><A HREF=\"../course/log.php?id=$site->id\">Site Logs</A></B>";
echo "</UL>";
print_footer();

0 comments on commit 2c4483e

Please sign in to comment.
Something went wrong with that request. Please try again.