From 0228424983e35badc779923a1f0398fc3ab7c8b2 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Mon, 26 Aug 2013 15:16:56 +0530 Subject: [ticket/11621] Remove mysql extra indexes Remove post_text index as post_content index is sufficient to search post text. PHPBB3-11621 --- phpBB/phpbb/search/fulltext_mysql.php | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) (limited to 'phpBB/phpbb/search') diff --git a/phpBB/phpbb/search/fulltext_mysql.php b/phpBB/phpbb/search/fulltext_mysql.php index a1e1b089b9..eed962b833 100644 --- a/phpBB/phpbb/search/fulltext_mysql.php +++ b/phpBB/phpbb/search/fulltext_mysql.php @@ -779,7 +779,7 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base $alter[] = 'ADD FULLTEXT (post_subject)'; } - if (!isset($this->stats['post_text'])) + if (!isset($this->stats['post_content'])) { if ($this->db->sql_layer == 'mysqli' || version_compare($this->db->sql_server_info(true), '4.1.3', '>=')) { @@ -789,11 +789,7 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base { $alter[] = 'MODIFY post_text mediumtext NOT NULL'; } - $alter[] = 'ADD FULLTEXT (post_text)'; - } - if (!isset($this->stats['post_content'])) - { $alter[] = 'ADD FULLTEXT post_content (post_subject, post_text)'; } @@ -832,11 +828,6 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base $alter[] = 'DROP INDEX post_subject'; } - if (isset($this->stats['post_text'])) - { - $alter[] = 'DROP INDEX post_text'; - } - if (isset($this->stats['post_content'])) { $alter[] = 'DROP INDEX post_content'; @@ -862,7 +853,7 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base $this->get_stats(); } - return (isset($this->stats['post_text']) && isset($this->stats['post_subject']) && isset($this->stats['post_content'])) ? true : false; + return (isset($this->stats['post_subject']) && isset($this->stats['post_content'])) ? true : false; } /** @@ -902,11 +893,7 @@ class phpbb_search_fulltext_mysql extends phpbb_search_base if ($index_type == 'FULLTEXT') { - if ($row['Key_name'] == 'post_text') - { - $this->stats['post_text'] = $row; - } - else if ($row['Key_name'] == 'post_subject') + if ($row['Key_name'] == 'post_subject') { $this->stats['post_subject'] = $row; } -- cgit v1.2.1 From 79928ebf432d03f5ec3a55a34468ea089586a568 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 10 Oct 2013 23:59:05 +0200 Subject: [ticket/11621] Swap columns of post_content index. PHPBB3-11621 --- phpBB/phpbb/search/fulltext_mysql.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/search') diff --git a/phpBB/phpbb/search/fulltext_mysql.php b/phpBB/phpbb/search/fulltext_mysql.php index 23f27e65d0..260b07fdf9 100644 --- a/phpBB/phpbb/search/fulltext_mysql.php +++ b/phpBB/phpbb/search/fulltext_mysql.php @@ -792,7 +792,7 @@ class fulltext_mysql extends \phpbb\search\base $alter[] = 'MODIFY post_text mediumtext NOT NULL'; } - $alter[] = 'ADD FULLTEXT post_content (post_subject, post_text)'; + $alter[] = 'ADD FULLTEXT post_content (post_text, post_subject)'; } if (sizeof($alter)) -- cgit v1.2.1 From 6e9e07bae2d3b6aefc9292c9447e039e6f713166 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 11 Oct 2013 00:14:50 +0200 Subject: [ticket/11621] Remove unnecessary things around index_created() return value. PHPBB3-11621 --- phpBB/phpbb/search/fulltext_mysql.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/search') diff --git a/phpBB/phpbb/search/fulltext_mysql.php b/phpBB/phpbb/search/fulltext_mysql.php index 260b07fdf9..ca2f42358f 100644 --- a/phpBB/phpbb/search/fulltext_mysql.php +++ b/phpBB/phpbb/search/fulltext_mysql.php @@ -855,7 +855,7 @@ class fulltext_mysql extends \phpbb\search\base $this->get_stats(); } - return (isset($this->stats['post_subject']) && isset($this->stats['post_content'])) ? true : false; + return isset($this->stats['post_subject']) && isset($this->stats['post_content']); } /** -- cgit v1.2.1 From 7f58a4572eaca75aecff2da889e67ea151616011 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Mon, 28 Oct 2013 22:27:25 +0100 Subject: [ticket/11981] Fix code sniffer complaints PHPBB3-11981 --- phpBB/phpbb/search/fulltext_native.php | 1 - 1 file changed, 1 deletion(-) (limited to 'phpBB/phpbb/search') diff --git a/phpBB/phpbb/search/fulltext_native.php b/phpBB/phpbb/search/fulltext_native.php index 33326f2882..024b8f441b 100644 --- a/phpBB/phpbb/search/fulltext_native.php +++ b/phpBB/phpbb/search/fulltext_native.php @@ -850,7 +850,6 @@ class fulltext_native extends \phpbb\search\base } $this->db->sql_freeresult($result); - // if we use mysql and the total result count is not cached yet, retrieve it from the db if (!$total_results && $is_mysql) { -- cgit v1.2.1 From 7aa8f6461f1e85cf91931f56b95384e54fec07c2 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Wed, 30 Oct 2013 13:05:28 +0100 Subject: [task/code-sniffer] Remove the IN_PHPBB check side-effect from class files. PHPBB3-11980 --- phpBB/phpbb/search/base.php | 8 -------- phpBB/phpbb/search/fulltext_mysql.php | 8 -------- phpBB/phpbb/search/fulltext_native.php | 8 -------- phpBB/phpbb/search/fulltext_postgres.php | 8 -------- phpBB/phpbb/search/fulltext_sphinx.php | 10 ---------- phpBB/phpbb/search/sphinx/config.php | 8 -------- phpBB/phpbb/search/sphinx/config_comment.php | 8 -------- phpBB/phpbb/search/sphinx/config_section.php | 8 -------- phpBB/phpbb/search/sphinx/config_variable.php | 8 -------- 9 files changed, 74 deletions(-) (limited to 'phpBB/phpbb/search') diff --git a/phpBB/phpbb/search/base.php b/phpBB/phpbb/search/base.php index f2f982c31b..9ecf3751d0 100644 --- a/phpBB/phpbb/search/base.php +++ b/phpBB/phpbb/search/base.php @@ -9,14 +9,6 @@ namespace phpbb\search; -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - /** * @ignore */ diff --git a/phpBB/phpbb/search/fulltext_mysql.php b/phpBB/phpbb/search/fulltext_mysql.php index ca2f42358f..cdd2da222f 100644 --- a/phpBB/phpbb/search/fulltext_mysql.php +++ b/phpBB/phpbb/search/fulltext_mysql.php @@ -9,14 +9,6 @@ namespace phpbb\search; -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - /** * fulltext_mysql * Fulltext search for MySQL diff --git a/phpBB/phpbb/search/fulltext_native.php b/phpBB/phpbb/search/fulltext_native.php index 024b8f441b..f3bb94a0c5 100644 --- a/phpBB/phpbb/search/fulltext_native.php +++ b/phpBB/phpbb/search/fulltext_native.php @@ -9,14 +9,6 @@ namespace phpbb\search; -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - /** * fulltext_native * phpBB's own db driven fulltext search, version 2 diff --git a/phpBB/phpbb/search/fulltext_postgres.php b/phpBB/phpbb/search/fulltext_postgres.php index 756034103e..063bf52a19 100644 --- a/phpBB/phpbb/search/fulltext_postgres.php +++ b/phpBB/phpbb/search/fulltext_postgres.php @@ -9,14 +9,6 @@ namespace phpbb\search; -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - /** * fulltext_postgres * Fulltext search for PostgreSQL diff --git a/phpBB/phpbb/search/fulltext_sphinx.php b/phpBB/phpbb/search/fulltext_sphinx.php index cb76d58f49..acbfad9474 100644 --- a/phpBB/phpbb/search/fulltext_sphinx.php +++ b/phpBB/phpbb/search/fulltext_sphinx.php @@ -9,16 +9,6 @@ namespace phpbb\search; -/** -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - -/** -* @ignore -*/ define('SPHINX_MAX_MATCHES', 20000); define('SPHINX_CONNECT_RETRIES', 3); define('SPHINX_CONNECT_WAIT_TIME', 300); diff --git a/phpBB/phpbb/search/sphinx/config.php b/phpBB/phpbb/search/sphinx/config.php index 262d6008cc..cb8e4524df 100644 --- a/phpBB/phpbb/search/sphinx/config.php +++ b/phpBB/phpbb/search/sphinx/config.php @@ -9,14 +9,6 @@ namespace phpbb\search\sphinx; -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - /** * \phpbb\search\sphinx\config * An object representing the sphinx configuration diff --git a/phpBB/phpbb/search/sphinx/config_comment.php b/phpBB/phpbb/search/sphinx/config_comment.php index 77a943377d..20b1c19af1 100644 --- a/phpBB/phpbb/search/sphinx/config_comment.php +++ b/phpBB/phpbb/search/sphinx/config_comment.php @@ -9,14 +9,6 @@ namespace phpbb\search\sphinx; -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - /** * \phpbb\search\sphinx\config_comment * Represents a comment inside the sphinx configuration diff --git a/phpBB/phpbb/search/sphinx/config_section.php b/phpBB/phpbb/search/sphinx/config_section.php index 730abf011e..8f9253ec56 100644 --- a/phpBB/phpbb/search/sphinx/config_section.php +++ b/phpBB/phpbb/search/sphinx/config_section.php @@ -9,14 +9,6 @@ namespace phpbb\search\sphinx; -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - /** * \phpbb\search\sphinx\config_section * Represents a single section inside the sphinx configuration diff --git a/phpBB/phpbb/search/sphinx/config_variable.php b/phpBB/phpbb/search/sphinx/config_variable.php index c8f40bfb5f..c0f6d28dcc 100644 --- a/phpBB/phpbb/search/sphinx/config_variable.php +++ b/phpBB/phpbb/search/sphinx/config_variable.php @@ -9,14 +9,6 @@ namespace phpbb\search\sphinx; -/** -* @ignore -*/ -if (!defined('IN_PHPBB')) -{ - exit; -} - /** * \phpbb\search\sphinx\config_variable * Represents a single variable inside the sphinx configuration -- cgit v1.2.1 From ef1f99183796f8e246f96bca54ca439bf8ea1750 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Wed, 30 Oct 2013 13:37:29 +0100 Subject: [task/code-sniffer] Replace spaces with tabs. PHPBB3-11980 --- phpBB/phpbb/search/fulltext_native.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'phpBB/phpbb/search') diff --git a/phpBB/phpbb/search/fulltext_native.php b/phpBB/phpbb/search/fulltext_native.php index f3bb94a0c5..1b314a24d3 100644 --- a/phpBB/phpbb/search/fulltext_native.php +++ b/phpBB/phpbb/search/fulltext_native.php @@ -1180,8 +1180,8 @@ class fulltext_native extends \phpbb\search\base * we know that it will also be lower than CJK ranges */ if ((strncmp($word, UTF8_HANGUL_FIRST, 3) < 0 || strncmp($word, UTF8_HANGUL_LAST, 3) > 0) - && (strncmp($word, UTF8_CJK_FIRST, 3) < 0 || strncmp($word, UTF8_CJK_LAST, 3) > 0) - && (strncmp($word, UTF8_CJK_B_FIRST, 4) < 0 || strncmp($word, UTF8_CJK_B_LAST, 4) > 0)) + && (strncmp($word, UTF8_CJK_FIRST, 3) < 0 || strncmp($word, UTF8_CJK_LAST, 3) > 0) + && (strncmp($word, UTF8_CJK_B_FIRST, 4) < 0 || strncmp($word, UTF8_CJK_B_LAST, 4) > 0)) { $word = strtok(' '); continue; @@ -1675,8 +1675,8 @@ class fulltext_native extends \phpbb\search\base $pos += $utf_len; if (($utf_char >= UTF8_HANGUL_FIRST && $utf_char <= UTF8_HANGUL_LAST) - || ($utf_char >= UTF8_CJK_FIRST && $utf_char <= UTF8_CJK_LAST) - || ($utf_char >= UTF8_CJK_B_FIRST && $utf_char <= UTF8_CJK_B_LAST)) + || ($utf_char >= UTF8_CJK_FIRST && $utf_char <= UTF8_CJK_LAST) + || ($utf_char >= UTF8_CJK_B_FIRST && $utf_char <= UTF8_CJK_B_LAST)) { /** * All characters within these ranges are valid -- cgit v1.2.1