diff options
author | mattpiwik <matthieu.aubry@gmail.com> | 2010-07-24 02:47:41 +0400 |
---|---|---|
committer | mattpiwik <matthieu.aubry@gmail.com> | 2010-07-24 02:47:41 +0400 |
commit | 7c55616c87f0326e12f12cb4e1fecaa6260960b5 (patch) | |
tree | 32ebbb5d75a561d7604da3fb302e9321d932e6e0 /core/ScheduledTask.php | |
parent | 6ddead53ae6ccfd7675a24f5b48ebc2041b81f88 (diff) |
Fixes #1184 Great patch by Julien Moumne to add Scheduled Task API in Piwik
* possibilty to schedule daily/weekly/monthly tasks
* tasks are executed via the crontab script for now (refs #1411 should be updated to trigger the tasks as well)
* features the first use case: a Monthly OPTIMIZE TABLE statement ran on all piwik archive tables (to defragment the space after we run the DELETE statements)
* Next candidates: PDF reports by email, custom Alerts
* comes his very serious unit testing
git-svn-id: http://dev.piwik.org/svn/trunk@2648 59fd770c-687e-43c8-a1e3-f5a4ff64c105
Diffstat (limited to 'core/ScheduledTask.php')
-rw-r--r-- | core/ScheduledTask.php | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/core/ScheduledTask.php b/core/ScheduledTask.php new file mode 100644 index 0000000000..dc1f2c0781 --- /dev/null +++ b/core/ScheduledTask.php @@ -0,0 +1,72 @@ +<?php +/** + * Piwik - Open source web analytics + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later + * @version $Id: ScheduledTask.php + * + * @category Piwik + * @package Piwik + */ + +/** + * Piwik_ScheduledTask is used by the task scheduler and by plugins to configure runnable tasks. + * + * @package Piwik + * @subpackage Piwik_ScheduledTask + */ +class Piwik_ScheduledTask +{ + /** + * Class name where the specified method is located + * @var string + */ + var $className; +# + /** + * Class method to run when task is scheduled + * @var string + */ + var $methodName; + + /** + * The scheduled time policy + * @var Piwik_ScheduledTime + */ + var $scheduledTime; + + function __construct( $_className, $_methodName, $_scheduledTime) + { + $this->className = $_className; + $this->methodName = $_methodName; + $this->scheduledTime = $_scheduledTime; + } + + /* + * Returns class name + * @return string + */ + public function getClassName() + { + return $this->className; + } + + /* + * Returns method name + * @return string + */ + public function getMethodName() + { + return $this->methodName; + } + + /* + * Returns scheduled time + * @return Piwik_ScheduledTime + */ + public function getScheduledTime() + { + return $this->scheduledTime; + } +} |