From: toyomoyo Date: Fri, 29 Sep 2006 03:10:38 +0000 (+0000) Subject: added a new temp config variable to help track maint mode before and after migration... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=39ecfc7453619059c5305f796719a0bfb7185625;p=moodle.git added a new temp config variable to help track maint mode before and after migration MDL-6182, not fixing in stable yet due to the lack of support of unset_config function. --- diff --git a/admin/utfdbmigrate.php b/admin/utfdbmigrate.php index d17118d320..43fa1328d5 100755 --- a/admin/utfdbmigrate.php +++ b/admin/utfdbmigrate.php @@ -87,8 +87,11 @@ 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'); } @@ -116,12 +119,16 @@ //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 '
';