From d9f08bdc401f7d8355fae91d27c2548669329d15 Mon Sep 17 00:00:00 2001 From: Thomas Steur Date: Wed, 5 Feb 2014 03:12:37 +0100 Subject: fixes #4612 do not bootstrap complete CronArchive when we just want to run scheduled tasks --- core/CronArchive.php | 19 ++++++++++++------- core/Tracker.php | 6 +----- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/core/CronArchive.php b/core/CronArchive.php index 4c38e6d7f6..a83fb2062c 100644 --- a/core/CronArchive.php +++ b/core/CronArchive.php @@ -116,7 +116,6 @@ Notes: private $acceptInvalidSSLCertificate = false; private $lastSuccessRunTimestamp = false; private $errors = array(); - private $isTrackerMode = false; /** * Returns the option name of the option that stores the time the archive.php script was last run. @@ -158,6 +157,17 @@ Notes: } } + public function runScheduledTasksInTrackerMode() + { + $this->initPiwikHost(); + $this->initLog(); + $this->initCore(); + $this->initTokenAuth(); + $this->logInitInfo(); + $this->checkPiwikUrlIsValid(); + $this->runScheduledTasks(); + } + /** * Main function, runs archiving on all websites with new activity */ @@ -420,11 +430,6 @@ Notes: exit(1); } - public function enableTrackerMode() - { - $this->isTrackerMode = true; - } - public function runScheduledTasks() { $this->logSection("SCHEDULED TASKS"); @@ -717,7 +722,7 @@ Notes: */ private function initCheckCli() { - if (Common::isPhpCliMode() || $this->isTrackerMode) { + if (Common::isPhpCliMode()) { return; } $token_auth = Common::getRequestVar('token_auth', '', 'string'); diff --git a/core/Tracker.php b/core/Tracker.php index e5d8ca6bf7..46e1f68d36 100644 --- a/core/Tracker.php +++ b/core/Tracker.php @@ -332,15 +332,11 @@ class Tracker ob_start(); CronArchive::$url = Common::sanitizeInputValue(Url::getCurrentUrlWithoutFileName()); $cronArchive = new CronArchive(); - $cronArchive->enableTrackerMode(); - $cronArchive->init(); - $cronArchive->runScheduledTasks(); + $cronArchive->runScheduledTasksInTrackerMode(); $resultTasks = ob_get_contents(); ob_clean(); - /* $resultTasks = TaskScheduler::runTasks(); */ - // restore original user privilege Piwik::setUserHasSuperUserAccess($isSuperUser); -- cgit v1.2.3