[ticket/17010] Add prune notification support to webpush

PHPBB3-17010
This commit is contained in:
Marc Alexander 2023-01-29 09:54:01 +01:00
parent ad196d1dba
commit a8dc08a219
No known key found for this signature in database
GPG key ID: 50E0D2423696F995

View file

@ -292,6 +292,19 @@ class webpush extends messenger_base
$this->db->sql_query($sql); $this->db->sql_query($sql);
} }
/**
* {@inheritDoc}
*/
public function prune_notifications($timestamp, $only_read = true): void
{
$sql = 'DELETE FROM ' . $this->notification_webpush_table . '
WHERE notification_time < ' . (int) $timestamp .
(($only_read) ? ' AND notification_read = 1' : '');
$this->db->sql_query($sql);
$this->config->set('read_notification_last_gc', (string) time(), false);
}
/** /**
* Clean data to contain only what we need for webpush notifications table * Clean data to contain only what we need for webpush notifications table
* *