diff options
author | benakamoorthi <benaka.moorthi@gmail.com> | 2012-04-22 04:39:12 +0400 |
---|---|---|
committer | benakamoorthi <benaka.moorthi@gmail.com> | 2012-04-22 04:39:12 +0400 |
commit | c41dd96cedfe7ff7306dfce78bb01c35447a7052 (patch) | |
tree | 2f812b0633bf134b0f60bd39e9c908c84674abec /core/ScheduledTask.php | |
parent | 6a51691078a8df743e7e96bfdccf1edeca11546f (diff) |
Fixes #2805, made LogDataPurger delete unused actions from log_actions.
Notes:
* Added more priority levels for scheduled tasks. Priorities can be between 0 and 12 now.
* Modified priority of purge data tasks to have LOW priority and optimize tables task to have LOWEST priority.
* Fixed bug introduced in #53 w/ regard to task priorities. lowest priority tasks were not being run.
* Added Piwik_LockTables & Piwik_UnlockTables functions to PluginsFunctions/Sql.php.
* Added prefixTables(...) utility function to Piwik_Common.
git-svn-id: http://dev.piwik.org/svn/trunk@6221 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'core/ScheduledTask.php')
-rw-r--r-- | core/ScheduledTask.php | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/core/ScheduledTask.php b/core/ScheduledTask.php index b1e5ee63bc..dc0dff48fb 100644 --- a/core/ScheduledTask.php +++ b/core/ScheduledTask.php @@ -18,9 +18,11 @@ */ class Piwik_ScheduledTask { - const LOW_PRIORITY = 2; - const NORMAL_PRIORITY = 1; - const HIGH_PRIORITY = 0; + const LOWEST_PRIORITY = 12; + const LOW_PRIORITY = 9; + const NORMAL_PRIORITY = 6; + const HIGH_PRIORITY = 3; + const HIGHEST_PRIORITY = 0; /** * Class name where the specified method is located @@ -48,6 +50,11 @@ class Piwik_ScheduledTask function __construct( $_className, $_methodName, $_scheduledTime, $_priority = self::NORMAL_PRIORITY ) { + if ($_priority < self::HIGHEST_PRIORITY || $_priority > self::LOWEST_PRIORITY) + { + throw new Exception("Invalid priority for ScheduledTask '$_className.$_methodName': $_priority"); + } + $this->className = $_className; $this->methodName = $_methodName; $this->scheduledTime = $_scheduledTime; |