aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/notification/manager.php
diff options
context:
space:
mode:
authorTristan Darricau <github@nicofuma.fr>2014-05-14 02:06:48 +0200
committerTristan Darricau <github@nicofuma.fr>2014-05-14 02:09:41 +0200
commitcb97c26e884ba7c78afad01e6c05d32b9df6fde5 (patch)
tree1bd69677de409ef9a4447b5c50d12ac182874e53 /phpBB/phpbb/notification/manager.php
parentbec9b7c34e63c7485477fa1edc2f6330889cc699 (diff)
downloadforums-cb97c26e884ba7c78afad01e6c05d32b9df6fde5.tar
forums-cb97c26e884ba7c78afad01e6c05d32b9df6fde5.tar.gz
forums-cb97c26e884ba7c78afad01e6c05d32b9df6fde5.tar.bz2
forums-cb97c26e884ba7c78afad01e6c05d32b9df6fde5.tar.xz
forums-cb97c26e884ba7c78afad01e6c05d32b9df6fde5.zip
[ticket/12435] purge_notifications() fails for unused notifications
https://tracker.phpbb.com/browse/PHPBB3-12435 PHPBB3-12435
Diffstat (limited to 'phpBB/phpbb/notification/manager.php')
-rw-r--r--phpBB/phpbb/notification/manager.php27
1 files changed, 19 insertions, 8 deletions
diff --git a/phpBB/phpbb/notification/manager.php b/phpBB/phpbb/notification/manager.php
index 09d9677ccd..33f0ae986e 100644
--- a/phpBB/phpbb/notification/manager.php
+++ b/phpBB/phpbb/notification/manager.php
@@ -760,17 +760,28 @@ class manager
*/
public function purge_notifications($notification_type_name)
{
- $notification_type_id = $this->get_notification_type_id($notification_type_name);
+ // If the notification was never used, it was never put in the database and so its id was never cached.
+ // If this notification was added by an extension, this one will call purge_notification in the purge step,
+ // and get_notification_type_id() will throw an exception.
+ // The notification was never used, thus we can silently drop the exception.
+ try
+ {
+ $notification_type_id = $this->get_notification_type_id($notification_type_name);
- $sql = 'DELETE FROM ' . $this->notifications_table . '
- WHERE notification_type_id = ' . (int) $notification_type_id;
- $this->db->sql_query($sql);
+ $sql = 'DELETE FROM ' . $this->notifications_table . '
+ WHERE notification_type_id = ' . (int) $notification_type_id;
+ $this->db->sql_query($sql);
- $sql = 'DELETE FROM ' . $this->notification_types_table . '
- WHERE notification_type_id = ' . (int) $notification_type_id;
- $this->db->sql_query($sql);
+ $sql = 'DELETE FROM ' . $this->notification_types_table . '
+ WHERE notification_type_id = ' . (int) $notification_type_id;
+ $this->db->sql_query($sql);
- $this->cache->destroy('notification_type_ids');
+ $this->cache->destroy('notification_type_ids');
+ }
+ catch (\phpbb\notification\exception $e)
+ {
+ // Continue
+ }
}
/**