accesslib 1.9 upgrade: homepage check to see if we need to upgrade
authormartinlanghoff <martinlanghoff>
Wed, 19 Sep 2007 07:45:45 +0000 (07:45 +0000)
committermartinlanghoff <martinlanghoff>
Wed, 19 Sep 2007 07:45:45 +0000 (07:45 +0000)
This check adds a DB query _only when the upgrade is pending_. So
for a few minutes at the most.

index.php

index 15dd57e2afdfa48fd8838fac5f5e3131a19ffbd1..94a4306510070848bc311a2ee6817539b35494d7 100644 (file)
--- a/index.php
+++ b/index.php
         @require_logout();
         redirect("$CFG->wwwroot/$CFG->admin/");
     }
+    // Trigger 1.9 accesslib upgrade?
+    if ((int)$CFG->version < 2007090700 
+        && isset($USER->id) 
+        && is_siteadmin($USER->id)) { // this test is expensive, but is only triggered during the upgrade
+        redirect("$CFG->wwwroot/$CFG->admin/");
+    }
 
     if ($CFG->forcelogin) {
         require_login();