mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-11 19:24:01 +02:00
[ticket/11373] Prune old read notifications with cron
PHPBB3-11373
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user