From 9f1493ce732cb57588bb3756419375c53d0ac518 Mon Sep 17 00:00:00 2001 From: omniError Date: Thu, 11 Dec 2014 16:58:29 -0600 Subject: [PATCH 1/2] [ticket/13430] Add event core.prune_sql https://tracker.phpbb.com/browse/PHPBB3-13430 PHPBB3-13430 --- phpBB/includes/functions_admin.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 0b9ea23fe7..52d8ffbcf9 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -2311,7 +2311,7 @@ function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, */ function prune($forum_id, $prune_mode, $prune_date, $prune_flags = 0, $auto_sync = true) { - global $db; + global $db, $phpbb_dispatcher; if (!is_array($forum_id)) { @@ -2351,6 +2351,21 @@ function prune($forum_id, $prune_mode, $prune_date, $prune_flags = 0, $auto_sync $sql_and .= ' AND topic_status = ' . ITEM_MOVED . " AND topic_last_post_time < $prune_date"; } + /** + * Use this event to modify the SQL that selects topics to be pruned + * + * @event core.prune_sql + * @var string forum_id The forum id + * @var string prune_mode The prune mode + * @var string prune_date The prune date + * @var int prune_flags The prune flags + * @var bool auto_sync Whether or not to perform auto sync + * @var string sql_and SQL text appended to where clause + * @since 3.1.3 + */ + $vars = array('forum_id', 'prune_mode', 'prune_date', 'prune_flags', 'auto_sync', 'sql_and'); + extract($phpbb_dispatcher->trigger_event('core.prune_sql', compact($vars))); + $sql = 'SELECT topic_id FROM ' . TOPICS_TABLE . ' WHERE ' . $db->sql_in_set('forum_id', $forum_id) . " From 7b0cabc4165085dc96efd6b0d8b5fe9d10a0c70d Mon Sep 17 00:00:00 2001 From: omniError Date: Fri, 12 Dec 2014 17:39:30 -0600 Subject: [PATCH 2/2] [ticket/13430] update event version https://tracker.phpbb.com/browse/PHPBB3-13430 PHPBB3-13430 --- phpBB/includes/functions_admin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 52d8ffbcf9..b016659541 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -2361,7 +2361,7 @@ function prune($forum_id, $prune_mode, $prune_date, $prune_flags = 0, $auto_sync * @var int prune_flags The prune flags * @var bool auto_sync Whether or not to perform auto sync * @var string sql_and SQL text appended to where clause - * @since 3.1.3 + * @since 3.1.3-RC1 */ $vars = array('forum_id', 'prune_mode', 'prune_date', 'prune_flags', 'auto_sync', 'sql_and'); extract($phpbb_dispatcher->trigger_event('core.prune_sql', compact($vars)));