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