From 31c3bbf549ff1cc73385a417ed97efda29e87c54 Mon Sep 17 00:00:00 2001 From: Zach Prezkuta Date: Mon, 14 Jan 2013 16:35:41 -0700 Subject: [PATCH 1/3] 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 19673fa7f..4c98cd6e0 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 000000000..d1ff94524 --- /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"; + From 28c9123ac88f0300b2b07cbcb6e627e1c6d5f00f Mon Sep 17 00:00:00 2001 From: Zach Prezkuta Date: Mon, 14 Jan 2013 16:48:01 -0700 Subject: [PATCH 2/3] module to show system down message --- mod/maintenance.php | 7 +++++++ view/maintenance.tpl | 1 + view/smarty3/maintenance.tpl | 6 ++++++ 3 files changed, 14 insertions(+) create mode 100644 mod/maintenance.php create mode 100644 view/maintenance.tpl create mode 100644 view/smarty3/maintenance.tpl diff --git a/mod/maintenance.php b/mod/maintenance.php new file mode 100644 index 000000000..b50c94c9b --- /dev/null +++ b/mod/maintenance.php @@ -0,0 +1,7 @@ + t('System down for maintenance') + )); +} diff --git a/view/maintenance.tpl b/view/maintenance.tpl new file mode 100644 index 000000000..bbe15d46a --- /dev/null +++ b/view/maintenance.tpl @@ -0,0 +1 @@ +
$sysdown
diff --git a/view/smarty3/maintenance.tpl b/view/smarty3/maintenance.tpl new file mode 100644 index 000000000..f0ea0849c --- /dev/null +++ b/view/smarty3/maintenance.tpl @@ -0,0 +1,6 @@ +{{* + * AUTOMATICALLY GENERATED TEMPLATE + * DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN + * + *}} +
{{$sysdown}}
From 2a8e5032e02613df0cc056c17f82ad53be638339 Mon Sep 17 00:00:00 2001 From: Zach Prezkuta Date: Mon, 14 Jan 2013 16:58:32 -0700 Subject: [PATCH 3/3] run check_config() in a separate process --- include/dbupdate.php | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 include/dbupdate.php diff --git a/include/dbupdate.php b/include/dbupdate.php new file mode 100644 index 000000000..6ae1bf10e --- /dev/null +++ b/include/dbupdate.php @@ -0,0 +1,29 @@ +