Merge pull request #10027 from MrPetovan/task/9950-improve-maintenance-page
Improve maintenance page
This commit is contained in:
commit
5e98a38ac9
14
src/App.php
14
src/App.php
|
@ -24,6 +24,8 @@ namespace Friendica;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Friendica\App\Arguments;
|
use Friendica\App\Arguments;
|
||||||
use Friendica\App\BaseURL;
|
use Friendica\App\BaseURL;
|
||||||
|
use Friendica\App\Module;
|
||||||
|
use Friendica\Module\Maintenance;
|
||||||
use Friendica\Security\Authentication;
|
use Friendica\Security\Authentication;
|
||||||
use Friendica\Core\Config\Cache;
|
use Friendica\Core\Config\Cache;
|
||||||
use Friendica\Core\Config\IConfig;
|
use Friendica\Core\Config\IConfig;
|
||||||
|
@ -499,8 +501,6 @@ class App
|
||||||
// but we need "view" module for stylesheet
|
// but we need "view" module for stylesheet
|
||||||
if ($this->mode->isInstall() && $moduleName !== 'install') {
|
if ($this->mode->isInstall() && $moduleName !== 'install') {
|
||||||
$this->baseURL->redirect('install');
|
$this->baseURL->redirect('install');
|
||||||
} elseif (!$this->mode->isInstall() && !$this->mode->has(App\Mode::MAINTENANCEDISABLED) && $moduleName !== 'maintenance') {
|
|
||||||
$this->baseURL->redirect('maintenance');
|
|
||||||
} else {
|
} else {
|
||||||
$this->checkURL();
|
$this->checkURL();
|
||||||
Core\Update::check($this->getBasePath(), false, $this->mode);
|
Core\Update::check($this->getBasePath(), false, $this->mode);
|
||||||
|
@ -544,9 +544,13 @@ class App
|
||||||
// Initialize module that can set the current theme in the init() method, either directly or via App->profile_uid
|
// Initialize module that can set the current theme in the init() method, either directly or via App->profile_uid
|
||||||
$page['page_title'] = $moduleName;
|
$page['page_title'] = $moduleName;
|
||||||
|
|
||||||
// determine the module class and save it to the module instance
|
if (!$this->mode->isInstall() && !$this->mode->has(App\Mode::MAINTENANCEDISABLED)) {
|
||||||
// @todo there's an implicit dependency due SESSION::start(), so it has to be called here (yet)
|
$module = new Module('maintenance', Maintenance::class);
|
||||||
$module = $module->determineClass($this->args, $router, $this->config);
|
} else {
|
||||||
|
// determine the module class and save it to the module instance
|
||||||
|
// @todo there's an implicit dependency due SESSION::start(), so it has to be called here (yet)
|
||||||
|
$module = $module->determineClass($this->args, $router, $this->config);
|
||||||
|
}
|
||||||
|
|
||||||
// Let the module run it's internal process (init, get, post, ...)
|
// Let the module run it's internal process (init, get, post, ...)
|
||||||
$module->run($this->l10n, $this->baseURL, $this->logger, $this->profiler, $_SERVER, $_POST);
|
$module->run($this->l10n, $this->baseURL, $this->logger, $this->profiler, $_SERVER, $_POST);
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
namespace Friendica\Module;
|
namespace Friendica\Module;
|
||||||
|
|
||||||
use Friendica\BaseModule;
|
use Friendica\BaseModule;
|
||||||
|
use Friendica\Core\Renderer;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Network\HTTPException;
|
use Friendica\Network\HTTPException;
|
||||||
|
@ -43,7 +44,17 @@ class Maintenance extends BaseModule
|
||||||
}
|
}
|
||||||
|
|
||||||
$exception = new HTTPException\ServiceUnavailableException($reason);
|
$exception = new HTTPException\ServiceUnavailableException($reason);
|
||||||
$exception->httpdesc = DI::l10n()->t('System down for maintenance');
|
|
||||||
throw $exception;
|
header($_SERVER["SERVER_PROTOCOL"] . ' ' . $exception->getCode() . ' ' . DI::l10n()->t('System down for maintenance'));
|
||||||
|
|
||||||
|
$tpl = Renderer::getMarkupTemplate('exception.tpl');
|
||||||
|
|
||||||
|
return Renderer::replaceMacros($tpl, [
|
||||||
|
'$title' => DI::l10n()->t('System down for maintenance'),
|
||||||
|
'$message' => DI::l10n()->t('This Friendica node is currently in maintenance mode, either automatically because it is self-updating or manually by the node administrator. This condition should be temporary, please come back in a few minutes.'),
|
||||||
|
'$thrown' => $reason,
|
||||||
|
'$stack_trace' => '',
|
||||||
|
'$trace' => '',
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -303,7 +303,6 @@ return [
|
||||||
'/login' => [Module\Security\Login::class, [R::GET, R::POST]],
|
'/login' => [Module\Security\Login::class, [R::GET, R::POST]],
|
||||||
'/logout' => [Module\Security\Logout::class, [R::GET, R::POST]],
|
'/logout' => [Module\Security\Logout::class, [R::GET, R::POST]],
|
||||||
'/magic' => [Module\Magic::class, [R::GET]],
|
'/magic' => [Module\Magic::class, [R::GET]],
|
||||||
'/maintenance' => [Module\Maintenance::class, [R::GET]],
|
|
||||||
'/manifest' => [Module\Manifest::class, [R::GET]],
|
'/manifest' => [Module\Manifest::class, [R::GET]],
|
||||||
'/friendica.webmanifest' => [Module\Manifest::class, [R::GET]],
|
'/friendica.webmanifest' => [Module\Manifest::class, [R::GET]],
|
||||||
'/modexp/{nick}' => [Module\PublicRSAKey::class, [R::GET]],
|
'/modexp/{nick}' => [Module\PublicRSAKey::class, [R::GET]],
|
||||||
|
|
12211
view/lang/C/messages.po
12211
view/lang/C/messages.po
File diff suppressed because it is too large
Load Diff
|
@ -7,5 +7,7 @@
|
||||||
{{$stack_trace}}
|
{{$stack_trace}}
|
||||||
{{$trace}}</pre>
|
{{$trace}}</pre>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{if $back}}
|
||||||
<p><button type="button" onclick="window.history.back()" class="btn btn-primary">{{$back}}</button></p>
|
<p><button type="button" onclick="window.history.back()" class="btn btn-primary">{{$back}}</button></p>
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user