diff --git a/phpBB/phpbb/db/migration/data/v310/alpha1.php b/phpBB/phpbb/db/migration/data/v310/alpha1.php index 04f195daeb..bd4861b1f5 100644 --- a/phpBB/phpbb/db/migration/data/v310/alpha1.php +++ b/phpBB/phpbb/db/migration/data/v310/alpha1.php @@ -24,6 +24,7 @@ class alpha1 extends \phpbb\db\migration\migration '\phpbb\db\migration\data\v310\config_db_text', '\phpbb\db\migration\data\v310\forgot_password', '\phpbb\db\migration\data\v310\mod_rewrite', + '\phpbb\db\migration\data\v310\mysql_fulltext_drop', '\phpbb\db\migration\data\v310\namespaces', '\phpbb\db\migration\data\v310\notifications_cron', '\phpbb\db\migration\data\v310\notification_options_reconvert', diff --git a/phpBB/phpbb/db/migration/data/v310/mysql_fulltext_drop.php b/phpBB/phpbb/db/migration/data/v310/mysql_fulltext_drop.php new file mode 100644 index 0000000000..97d174d4bc --- /dev/null +++ b/phpBB/phpbb/db/migration/data/v310/mysql_fulltext_drop.php @@ -0,0 +1,47 @@ +db->sql_layer, 'mysql') === false; + } + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v310\dev', + ); + } + + public function update_schema() + { + /* + * Drop FULLTEXT indexes related to MySQL fulltext search. + * Doing so is equivalent to dropping the search index from the ACP. + * Possibly time-consuming recreation of the search index (i.e. + * FULLTEXT indexes) is left as a task to the admin to not + * unnecessarily stall the upgrade process. The new search index will + * then require about 40% less table space (also see PHPBB3-11621). + */ + return array( + 'drop_keys' => array( + $this->table_prefix . 'posts' => array( + 'post_subject', + 'post_text', + 'post_content', + ), + ), + ); + } +} diff --git a/phpBB/phpbb/search/fulltext_mysql.php b/phpBB/phpbb/search/fulltext_mysql.php index 50d2d2577f..ca2f42358f 100644 --- a/phpBB/phpbb/search/fulltext_mysql.php +++ b/phpBB/phpbb/search/fulltext_mysql.php @@ -781,7 +781,7 @@ class 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', '>=')) { @@ -791,12 +791,8 @@ class 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)'; + $alter[] = 'ADD FULLTEXT post_content (post_text, post_subject)'; } if (sizeof($alter)) @@ -834,11 +830,6 @@ class 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'; @@ -864,7 +855,7 @@ class 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']); } /** @@ -904,11 +895,7 @@ class 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; }