]> git.mxchange.org Git - friendica.git/commitdiff
Add custom message to the maintenance module display
authorHypolite Petovan <hypolite@mrpetovan.com>
Tue, 9 Mar 2021 15:36:10 +0000 (10:36 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Wed, 10 Mar 2021 14:50:20 +0000 (09:50 -0500)
src/Module/Maintenance.php
view/templates/exception.tpl

index ece9cea13390f92e027ad4c5b8e151aa3e4911d3..36deee83d339c783f3f95262b2190304eac1527c 100644 (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' => is_site_admin() ? $reason : '',
+                       '$stack_trace' => '',
+                       '$trace' => '',
+               ]);
        }
 }
index 4b296614165422114e452bee3ebe002af2044d18..0456136bc48aafeee8091f873cd2c8e3dbe4eaf5 100644 (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>