]> git.mjollnir.org Git - moodle.git/commitdiff
added a new temp config variable to help track maint mode before and after migration...
authortoyomoyo <toyomoyo>
Fri, 29 Sep 2006 03:10:38 +0000 (03:10 +0000)
committertoyomoyo <toyomoyo>
Fri, 29 Sep 2006 03:10:38 +0000 (03:10 +0000)
admin/utfdbmigrate.php

index d17118d320598b92801786f093c15eb5a03d156f..43fa1328d5c28c707e28d21f4909fbec4610a398 100755 (executable)
         print_string('importlangreminder','admin');
         print_simple_box_end();
         db_migrate2utf8();
-        print_heading('db unicode migration has been completed!');
-        unlink($filename);    //no longer in maintenance mode
+        print_heading('db unicode migration has been completed!');     
+        if (!get_config('', 'migrate_maintmode')) { // already in maint mode
+            unlink($filename);    //no longer in maintenance mode
+        }
+        unset_config('migrate_maintmode');
         @require_logout();
         print_continue($CFG->wwwroot.'/'.$CFG->admin.'/langimport.php');
     }
             //put the site in maintenance mode
             check_dir_exists($CFG->dataroot.'/'.SITEID, true);
 
-            if (touch($filename)) {
-                $file = fopen($filename, 'w');
-                fwrite($file, get_string('maintinprogress','admin'));
-                fclose($file);
+            if (file_exists($filename)) {
+                set_config('migrate_maintmode', 1); // already in maintenance mode
             } else {
-                notify (get_string('maintfileopenerror','admin'));
+                if (touch($filename)) {
+                    $file = fopen($filename, 'w');
+                    fwrite($file, get_string('maintinprogress','admin'));
+                    fclose($file);
+                } else {
+                    notify (get_string('maintfileopenerror','admin'));
+                }
             }
             //print second confirmation box
             echo '<form name="migratefrom" action="utfdbmigrate.php" method="POST">';