From 12e46e48c80191d0e4ee134257375ea40c13da60 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Sun, 9 Sep 2012 17:43:10 -0500 Subject: [ticket/11103] Remove notifications to posts/topics when they are deleted PHPBB3-11103 --- phpBB/includes/functions_admin.php | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'phpBB/includes/functions_admin.php') diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 5e2ee8c8f6..6845ae14e3 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -619,6 +619,7 @@ function move_posts($post_ids, $topic_id, $auto_sync = true) function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_sync = true, $call_delete_posts = true) { global $db, $config; + global $phpbb_container; $approved_topics = 0; $forum_ids = $topic_ids = array(); @@ -715,6 +716,10 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s set_config_count('num_topics', $approved_topics * (-1), true); } + // Delete notifications + $notifications = $phpbb_container->get('notifications'); + $notifications->delete_notifications('topic', $topic_ids); + return $return; } @@ -724,6 +729,7 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = true, $post_count_sync = true, $call_delete_topics = true) { global $db, $config, $phpbb_root_path, $phpEx, $auth, $user; + global $phpbb_container; if ($where_type === 'range') { @@ -892,6 +898,10 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = delete_topics('topic_id', $remove_topics, $auto_sync, $post_count_sync, false); } + // Delete notifications + $notifications = $phpbb_container->get('notifications'); + $notifications->delete_notifications('post', $post_ids); + return sizeof($post_ids); } -- cgit v1.2.1 From 8e977544fb6763412e45f84791de8c3eccf321c9 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Fri, 14 Sep 2012 17:01:08 -0500 Subject: [ticket/11103] Normalization of $phpbb_notifications variable name Use $phpbb_notifications instead of $notifications everywhere for consistency and conflict prevention. PHPBB3-11103 --- phpBB/includes/functions_admin.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'phpBB/includes/functions_admin.php') diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 6845ae14e3..1cbd44e97e 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -717,8 +717,8 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s } // Delete notifications - $notifications = $phpbb_container->get('notifications'); - $notifications->delete_notifications('topic', $topic_ids); + $phpbb_notifications = $phpbb_container->get('notifications'); + $phpbb_notifications->delete_notifications('topic', $topic_ids); return $return; } @@ -899,8 +899,8 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = } // Delete notifications - $notifications = $phpbb_container->get('notifications'); - $notifications->delete_notifications('post', $post_ids); + $phpbb_notifications = $phpbb_container->get('notifications'); + $phpbb_notifications->delete_notifications('post', $post_ids); return sizeof($post_ids); } -- cgit v1.2.1 From a4ec7e2aea8a47fff9d7effa76a3d07a2dd6a305 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Sat, 15 Sep 2012 14:50:05 -0500 Subject: [ticket/11103] Delete some notifications when deleting posts/topics PHPBB3-11103 --- phpBB/includes/functions_admin.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/functions_admin.php') diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 1cbd44e97e..55e539cb37 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -718,7 +718,7 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s // Delete notifications $phpbb_notifications = $phpbb_container->get('notifications'); - $phpbb_notifications->delete_notifications('topic', $topic_ids); + $phpbb_notifications->delete_notifications(array('topic', 'approve_topic', 'topic_in_queue')), $topic_ids); return $return; } @@ -900,7 +900,7 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = // Delete notifications $phpbb_notifications = $phpbb_container->get('notifications'); - $phpbb_notifications->delete_notifications('post', $post_ids); + $phpbb_notifications->delete_notifications(array('quote', 'bookmark', 'post', 'approve_post', 'post_in_queue'), $post_ids); return sizeof($post_ids); } -- cgit v1.2.1 From 661dd09d6f44b46e5a30b37bb3425058f055ea01 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Sun, 16 Sep 2012 23:03:00 -0500 Subject: [ticket/11103] Bug fix PHPBB3-11103 --- phpBB/includes/functions_admin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/functions_admin.php') diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 55e539cb37..27128aafac 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -718,7 +718,7 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s // Delete notifications $phpbb_notifications = $phpbb_container->get('notifications'); - $phpbb_notifications->delete_notifications(array('topic', 'approve_topic', 'topic_in_queue')), $topic_ids); + $phpbb_notifications->delete_notifications(array('topic', 'approve_topic', 'topic_in_queue'), $topic_ids); return $return; } -- cgit v1.2.1 From b9bc65eed88bbd2dff12102909903cbf4dc9b368 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Thu, 4 Oct 2012 14:47:13 -0500 Subject: [ticket/11103] Make $phpbb_notifications a global and use it everywhere Do not use phpbb_container everywhere (makes testing difficult) PHPBB3-11103 --- phpBB/includes/functions_admin.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'phpBB/includes/functions_admin.php') diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 27128aafac..3deb2e9c59 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -619,7 +619,7 @@ function move_posts($post_ids, $topic_id, $auto_sync = true) function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_sync = true, $call_delete_posts = true) { global $db, $config; - global $phpbb_container; + global $phpbb_notifications; $approved_topics = 0; $forum_ids = $topic_ids = array(); @@ -717,7 +717,6 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s } // Delete notifications - $phpbb_notifications = $phpbb_container->get('notifications'); $phpbb_notifications->delete_notifications(array('topic', 'approve_topic', 'topic_in_queue'), $topic_ids); return $return; @@ -729,7 +728,7 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = true, $post_count_sync = true, $call_delete_topics = true) { global $db, $config, $phpbb_root_path, $phpEx, $auth, $user; - global $phpbb_container; + global $phpbb_notifications; if ($where_type === 'range') { @@ -899,7 +898,6 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = } // Delete notifications - $phpbb_notifications = $phpbb_container->get('notifications'); $phpbb_notifications->delete_notifications(array('quote', 'bookmark', 'post', 'approve_post', 'post_in_queue'), $post_ids); return sizeof($post_ids); -- cgit v1.2.1 From ae670cc87df197e44b768667b853e1dae3009b4d Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Thu, 18 Oct 2012 18:32:13 -0500 Subject: [ticket/11103] Remove unnecessary comments Comments that are not needed because the actions are completely self-explanatory PHPBB3-11103 --- phpBB/includes/functions_admin.php | 2 -- 1 file changed, 2 deletions(-) (limited to 'phpBB/includes/functions_admin.php') diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 3deb2e9c59..893c7a247d 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -716,7 +716,6 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s set_config_count('num_topics', $approved_topics * (-1), true); } - // Delete notifications $phpbb_notifications->delete_notifications(array('topic', 'approve_topic', 'topic_in_queue'), $topic_ids); return $return; @@ -897,7 +896,6 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = delete_topics('topic_id', $remove_topics, $auto_sync, $post_count_sync, false); } - // Delete notifications $phpbb_notifications->delete_notifications(array('quote', 'bookmark', 'post', 'approve_post', 'post_in_queue'), $post_ids); return sizeof($post_ids); -- cgit v1.2.1 From 94d682f77431add84867bb0b196ad0719b293606 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Sat, 20 Oct 2012 20:54:18 -0500 Subject: [ticket/11103] Use the full class name as the item_type/method This is going to require you recreate the db tables. PHPBB3-11103 --- phpBB/includes/functions_admin.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/functions_admin.php') diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 893c7a247d..fdae1905a0 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -716,7 +716,11 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s set_config_count('num_topics', $approved_topics * (-1), true); } - $phpbb_notifications->delete_notifications(array('topic', 'approve_topic', 'topic_in_queue'), $topic_ids); + $phpbb_notifications->delete_notifications(array( + 'phpbb_notification_type_topic', + 'phpbb_notification_type_approve_topic', + 'phpbb_notification_type_topic_in_queue', + ), $topic_ids); return $return; } @@ -896,7 +900,13 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = delete_topics('topic_id', $remove_topics, $auto_sync, $post_count_sync, false); } - $phpbb_notifications->delete_notifications(array('quote', 'bookmark', 'post', 'approve_post', 'post_in_queue'), $post_ids); + $phpbb_notifications->delete_notifications(array( + 'phpbb_notification_type_quote', + 'phpbb_notification_type_bookmark', + 'phpbb_notification_type_post', + 'phpbb_notification_type_approve_post', + 'phpbb_notification_type_post_in_queue', + ), $post_ids); return sizeof($post_ids); } -- cgit v1.2.1 From 2afb8b9df873c3f9572a32ab7a62ea8ba8d8a45b Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Tue, 20 Nov 2012 18:14:48 -0600 Subject: [ticket/11103] Create user loader class, update for DIC Create a very basic user loader class to handle querying/storing user data in a centralized location. Use DIC collection service for notification types/methods. Cleanup unused dependencies. Fix some other issues. PHPBB3-11103 --- phpBB/includes/functions_admin.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'phpBB/includes/functions_admin.php') diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index fdae1905a0..e15bf12279 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -717,9 +717,9 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s } $phpbb_notifications->delete_notifications(array( - 'phpbb_notification_type_topic', - 'phpbb_notification_type_approve_topic', - 'phpbb_notification_type_topic_in_queue', + 'topic', + 'approve_topic', + 'topic_in_queue', ), $topic_ids); return $return; @@ -901,11 +901,11 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = } $phpbb_notifications->delete_notifications(array( - 'phpbb_notification_type_quote', - 'phpbb_notification_type_bookmark', - 'phpbb_notification_type_post', - 'phpbb_notification_type_approve_post', - 'phpbb_notification_type_post_in_queue', + 'quote', + 'bookmark', + 'post', + 'approve_post', + 'post_in_queue', ), $post_ids); return sizeof($post_ids); -- cgit v1.2.1 From 249f3c8885d461ae3981dfd7b62093c2175175e3 Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Thu, 13 Dec 2012 19:19:40 -0600 Subject: [ticket/11103] Instantiate $phpbb_notifications as needed https://github.com/phpbb/phpbb3/pull/992#discussion_r2413976 PHPBB3-11103 --- phpBB/includes/functions_admin.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'phpBB/includes/functions_admin.php') diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 69ca44861f..9310b218fb 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -618,8 +618,7 @@ function move_posts($post_ids, $topic_id, $auto_sync = true) */ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_sync = true, $call_delete_posts = true) { - global $db, $config; - global $phpbb_notifications; + global $db, $config, $phpbb_container; $approved_topics = 0; $forum_ids = $topic_ids = array(); @@ -716,6 +715,8 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s set_config_count('num_topics', $approved_topics * (-1), true); } + $phpbb_notifications = $phpbb_container->get('notification_manager'); + $phpbb_notifications->delete_notifications(array( 'topic', 'approve_topic', @@ -730,8 +731,7 @@ function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_s */ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = true, $post_count_sync = true, $call_delete_topics = true) { - global $db, $config, $phpbb_root_path, $phpEx, $auth, $user; - global $phpbb_notifications; + global $db, $config, $phpbb_root_path, $phpEx, $auth, $user, $phpbb_container; if ($where_type === 'range') { @@ -900,6 +900,8 @@ function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = delete_topics('topic_id', $remove_topics, $auto_sync, $post_count_sync, false); } + $phpbb_notifications = $phpbb_container->get('notification_manager'); + $phpbb_notifications->delete_notifications(array( 'quote', 'bookmark', -- cgit v1.2.1