diff options
Diffstat (limited to 'plugins/Marketplace/Tasks.php')
-rw-r--r-- | plugins/Marketplace/Tasks.php | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/plugins/Marketplace/Tasks.php b/plugins/Marketplace/Tasks.php new file mode 100644 index 0000000000..81d27d4f62 --- /dev/null +++ b/plugins/Marketplace/Tasks.php @@ -0,0 +1,47 @@ +<?php +/** + * Piwik - free/libre analytics platform + * + * @link http://piwik.org + * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later + * + */ +namespace Piwik\Plugins\Marketplace; + +class Tasks extends \Piwik\Plugin\Tasks +{ + /** + * @var UpdateCommunication + */ + private $updateCommunication; + + /** + * @var Api\Client + */ + private $api; + + public function __construct(UpdateCommunication $updateCommunication, Api\Client $api) + { + $this->updateCommunication = $updateCommunication; + $this->api = $api; + } + + public function schedule() + { + $this->daily('clearAllCacheEntries', null, self::LOWEST_PRIORITY); + $this->daily('sendNotificationIfUpdatesAvailable', null, self::LOWEST_PRIORITY); + } + + public function clearAllCacheEntries() + { + $this->api->clearAllCacheEntries(); + } + + public function sendNotificationIfUpdatesAvailable() + { + if ($this->updateCommunication->isEnabled()) { + $this->updateCommunication->sendNotificationIfUpdatesAvailable(); + } + } + +}
\ No newline at end of file |