aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes
diff options
context:
space:
mode:
authorMarc Alexander <admin@m-a-styles.de>2019-10-21 17:51:23 +0200
committerMarc Alexander <admin@m-a-styles.de>2019-10-21 17:51:23 +0200
commitfa18778c913dc1fafc6baaadf42def2bab4dc248 (patch)
tree131c02a77a4c307c86fc5f0d70e19a30690b538c /phpBB/includes
parent6e757eea94b93cacf4db195e4c90b0ceffc43563 (diff)
parent6df8b7f3678ba242480a0c50b651b1653a0d2d6b (diff)
downloadforums-fa18778c913dc1fafc6baaadf42def2bab4dc248.tar
forums-fa18778c913dc1fafc6baaadf42def2bab4dc248.tar.gz
forums-fa18778c913dc1fafc6baaadf42def2bab4dc248.tar.bz2
forums-fa18778c913dc1fafc6baaadf42def2bab4dc248.tar.xz
forums-fa18778c913dc1fafc6baaadf42def2bab4dc248.zip
Merge pull request #5711 from kasimi/ticket/16183
[ticket/16183] Add core.generate_smilies_count_sql_before
Diffstat (limited to 'phpBB/includes')
-rw-r--r--phpBB/includes/functions_posting.php26
1 files changed, 23 insertions, 3 deletions
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index ed4b573cc2..1956f65666 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -52,9 +52,29 @@ function generate_smilies($mode, $forum_id)
page_header($user->lang['SMILIES']);
- $sql = 'SELECT COUNT(smiley_id) AS item_count
- FROM ' . SMILIES_TABLE . '
- GROUP BY smiley_url';
+ $sql_ary = [
+ 'SELECT' => 'COUNT(s.smiley_id) AS item_count',
+ 'FROM' => [
+ SMILIES_TABLE => 's',
+ ],
+ 'GROUP_BY' => 's.smiley_url',
+ ];
+
+ /**
+ * Modify SQL query that fetches the total number of smilies in window mode
+ *
+ * @event core.generate_smilies_count_sql_before
+ * @var int forum_id Forum where smilies are generated
+ * @var array sql_ary Array with the SQL query
+ * @since 3.2.9-RC1
+ */
+ $vars = [
+ 'forum_id',
+ 'sql_ary',
+ ];
+ extract($phpbb_dispatcher->trigger_event('core.generate_smilies_count_sql_before', compact($vars)));
+
+ $sql = $db->sql_build_query('SELECT', $sql_ary);
$result = $db->sql_query($sql, 3600);
$smiley_count = 0;