From 8ee8bf2583802cabb5c85de535df0e3a60fc668e Mon Sep 17 00:00:00 2001
From: mattab <matthieu.aubry@gmail.com>
Date: Tue, 4 Nov 2014 12:21:27 +1300
Subject: [PATCH] Fix error when Piwik is not installed yet

---
 misc/cron/updatetoken.php            | 3 +--
 plugins/CoreAdminHome/CustomLogo.php | 8 +++++++-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/misc/cron/updatetoken.php b/misc/cron/updatetoken.php
index ff02e4f30a..4638f8bd27 100644
--- a/misc/cron/updatetoken.php
+++ b/misc/cron/updatetoken.php
@@ -40,8 +40,7 @@ function getPiwikDomain()
 {
     foreach($_SERVER['argv'] as $param) {
         $pattern = '--piwik-domain=';
-        $equalSign = strpos($param, $pattern);
-        if($equalSign !== false) {
+        if(false !== strpos($param, $pattern)) {
             return substr($param, strlen($pattern));
         }
     }
diff --git a/plugins/CoreAdminHome/CustomLogo.php b/plugins/CoreAdminHome/CustomLogo.php
index eda7ef0638..76f328e139 100644
--- a/plugins/CoreAdminHome/CustomLogo.php
+++ b/plugins/CoreAdminHome/CustomLogo.php
@@ -11,6 +11,7 @@ namespace Piwik\Plugins\CoreAdminHome;
 use Piwik\Config;
 use Piwik\Filesystem;
 use Piwik\Option;
+use Piwik\Plugin\Manager;
 use Piwik\SettingsPiwik;
 
 class CustomLogo
@@ -114,7 +115,12 @@ class CustomLogo
 
         $logo = $defaultLogo;
 
-        $themeName = \Piwik\Plugin\Manager::getInstance()->getThemeEnabled()->getPluginName();
+        $theme = \Piwik\Plugin\Manager::getInstance()->getThemeEnabled();
+        if(!$theme) {
+            $themeName = Manager::DEFAULT_THEME;
+        } else {
+            $themeName = $theme->getPluginName();
+        }
         $themeLogo = sprintf($themeLogo, $themeName);
 
         if (file_exists($pathToPiwikRoot . '/' . $themeLogo)) {
-- 
GitLab