diff options
author | Matthieu Napoli <matthieu@mnapoli.fr> | 2015-04-13 07:20:30 +0300 |
---|---|---|
committer | Matthieu Napoli <matthieu@mnapoli.fr> | 2015-04-16 05:45:12 +0300 |
commit | 9a35c16adb2461c77cdca8a0edb2b83337b1e9e2 (patch) | |
tree | 5554efce4d4d5af10257a4fa5a910c74703372af | |
parent | 268e5c995b5a38c1f0b79c26dc9e7af5142c23e7 (diff) |
#7620 Take into account custom logos for the maintenance mode
-rw-r--r-- | core/FrontController.php | 27 | ||||
-rw-r--r-- | plugins/Morpheus/templates/maintenance.tpl | 4 |
2 files changed, 23 insertions, 8 deletions
diff --git a/core/FrontController.php b/core/FrontController.php index d72cfe40b7..f6bb0ecf2a 100644 --- a/core/FrontController.php +++ b/core/FrontController.php @@ -18,6 +18,7 @@ use Piwik\Exception\DatabaseSchemaIsNewerThanCodebaseException; use Piwik\Http\ControllerResolver; use Piwik\Http\Router; use Piwik\Plugin\Report; +use Piwik\Plugins\CoreAdminHome\CustomLogo; use Piwik\Session; /** @@ -412,13 +413,27 @@ class FrontController extends Singleton protected function handleMaintenanceMode() { - if (Config::getInstance()->General['maintenance_mode'] == 1 - && !Common::isPhpCliMode() - ) { - Common::sendResponseCode(503); - echo file_get_contents(PIWIK_INCLUDE_PATH . '/plugins/Morpheus/templates/maintenance.tpl'); - exit; + if ((Config::getInstance()->General['maintenance_mode'] != 1) || Common::isPhpCliMode()) { + return; + } + Common::sendResponseCode(503); + + $logoUrl = null; + $faviconUrl = null; + try { + $logo = new CustomLogo(); + $logoUrl = $logo->getHeaderLogoUrl(); + $faviconUrl = $logo->getPathUserFavicon(); + } catch (Exception $ex) { } + $logoUrl = $logoUrl ?: 'plugins/Morpheus/images/logo-header.png'; + $faviconUrl = $faviconUrl ?: 'plugins/CoreHome/images/favicon.ico'; + + $page = file_get_contents(PIWIK_INCLUDE_PATH . '/plugins/Morpheus/templates/maintenance.tpl'); + $page = str_replace('%logoUrl%', $logoUrl, $page); + $page = str_replace('%faviconUrl%', $faviconUrl, $page); + echo $page; + exit; } protected function handleSSLRedirection() diff --git a/plugins/Morpheus/templates/maintenance.tpl b/plugins/Morpheus/templates/maintenance.tpl index 72cc8a7dc2..d21ab44008 100644 --- a/plugins/Morpheus/templates/maintenance.tpl +++ b/plugins/Morpheus/templates/maintenance.tpl @@ -3,13 +3,13 @@ <head> <meta charset="utf-8"> <title>Piwik is undergoing maintenance</title> - <link rel="shortcut icon" href="plugins/CoreHome/images/favicon.ico" /> + <link rel="shortcut icon" href="%faviconUrl%" /> <link rel="stylesheet" type="text/css" href="plugins/Morpheus/stylesheets/simple_structure.css" /> </head> <body id="simple"> <div class="logo"> - <img title="Piwik" alt="Piwik" src="plugins/Morpheus/images/logo-header.png"/> + <img title="Piwik" alt="Piwik" src="%logoUrl%" /> <br/> <a href='http://piwik.org/'>free/libre analytics platform</a> </div> |