dbstructure now switches in the maintenance mode when updating
This commit is contained in:
parent
fa33f94b29
commit
6d16c39b7e
3 changed files with 18 additions and 0 deletions
|
@ -126,6 +126,9 @@ function print_structure($database, $charset) {
|
||||||
function update_structure($verbose, $action, $tables=null, $definition=null) {
|
function update_structure($verbose, $action, $tables=null, $definition=null) {
|
||||||
global $a, $db;
|
global $a, $db;
|
||||||
|
|
||||||
|
if ($action)
|
||||||
|
set_config('system', 'maintenance', 1);
|
||||||
|
|
||||||
if (isset($a->config["system"]["db_charset"]))
|
if (isset($a->config["system"]["db_charset"]))
|
||||||
$charset = $a->config["system"]["db_charset"];
|
$charset = $a->config["system"]["db_charset"];
|
||||||
else
|
else
|
||||||
|
@ -241,6 +244,9 @@ function update_structure($verbose, $action, $tables=null, $definition=null) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($action)
|
||||||
|
set_config('system', 'maintenance', 0);
|
||||||
|
|
||||||
return $errors;
|
return $errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,10 @@ function poller_run(&$argv, &$argc){
|
||||||
unset($db_host, $db_user, $db_pass, $db_data);
|
unset($db_host, $db_user, $db_pass, $db_data);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Quit when in maintenance
|
||||||
|
if (get_config('system', 'maintenance', true))
|
||||||
|
return;
|
||||||
|
|
||||||
$a->start_process();
|
$a->start_process();
|
||||||
|
|
||||||
$mypid = getmypid();
|
$mypid = getmypid();
|
||||||
|
@ -71,6 +75,10 @@ function poller_run(&$argv, &$argc){
|
||||||
|
|
||||||
while ($r = q("SELECT * FROM `workerqueue` WHERE `executed` = '0000-00-00 00:00:00' ORDER BY `priority`, `created` LIMIT 1")) {
|
while ($r = q("SELECT * FROM `workerqueue` WHERE `executed` = '0000-00-00 00:00:00' ORDER BY `priority`, `created` LIMIT 1")) {
|
||||||
|
|
||||||
|
// Quit when in maintenance
|
||||||
|
if (get_config('system', 'maintenance', true))
|
||||||
|
return;
|
||||||
|
|
||||||
// Constantly check the number of parallel database processes
|
// Constantly check the number of parallel database processes
|
||||||
if ($a->max_processes_reached())
|
if ($a->max_processes_reached())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
function maintenance_content(&$a) {
|
function maintenance_content(&$a) {
|
||||||
|
header('HTTP/1.1 503 Service Temporarily Unavailable');
|
||||||
|
header('Status: 503 Service Temporarily Unavailable');
|
||||||
|
header('Retry-After: 600');
|
||||||
|
|
||||||
return replace_macros(get_markup_template('maintenance.tpl'), array(
|
return replace_macros(get_markup_template('maintenance.tpl'), array(
|
||||||
'$sysdown' => t('System down for maintenance')
|
'$sysdown' => t('System down for maintenance')
|
||||||
));
|
));
|
||||||
|
|
Loading…
Reference in a new issue