diff options
author | mattpiwik <matthieu.aubry@gmail.com> | 2012-03-21 13:18:14 +0400 |
---|---|---|
committer | mattpiwik <matthieu.aubry@gmail.com> | 2012-03-21 13:18:14 +0400 |
commit | 6769a0b852297449787758761c5e21048d3dbed5 (patch) | |
tree | 47a2b9c17c80ab7dc24f35d3da4b86aaa05113db /core/TaskScheduler.php | |
parent | 247dea2862143447bc880792775fde3c3a4f88f8 (diff) |
Fixes #3017
BUG explanation: During scheduled tasks, Super User status is enforced. This was not a problem until recently, because the Scheduled report was always about one website in particular. since we added All websites Refs #2600 now the report was generated as "Super User"....
so I force the getSitesWithAtLeastViewAccess in the SitesManager API to be restricted to the user who created the report..
This solution is unfortunately a bit hacky but I couldn't find a better way and it took me 4 hours to get it right... pff
git-svn-id: http://dev.piwik.org/svn/trunk@6085 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'core/TaskScheduler.php')
-rw-r--r-- | core/TaskScheduler.php | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/core/TaskScheduler.php b/core/TaskScheduler.php index 8835e3f5f3..280e94a99a 100644 --- a/core/TaskScheduler.php +++ b/core/TaskScheduler.php @@ -27,7 +27,8 @@ class Piwik_TaskScheduler { const GET_TASKS_EVENT = "TaskScheduler.getScheduledTasks"; const TIMETABLE_OPTION_STRING = "TaskScheduler.timetable"; - + static private $running = false; + /* * runTasks collects tasks defined within piwik plugins, runs them if they are scheduled and reschedules * the tasks that have been executed. @@ -76,6 +77,7 @@ class Piwik_TaskScheduler $timetable[$fullyQualifiedMethodName] = $scheduledTime->getRescheduledTime(); Piwik_SetOption(self::TIMETABLE_OPTION_STRING, serialize($timetable)); + self::$running = true; // Run the task try { $timer = new Piwik_Timer; @@ -84,6 +86,7 @@ class Piwik_TaskScheduler } catch(Exception $e) { $message = 'ERROR: '.$e->getMessage(); } + self::$running = false; $return[] = array('task' => $fullyQualifiedMethodName, 'output' => $message); } @@ -92,6 +95,11 @@ class Piwik_TaskScheduler } + static public function isTaskBeingExecuted() + { + return self::$running; + } + /* * return the timetable for a given task */ |