From 31c3bbf549ff1cc73385a417ed97efda29e87c54 Mon Sep 17 00:00:00 2001 From: Zach Prezkuta Date: Mon, 14 Jan 2013 16:35:41 -0700 Subject: [PATCH] add maintenance mode --- index.php | 15 ++++++++++----- util/maintenance.php | 31 +++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 5 deletions(-) create mode 100644 util/maintenance.php diff --git a/index.php b/index.php index 19673fa7f9..4c98cd6e02 100644 --- a/index.php +++ b/index.php @@ -1,5 +1,6 @@ query_string = preg_replace('/[\?&]zrl=(.*?)([\?&]|$)/is','',$a->query_string); zrl_init($a); @@ -135,8 +138,10 @@ if(! x($_SESSION,'sysmsg_info')) if($install) $a->module = 'install'; +elseif($maintenance) + $a->module = 'maintenance'; else - check_config($a); + proc_run('php', 'include/dbupdate.php'); nav_set_selected('nothing'); @@ -237,7 +242,7 @@ if (file_exists($theme_info_file)){ if(! x($a->page,'content')) $a->page['content'] = ''; -if(! $install) +if(!$install && !$maintenance) call_hooks('page_content_top',$a->page['content']); /** @@ -372,7 +377,7 @@ $a->page['content'] .= '
'; * */ -if($a->module != 'install') { +if($a->module != 'install' && $a->module != 'maintenance') { nav($a); } diff --git a/util/maintenance.php b/util/maintenance.php new file mode 100644 index 0000000000..d1ff94524e --- /dev/null +++ b/util/maintenance.php @@ -0,0 +1,31 @@ + 1) + $maint_mode = intval($argv[1]); +set_config('system', 'maintenance', $maint_mode); + +if($maint_mode) + $mode_str = "maintenance mode"; +else + $mode_str = "normal mode"; + +echo "\n\tSystem set in $mode_str\n\n"; +echo "Usage:\n\n"; +echo "\tphp {$argv[0]} [1]\tSet the system in maintenance mode\n"; +echo "\tphp {$argv[0]} 0 \tSet the system in normal mode\n\n"; + -- 2.39.5