diff options
author | rechosen <rechosen@gmail.com> | 2013-09-23 18:08:29 +0200 |
---|---|---|
committer | rechosen <rechosen@gmail.com> | 2013-09-23 18:08:29 +0200 |
commit | e45b69ee094d8e3cb8cb91ebdcddb8f50db7b806 (patch) | |
tree | 0c7421d14d3f803358740a2febb84bc06acd4dac /phpBB/phpbb/cron | |
parent | 564a7cc89dcd2464024b78fe2e70adef771368f2 (diff) | |
parent | 717e2337b9276d9f9680110dff552ea536d0723c (diff) | |
download | forums-e45b69ee094d8e3cb8cb91ebdcddb8f50db7b806.tar forums-e45b69ee094d8e3cb8cb91ebdcddb8f50db7b806.tar.gz forums-e45b69ee094d8e3cb8cb91ebdcddb8f50db7b806.tar.bz2 forums-e45b69ee094d8e3cb8cb91ebdcddb8f50db7b806.tar.xz forums-e45b69ee094d8e3cb8cb91ebdcddb8f50db7b806.zip |
Merge branch 'develop' of git://github.com/phpbb/phpbb3 into ticket/11786
Diffstat (limited to 'phpBB/phpbb/cron')
-rw-r--r-- | phpBB/phpbb/cron/task/core/prune_notifications.php | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/phpBB/phpbb/cron/task/core/prune_notifications.php b/phpBB/phpbb/cron/task/core/prune_notifications.php new file mode 100644 index 0000000000..296c0ae64f --- /dev/null +++ b/phpBB/phpbb/cron/task/core/prune_notifications.php @@ -0,0 +1,65 @@ +<?php +/** +* +* @package phpBB3 +* @copyright (c) 2013 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* Prune notifications cron task. +* +* @package phpBB3 +*/ +class phpbb_cron_task_core_prune_notifications extends phpbb_cron_task_base +{ + protected $config; + protected $notification_manager; + + /** + * Constructor. + * + * @param phpbb_config $config The config + * @param phpbb_notification_manager $notification_manager Notification manager + */ + public function __construct(phpbb_config $config, phpbb_notification_manager $notification_manager) + { + $this->config = $config; + $this->notification_manager = $notification_manager; + } + + /** + * {@inheritdoc} + */ + public function run() + { + // time minus expire days in seconds + $timestamp = time() - ($this->config['read_notification_expire_days'] * 60 * 60 * 24); + $this->notification_manager->prune_notifications($timestamp); + } + + /** + * {@inheritdoc} + */ + public function is_runnable() + { + return (bool) $this->config['read_notification_expire_days']; + } + + /** + * {@inheritdoc} + */ + public function should_run() + { + return $this->config['read_notification_last_gc'] < time() - $this->config['read_notification_gc']; + } +} |