From 3e03b0a7ca4055b4f05be7d4ec7bcfaacf364eff Mon Sep 17 00:00:00 2001 From: Thomas Steur Date: Thu, 5 Jun 2014 06:44:37 +0200 Subject: refs #5301 started to simplify scheduled tasks API while staying backwards compatible --- plugins/DBStats/DBStats.php | 36 ------------------------------------ 1 file changed, 36 deletions(-) (limited to 'plugins/DBStats/DBStats.php') diff --git a/plugins/DBStats/DBStats.php b/plugins/DBStats/DBStats.php index ac6ee1e355..03c04700a1 100644 --- a/plugins/DBStats/DBStats.php +++ b/plugins/DBStats/DBStats.php @@ -8,19 +8,13 @@ */ namespace Piwik\Plugins\DBStats; -use Piwik\Date; use Piwik\Option; use Piwik\Piwik; use Piwik\Plugin\ViewDataTable; use Piwik\Plugins\CoreVisualizations\Visualizations\Graph; use Piwik\Plugins\CoreVisualizations\Visualizations\HtmlTable; use Piwik\Plugins\CoreVisualizations\Visualizations\JqplotGraph\Pie; -use Piwik\ScheduledTask; -use Piwik\ScheduledTime; -/** - * - */ class DBStats extends \Piwik\Plugin { const TIME_OF_LAST_TASK_RUN_OPTION = 'dbstats_time_of_last_cache_task_run'; @@ -32,42 +26,12 @@ class DBStats extends \Piwik\Plugin { return array( 'AssetManager.getStylesheetFiles' => 'getStylesheetFiles', - 'TaskScheduler.getScheduledTasks' => 'getScheduledTasks', 'ViewDataTable.configure' => 'configureViewDataTable', 'ViewDataTable.getDefaultType' => 'getDefaultTypeViewDataTable', "TestingEnvironment.addHooks" => 'setupTestEnvironment' ); } - /** - * Gets all scheduled tasks executed by this plugin. - */ - public function getScheduledTasks(&$tasks) - { - $cacheDataByArchiveNameReportsTask = new ScheduledTask( - $this, - 'cacheDataByArchiveNameReports', - null, - ScheduledTime::factory('weekly'), - ScheduledTask::LOWEST_PRIORITY - ); - $tasks[] = $cacheDataByArchiveNameReportsTask; - } - - /** - * Caches the intermediate DataTables used in the getIndividualReportsSummary and - * getIndividualMetricsSummary reports in the option table. - */ - public function cacheDataByArchiveNameReports() - { - $api = API::getInstance(); - $api->getIndividualReportsSummary(true); - $api->getIndividualMetricsSummary(true); - - $now = Date::now()->getLocalized("%longYear%, %shortMonth% %day%"); - Option::set(self::TIME_OF_LAST_TASK_RUN_OPTION, $now); - } - public function getStylesheetFiles(&$stylesheets) { $stylesheets[] = "plugins/DBStats/stylesheets/dbStatsTable.less"; -- cgit v1.2.3