2013-01-14 18:48:01 -05:00
|
|
|
<?php
|
2018-01-22 07:29:50 -05:00
|
|
|
/**
|
|
|
|
* @file mod/maintenance.php
|
|
|
|
*/
|
2017-04-30 00:07:00 -04:00
|
|
|
use Friendica\App;
|
2017-04-30 00:01:26 -04:00
|
|
|
use Friendica\Core\Config;
|
2018-01-22 07:29:50 -05:00
|
|
|
use Friendica\Core\L10n;
|
2018-10-31 10:35:50 -04:00
|
|
|
use Friendica\Core\Renderer;
|
2018-11-08 11:28:29 -05:00
|
|
|
use Friendica\Util\Strings;
|
2017-03-19 09:24:07 -04:00
|
|
|
|
2018-01-22 07:29:50 -05:00
|
|
|
function maintenance_content(App $a)
|
|
|
|
{
|
2017-03-19 15:03:09 -04:00
|
|
|
$reason = Config::get('system', 'maintenance_reason');
|
|
|
|
|
2018-11-08 11:28:29 -05:00
|
|
|
if (substr(Strings::normaliseLink($reason), 0, 7) == 'http://') {
|
2017-03-19 15:03:09 -04:00
|
|
|
header("HTTP/1.1 307 Temporary Redirect");
|
|
|
|
header("Location:".$reason);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-10-02 09:52:52 -04:00
|
|
|
header('HTTP/1.1 503 Service Temporarily Unavailable');
|
|
|
|
header('Status: 503 Service Temporarily Unavailable');
|
|
|
|
header('Retry-After: 600');
|
|
|
|
|
2018-10-31 10:44:06 -04:00
|
|
|
return Renderer::replaceMacros(Renderer::getMarkupTemplate('maintenance.tpl'), [
|
2018-01-22 07:29:50 -05:00
|
|
|
'$sysdown' => L10n::t('System down for maintenance'),
|
2017-03-19 15:03:09 -04:00
|
|
|
'$reason' => $reason
|
2018-01-15 08:05:12 -05:00
|
|
|
]);
|
2013-01-14 18:48:01 -05:00
|
|
|
}
|