mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-04 15:57:45 +02:00
[ticket/11103] Prune notifications function
To delete all notifications before a certain time PHPBB3-11103
This commit is contained in:
@@ -713,7 +713,7 @@ class phpbb_notification_manager
|
|||||||
* is disabled so that all those notifications are hidden and do not
|
* is disabled so that all those notifications are hidden and do not
|
||||||
* cause errors
|
* cause errors
|
||||||
*
|
*
|
||||||
* @param string $item_type
|
* @param string $item_type Type identifier of the subscription
|
||||||
*/
|
*/
|
||||||
public function disable_notifications($item_type)
|
public function disable_notifications($item_type)
|
||||||
{
|
{
|
||||||
@@ -729,7 +729,7 @@ class phpbb_notification_manager
|
|||||||
* This should be called when an extension which has notification types
|
* This should be called when an extension which has notification types
|
||||||
* is purged so that all those notifications are removed
|
* is purged so that all those notifications are removed
|
||||||
*
|
*
|
||||||
* @param string $item_type
|
* @param string $item_type Type identifier of the subscription
|
||||||
*/
|
*/
|
||||||
public function purge_notifications($item_type)
|
public function purge_notifications($item_type)
|
||||||
{
|
{
|
||||||
@@ -745,7 +745,7 @@ class phpbb_notification_manager
|
|||||||
* that was disabled is re-enabled so that all those notifications that
|
* that was disabled is re-enabled so that all those notifications that
|
||||||
* were hidden are shown again
|
* were hidden are shown again
|
||||||
*
|
*
|
||||||
* @param string $item_type
|
* @param string $item_type Type identifier of the subscription
|
||||||
*/
|
*/
|
||||||
public function enable_notifications($item_type)
|
public function enable_notifications($item_type)
|
||||||
{
|
{
|
||||||
@@ -755,6 +755,18 @@ class phpbb_notification_manager
|
|||||||
$this->db->sql_query($sql);
|
$this->db->sql_query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete all notifications older than a certain time
|
||||||
|
*
|
||||||
|
* @param int $timestamp Unix timestamp to delete all notifications that were created before
|
||||||
|
*/
|
||||||
|
public function prune_notifications($timestamp)
|
||||||
|
{
|
||||||
|
$sql = 'DELETE FROM ' . $this->notifications_table . '
|
||||||
|
WHERE time < ' . (int) $timestamp;
|
||||||
|
$this->db->sql_query($sql);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper to get the notifications item type class and set it up
|
* Helper to get the notifications item type class and set it up
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user