From a79e3b341578696c1dd6720d7589b10a3226dbb5 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Sat, 27 Jul 2013 20:37:50 -0500 Subject: [ticket/11373] Prune old read notifications with cron PHPBB3-11373 --- phpBB/phpbb/cron/task/core/prune_notifications.php | 75 ++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 phpBB/phpbb/cron/task/core/prune_notifications.php (limited to 'phpBB/phpbb/cron') 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..6d38091e9f --- /dev/null +++ b/phpBB/phpbb/cron/task/core/prune_notifications.php @@ -0,0 +1,75 @@ +config = $config; + $this->notification_manager = $notification_manager; + } + + /** + * Runs this cron task. + * + * @return null + */ + 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); + } + + /** + * Returns whether this cron task can run, given current board configuration.= + * + * @return bool + */ + public function is_runnable() + { + return (bool) $this->config['read_notification_expire_days']; + } + + /** + * Returns whether this cron task should run now, because enough time + * has passed since it was last run. + * + * The interval between prune notifications is specified in board + * configuration. + * + * @return bool + */ + public function should_run() + { + return $this->config['read_notification_last_gc'] < time() - $this->config['read_notification_gc']; + } +} -- cgit v1.2.1 From 0a7508439f20b358f1e51d3f2d8105903588e430 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Wed, 28 Aug 2013 12:39:57 -0500 Subject: [ticket/11373] Use inheritdoc PHPBB3-11373 --- phpBB/phpbb/cron/task/core/prune_notifications.php | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'phpBB/phpbb/cron') diff --git a/phpBB/phpbb/cron/task/core/prune_notifications.php b/phpBB/phpbb/cron/task/core/prune_notifications.php index 6d38091e9f..296c0ae64f 100644 --- a/phpBB/phpbb/cron/task/core/prune_notifications.php +++ b/phpBB/phpbb/cron/task/core/prune_notifications.php @@ -38,9 +38,7 @@ class phpbb_cron_task_core_prune_notifications extends phpbb_cron_task_base } /** - * Runs this cron task. - * - * @return null + * {@inheritdoc} */ public function run() { @@ -50,9 +48,7 @@ class phpbb_cron_task_core_prune_notifications extends phpbb_cron_task_base } /** - * Returns whether this cron task can run, given current board configuration.= - * - * @return bool + * {@inheritdoc} */ public function is_runnable() { @@ -60,13 +56,7 @@ class phpbb_cron_task_core_prune_notifications extends phpbb_cron_task_base } /** - * Returns whether this cron task should run now, because enough time - * has passed since it was last run. - * - * The interval between prune notifications is specified in board - * configuration. - * - * @return bool + * {@inheritdoc} */ public function should_run() { -- cgit v1.2.1