diff options
author | Nathan Guse <nathaniel.guse@gmail.com> | 2013-07-27 20:37:50 -0500 |
---|---|---|
committer | Nathan Guse <nathaniel.guse@gmail.com> | 2013-07-27 20:37:50 -0500 |
commit | a79e3b341578696c1dd6720d7589b10a3226dbb5 (patch) | |
tree | 6b42e6554e796b1c46ff65ee3c277b57feaa1a10 /phpBB/phpbb/notification | |
parent | 26dac64d45944dce14b33a9c82e531f01f9a623f (diff) | |
download | forums-a79e3b341578696c1dd6720d7589b10a3226dbb5.tar forums-a79e3b341578696c1dd6720d7589b10a3226dbb5.tar.gz forums-a79e3b341578696c1dd6720d7589b10a3226dbb5.tar.bz2 forums-a79e3b341578696c1dd6720d7589b10a3226dbb5.tar.xz forums-a79e3b341578696c1dd6720d7589b10a3226dbb5.zip |
[ticket/11373] Prune old read notifications with cron
PHPBB3-11373
Diffstat (limited to 'phpBB/phpbb/notification')
-rw-r--r-- | phpBB/phpbb/notification/manager.php | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/phpBB/phpbb/notification/manager.php b/phpBB/phpbb/notification/manager.php index 97833710c0..dab69bcff9 100644 --- a/phpBB/phpbb/notification/manager.php +++ b/phpBB/phpbb/notification/manager.php @@ -59,7 +59,7 @@ class phpbb_notification_manager /** * Notification Constructor - * + * * @param array $notification_types * @param array $notification_methods * @param ContainerBuilder $phpbb_container @@ -796,11 +796,13 @@ class phpbb_notification_manager * Delete all notifications older than a certain time * * @param int $timestamp Unix timestamp to delete all notifications that were created before + * @param bool $only_unread True (default) to only prune read notifications */ - public function prune_notifications($timestamp) + public function prune_notifications($timestamp, $only_read = true) { $sql = 'DELETE FROM ' . $this->notifications_table . ' - WHERE notification_time < ' . (int) $timestamp; + WHERE notification_time < ' . (int) $timestamp . + (($only_read) ? ' AND notification_read = 1' : ''); $this->db->sql_query($sql); } @@ -834,12 +836,12 @@ class phpbb_notification_manager protected function load_object($object_name) { $object = $this->phpbb_container->get($object_name); - + if (method_exists($object, 'set_notification_manager')) { $object->set_notification_manager($this); } - + return $object; } |