phpBB

Code Changes

File: phpbb/search/fulltext_mysql.php

  Unmodified   Added   Modified   Removed
Line 173Line 173
			$engine = $info['Type'];
}


			$engine = $info['Type'];
}


		$fulltext_supported =
$engine === 'MyISAM' ||
// FULLTEXT is supported on InnoDB since MySQL 5.6.4 according to
// http://dev.mysql.com/doc/refman/5.6/en/innodb-storage-engine.html
// We also require https://bugs.mysql.com/bug.php?id=67004 to be
// fixed for proper overall operation. Hence we require 5.6.8.
$engine === 'InnoDB' &&
phpbb_version_compare($this->db->sql_server_info(true), '5.6.8', '>=');


		$fulltext_supported = $engine === 'Aria' || $engine === 'MyISAM'
/**
* FULLTEXT is supported on InnoDB since MySQL 5.6.4 according to
* http://dev.mysql.com/doc/refman/5.6/en/innodb-storage-engine.html
* We also require https://bugs.mysql.com/bug.php?id=67004 to be
* fixed for proper overall operation. Hence we require 5.6.8.
*/
|| $engine === 'InnoDB'
&& phpbb_version_compare($this->db->sql_server_info(true), '5.6.8', '>=');


if (!$fulltext_supported)
{


if (!$fulltext_supported)
{

Line 188Line 189
		}

$sql = 'SHOW VARIABLES

		}

$sql = 'SHOW VARIABLES

			LIKE \'ft\_%\'';

			LIKE \'%ft\_%\'';

		$result = $this->db->sql_query($sql);

$mysql_info = array();

		$result = $this->db->sql_query($sql);

$mysql_info = array();

Line 198Line 199
		}
$this->db->sql_freeresult($result);


		}
$this->db->sql_freeresult($result);


 
		if ($engine === 'MyISAM')
{

		$this->config->set('fulltext_mysql_max_word_len', $mysql_info['ft_max_word_len']);
$this->config->set('fulltext_mysql_min_word_len', $mysql_info['ft_min_word_len']);

		$this->config->set('fulltext_mysql_max_word_len', $mysql_info['ft_max_word_len']);
$this->config->set('fulltext_mysql_min_word_len', $mysql_info['ft_min_word_len']);

 
		}
else if ($engine === 'InnoDB')
{
$this->config->set('fulltext_mysql_max_word_len', $mysql_info['innodb_ft_max_token_size']);
$this->config->set('fulltext_mysql_min_word_len', $mysql_info['innodb_ft_min_token_size']);
}


return false;
}


return false;
}

Line 917Line 926
		$split_title = ($subject) ? $this->split_message($subject) : array();

$words = array_unique(array_merge($split_text, $split_title));

		$split_title = ($subject) ? $this->split_message($subject) : array();

$words = array_unique(array_merge($split_text, $split_title));

 

/**
* Event to modify method arguments and words before the MySQL search index is updated
*
* @event core.search_mysql_index_before
* @var string mode Contains the post mode: edit, post, reply, quote
* @var int post_id The id of the post which is modified/created
* @var string message New or updated post content
* @var string subject New or updated post subject
* @var int poster_id Post author's user id
* @var int forum_id The id of the forum in which the post is located
* @var array words List of words added to the index
* @var array split_text Array of words from the message
* @var array split_title Array of words from the title
* @since 3.2.3-RC1
*/
$vars = array(
'mode',
'post_id',
'message',
'subject',
'poster_id',
'forum_id',
'words',
'split_text',
'split_title',
);
extract($this->phpbb_dispatcher->trigger_event('core.search_mysql_index_before', compact($vars)));


unset($split_text);
unset($split_title);


unset($split_text);
unset($split_title);

Line 997Line 1034
			$alter_list[] = $alter_entry;
}


			$alter_list[] = $alter_entry;
}


		if (count($alter_list))
{

		$sql_queries = [];


			foreach ($alter_list as $alter)
{

			foreach ($alter_list as $alter)
{

				$this->db->sql_query('ALTER TABLE ' . POSTS_TABLE . ' ' . implode(', ', $alter));
}

			$sql_queries[] = 'ALTER TABLE ' . POSTS_TABLE . ' ' . implode(', ', $alter);


		}

if (!isset($this->stats['post_text']))
{

		}

if (!isset($this->stats['post_text']))
{

			$this->db->sql_query('ALTER TABLE ' . POSTS_TABLE . ' ADD FULLTEXT post_text (post_text)');






















			$sql_queries[] = 'ALTER TABLE ' . POSTS_TABLE . ' ADD FULLTEXT post_text (post_text)';
}

$stats = $this->stats;

/**
* Event to modify SQL queries before the MySQL search index is created
*
* @event core.search_mysql_create_index_before
* @var array sql_queries Array with queries for creating the search index
* @var array stats Array with statistics of the current index (read only)
* @since 3.2.3-RC1
*/
$vars = array(
'sql_queries',
'stats',
);
extract($this->phpbb_dispatcher->trigger_event('core.search_mysql_create_index_before', compact($vars)));

foreach ($sql_queries as $sql_query)
{
$this->db->sql_query($sql_query);

		}

$this->db->sql_query('TRUNCATE TABLE ' . SEARCH_RESULTS_TABLE);

		}

$this->db->sql_query('TRUNCATE TABLE ' . SEARCH_RESULTS_TABLE);

Line 1049Line 1106
		{
$alter[] = 'DROP INDEX post_text';
}

		{
$alter[] = 'DROP INDEX post_text';
}

 

$sql_queries = [];


if (count($alter))
{


if (count($alter))
{

			$this->db->sql_query('ALTER TABLE ' . POSTS_TABLE . ' ' . implode(', ', $alter));






















			$sql_queries[] = 'ALTER TABLE ' . POSTS_TABLE . ' ' . implode(', ', $alter);
}

$stats = $this->stats;

/**
* Event to modify SQL queries before the MySQL search index is deleted
*
* @event core.search_mysql_delete_index_before
* @var array sql_queries Array with queries for deleting the search index
* @var array stats Array with statistics of the current index (read only)
* @since 3.2.3-RC1
*/
$vars = array(
'sql_queries',
'stats',
);
extract($this->phpbb_dispatcher->trigger_event('core.search_mysql_delete_index_before', compact($vars)));

foreach ($sql_queries as $sql_query)
{
$this->db->sql_query($sql_query);

		}

$this->db->sql_query('TRUNCATE TABLE ' . SEARCH_RESULTS_TABLE);

		}

$this->db->sql_query('TRUNCATE TABLE ' . SEARCH_RESULTS_TABLE);