From 02d002c38f0d15fc0064792b3771f7eb78aa007a Mon Sep 17 00:00:00 2001
From: mattab <matthieu.aubry@gmail.com>
Date: Fri, 9 Jan 2015 23:59:04 +1300
Subject: [PATCH] fix Notice: Undefined index: defaultReport in
 ..../core/CronArchive.php on line 1518 reported in
 http://forum.piwik.org/read.php?2,123367

---
 core/CronArchive.php | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/core/CronArchive.php b/core/CronArchive.php
index 4925d01c65..5b3d53d7c1 100644
--- a/core/CronArchive.php
+++ b/core/CronArchive.php
@@ -1516,10 +1516,10 @@ class CronArchive
                 continue;
             }
 
-            $defaultReport = $userPreferences[APIUsersManager::PREFERENCE_DEFAULT_REPORT];
-            if (is_numeric($defaultReport)) {
+            if (isset($userPreferences[APIUsersManager::PREFERENCE_DEFAULT_REPORT])
+                && is_numeric($userPreferences[APIUsersManager::PREFERENCE_DEFAULT_REPORT])) {
                 // If user selected one particular website ID
-                $idSites = array($defaultReport);
+                $idSites = array($userPreferences[APIUsersManager::PREFERENCE_DEFAULT_REPORT]);
             } else {
                 // If user selected "All websites"  or some other random value, we pre-process all websites that he has access to
                 $idSites = APISitesManager::getInstance()->getSitesIdWithAtLeastViewAccess($userLogin);
-- 
GitLab