aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
authorNathan Guse <nathaniel.guse@gmail.com>2012-12-15 18:35:17 -0600
committerNathan Guse <nathaniel.guse@gmail.com>2012-12-15 18:35:17 -0600
commitc6f138ff12f015543f92d07fb5c93c083a246bab (patch)
treeca4057f37ddc53e8f3253c109704e9f3d77ef762 /phpBB
parentc9ca7051491143e3c0da43663e85b60e18c6740e (diff)
downloadforums-c6f138ff12f015543f92d07fb5c93c083a246bab.tar
forums-c6f138ff12f015543f92d07fb5c93c083a246bab.tar.gz
forums-c6f138ff12f015543f92d07fb5c93c083a246bab.tar.bz2
forums-c6f138ff12f015543f92d07fb5c93c083a246bab.tar.xz
forums-c6f138ff12f015543f92d07fb5c93c083a246bab.zip
[ticket/11103] Prune notifications function
To delete all notifications before a certain time PHPBB3-11103
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/includes/notification/manager.php18
1 files changed, 15 insertions, 3 deletions
diff --git a/phpBB/includes/notification/manager.php b/phpBB/includes/notification/manager.php
index 90916401c0..a5e1b09754 100644
--- a/phpBB/includes/notification/manager.php
+++ b/phpBB/includes/notification/manager.php
@@ -713,7 +713,7 @@ class phpbb_notification_manager
* is disabled so that all those notifications are hidden and do not
* cause errors
*
- * @param string $item_type
+ * @param string $item_type Type identifier of the subscription
*/
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
* 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)
{
@@ -745,7 +745,7 @@ class phpbb_notification_manager
* that was disabled is re-enabled so that all those notifications that
* were hidden are shown again
*
- * @param string $item_type
+ * @param string $item_type Type identifier of the subscription
*/
public function enable_notifications($item_type)
{
@@ -756,6 +756,18 @@ 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
+ */
+ 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
*/
public function get_item_type_class($item_type, $data = array())