aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/search/fulltext_mysql.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/search/fulltext_mysql.php')
-rw-r--r--phpBB/includes/search/fulltext_mysql.php30
1 files changed, 26 insertions, 4 deletions
diff --git a/phpBB/includes/search/fulltext_mysql.php b/phpBB/includes/search/fulltext_mysql.php
index 598299e316..490b676906 100644
--- a/phpBB/includes/search/fulltext_mysql.php
+++ b/phpBB/includes/search/fulltext_mysql.php
@@ -639,14 +639,29 @@ class fulltext_mysql extends search_backend
$this->get_stats();
}
+ $alter = array();
+
if (!isset($this->stats['post_subject']))
{
- $db->sql_query('ALTER TABLE ' . POSTS_TABLE . ' ADD FULLTEXT (post_subject)');
+ if (version_compare($db->mysql_version, '4.1.3', '>='))
+ {
+ $alter[] = 'MODIFY post_subject varchar(100) COLLATE utf8_unicode_ci DEFAULT \'\' NOT NULL';
+ }
+ $alter[] = 'ADD FULLTEXT (post_subject)';
}
if (!isset($this->stats['post_text']))
{
- $db->sql_query('ALTER TABLE ' . POSTS_TABLE . ' ADD FULLTEXT (post_text)');
+ if (version_compare($db->mysql_version, '4.1.3', '>='))
+ {
+ $alter[] = 'MODIFY post_text mediumtext COLLATE utf8_unicode_ci NOT NULL';
+ }
+ $alter[] = 'ADD FULLTEXT (post_text)';
+ }
+
+ if (sizeof($alter))
+ {
+ $db->sql_query('ALTER TABLE ' . POSTS_TABLE . ' ' . implode(', ', $alter));
}
$db->sql_query('TRUNCATE TABLE ' . SEARCH_RESULTS_TABLE);
@@ -672,14 +687,21 @@ class fulltext_mysql extends search_backend
$this->get_stats();
}
+ $alter = array();
+
if (isset($this->stats['post_subject']))
{
- $db->sql_query('ALTER TABLE ' . POSTS_TABLE . ' DROP INDEX post_subject');
+ $alter[] = 'DROP INDEX post_subject';
}
if (isset($this->stats['post_text']))
{
- $db->sql_query('ALTER TABLE ' . POSTS_TABLE . ' DROP INDEX post_text');
+ $alter[] = 'DROP INDEX post_text';
+ }
+
+ if (sizeof($alter))
+ {
+ $db->sql_query('ALTER TABLE ' . POSTS_TABLE . ' ' . implode(', ', $alter));
}
$db->sql_query('TRUNCATE TABLE ' . SEARCH_RESULTS_TABLE);