Merge pull request #10027 from MrPetovan/task/9950-improve-maintenance-page

Improve maintenance page
This commit is contained in:
Michael Vogel 2021-03-10 20:19:55 +01:00 committed by GitHub
commit 5e98a38ac9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 6132 additions and 6111 deletions

View file

@ -24,6 +24,8 @@ namespace Friendica;
use Exception;
use Friendica\App\Arguments;
use Friendica\App\BaseURL;
use Friendica\App\Module;
use Friendica\Module\Maintenance;
use Friendica\Security\Authentication;
use Friendica\Core\Config\Cache;
use Friendica\Core\Config\IConfig;
@ -499,8 +501,6 @@ class App
// but we need "view" module for stylesheet
if ($this->mode->isInstall() && $moduleName !== 'install') {
$this->baseURL->redirect('install');
} elseif (!$this->mode->isInstall() && !$this->mode->has(App\Mode::MAINTENANCEDISABLED) && $moduleName !== 'maintenance') {
$this->baseURL->redirect('maintenance');
} else {
$this->checkURL();
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
$page['page_title'] = $moduleName;
// 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);
if (!$this->mode->isInstall() && !$this->mode->has(App\Mode::MAINTENANCEDISABLED)) {
$module = new Module('maintenance', Maintenance::class);
} 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, ...)
$module->run($this->l10n, $this->baseURL, $this->logger, $this->profiler, $_SERVER, $_POST);

View file

@ -22,6 +22,7 @@
namespace Friendica\Module;
use Friendica\BaseModule;
use Friendica\Core\Renderer;
use Friendica\Core\System;
use Friendica\DI;
use Friendica\Network\HTTPException;
@ -43,7 +44,17 @@ class Maintenance extends BaseModule
}
$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' => '',
]);
}
}

View file

@ -303,7 +303,6 @@ return [
'/login' => [Module\Security\Login::class, [R::GET, R::POST]],
'/logout' => [Module\Security\Logout::class, [R::GET, R::POST]],
'/magic' => [Module\Magic::class, [R::GET]],
'/maintenance' => [Module\Maintenance::class, [R::GET]],
'/manifest' => [Module\Manifest::class, [R::GET]],
'/friendica.webmanifest' => [Module\Manifest::class, [R::GET]],
'/modexp/{nick}' => [Module\PublicRSAKey::class, [R::GET]],

File diff suppressed because it is too large Load diff

View file

@ -7,5 +7,7 @@
{{$stack_trace}}
{{$trace}}</pre>
{{/if}}
{{if $back}}
<p><button type="button" onclick="window.history.back()" class="btn btn-primary">{{$back}}</button></p>
{{/if}}
</div>