Tentative de régler le bordel
This commit is contained in:
@@ -83,7 +83,7 @@ class fulltext_mysql extends \phpbb\search\base
|
||||
* @param string $phpEx PHP file extension
|
||||
* @param \phpbb\auth\auth $auth Auth object
|
||||
* @param \phpbb\config\config $config Config object
|
||||
* @param \phpbb\db\driver\driver_interface Database object
|
||||
* @param \phpbb\db\driver\driver_interface $db Database object
|
||||
* @param \phpbb\user $user User object
|
||||
* @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher object
|
||||
*/
|
||||
@@ -150,11 +150,11 @@ class fulltext_mysql extends \phpbb\search\base
|
||||
/**
|
||||
* Checks for correct MySQL version and stores min/max word length in the config
|
||||
*
|
||||
* @return string|bool Language key of the error/incompatiblity occurred
|
||||
* @return string|bool Language key of the error/incompatibility occurred
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
if ($this->db->get_sql_layer() != 'mysql4' && $this->db->get_sql_layer() != 'mysqli')
|
||||
if ($this->db->get_sql_layer() != 'mysqli')
|
||||
{
|
||||
return $this->user->lang['FULLTEXT_MYSQL_INCOMPATIBLE_DATABASE'];
|
||||
}
|
||||
@@ -188,7 +188,7 @@ class fulltext_mysql extends \phpbb\search\base
|
||||
}
|
||||
|
||||
$sql = 'SHOW VARIABLES
|
||||
LIKE \'ft\_%\'';
|
||||
LIKE \'%ft\_%\'';
|
||||
$result = $this->db->sql_query($sql);
|
||||
|
||||
$mysql_info = array();
|
||||
@@ -198,8 +198,16 @@ class fulltext_mysql extends \phpbb\search\base
|
||||
}
|
||||
$this->db->sql_freeresult($result);
|
||||
|
||||
$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']);
|
||||
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']);
|
||||
}
|
||||
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;
|
||||
}
|
||||
@@ -997,14 +1005,7 @@ class fulltext_mysql extends \phpbb\search\base
|
||||
if (!isset($this->stats['post_subject']))
|
||||
{
|
||||
$alter_entry = array();
|
||||
if ($this->db->get_sql_layer() == 'mysqli' || version_compare($this->db->sql_server_info(true), '4.1.3', '>='))
|
||||
{
|
||||
$alter_entry[] = 'MODIFY post_subject varchar(255) COLLATE utf8_unicode_ci DEFAULT \'\' NOT NULL';
|
||||
}
|
||||
else
|
||||
{
|
||||
$alter_entry[] = 'MODIFY post_subject text NOT NULL';
|
||||
}
|
||||
$alter_entry[] = 'MODIFY post_subject varchar(255) COLLATE utf8_unicode_ci DEFAULT \'\' NOT NULL';
|
||||
$alter_entry[] = 'ADD FULLTEXT (post_subject)';
|
||||
$alter_list[] = $alter_entry;
|
||||
}
|
||||
@@ -1012,15 +1013,7 @@ class fulltext_mysql extends \phpbb\search\base
|
||||
if (!isset($this->stats['post_content']))
|
||||
{
|
||||
$alter_entry = array();
|
||||
if ($this->db->get_sql_layer() == 'mysqli' || version_compare($this->db->sql_server_info(true), '4.1.3', '>='))
|
||||
{
|
||||
$alter_entry[] = 'MODIFY post_text mediumtext COLLATE utf8_unicode_ci NOT NULL';
|
||||
}
|
||||
else
|
||||
{
|
||||
$alter_entry[] = 'MODIFY post_text mediumtext NOT NULL';
|
||||
}
|
||||
|
||||
$alter_entry[] = 'MODIFY post_text mediumtext COLLATE utf8_unicode_ci NOT NULL';
|
||||
$alter_entry[] = 'ADD FULLTEXT post_content (post_text, post_subject)';
|
||||
$alter_list[] = $alter_entry;
|
||||
}
|
||||
|
||||
@@ -109,6 +109,12 @@ class fulltext_native extends \phpbb\search\base
|
||||
* Initialises the fulltext_native search backend with min/max word length
|
||||
*
|
||||
* @param boolean|string &$error is passed by reference and should either be set to false on success or an error message on failure
|
||||
* @param string $phpbb_root_path phpBB root path
|
||||
* @param string $phpEx PHP file extension
|
||||
* @param \phpbb\auth\auth $auth Auth object
|
||||
* @param \phpbb\config\config $config Config object
|
||||
* @param \phpbb\db\driver\driver_interface $db Database object
|
||||
* @param \phpbb\user $user User object
|
||||
* @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher object
|
||||
*/
|
||||
public function __construct(&$error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher)
|
||||
@@ -351,7 +357,7 @@ class fulltext_native extends \phpbb\search\base
|
||||
$this->db->sql_freeresult($result);
|
||||
}
|
||||
|
||||
// Handle +, - without preceeding whitespace character
|
||||
// Handle +, - without preceding whitespace character
|
||||
$match = array('#(\S)\+#', '#(\S)-#');
|
||||
$replace = array('$1 +', '$1 +');
|
||||
|
||||
@@ -782,6 +788,8 @@ class fulltext_native extends \phpbb\search\base
|
||||
$must_not_contain_ids = $this->must_not_contain_ids;
|
||||
$must_contain_ids = $this->must_contain_ids;
|
||||
|
||||
$sql_sort_table = $sql_sort_join = $sql_match = $sql_match_where = $sql_sort = '';
|
||||
|
||||
/**
|
||||
* Allow changing the query used for counting for posts using fulltext_native
|
||||
*
|
||||
@@ -889,7 +897,6 @@ class fulltext_native extends \phpbb\search\base
|
||||
|
||||
switch ($this->db->get_sql_layer())
|
||||
{
|
||||
case 'mysql4':
|
||||
case 'mysqli':
|
||||
|
||||
// 3.x does not support SQL_CALC_FOUND_ROWS
|
||||
@@ -1184,7 +1191,6 @@ class fulltext_native extends \phpbb\search\base
|
||||
{
|
||||
switch ($this->db->get_sql_layer())
|
||||
{
|
||||
case 'mysql4':
|
||||
case 'mysqli':
|
||||
// $select = 'SQL_CALC_FOUND_ROWS ' . $select;
|
||||
$is_mysql = true;
|
||||
|
||||
@@ -173,7 +173,7 @@ class fulltext_postgres extends \phpbb\search\base
|
||||
/**
|
||||
* Checks for correct PostgreSQL version and stores min/max word length in the config
|
||||
*
|
||||
* @return string|bool Language key of the error/incompatiblity occurred
|
||||
* @return string|bool Language key of the error/incompatibility occurred
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ define('SPHINX_CONNECT_RETRIES', 3);
|
||||
define('SPHINX_CONNECT_WAIT_TIME', 300);
|
||||
|
||||
/**
|
||||
* Fulltext search based on the sphinx search deamon
|
||||
* Fulltext search based on the sphinx search daemon
|
||||
*/
|
||||
class fulltext_sphinx
|
||||
{
|
||||
@@ -210,11 +210,11 @@ class fulltext_sphinx
|
||||
/**
|
||||
* Checks permissions and paths, if everything is correct it generates the config file
|
||||
*
|
||||
* @return string|bool Language key of the error/incompatiblity encountered, or false if successful
|
||||
* @return string|bool Language key of the error/incompatibility encountered, or false if successful
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
if ($this->db->get_sql_layer() != 'mysql' && $this->db->get_sql_layer() != 'mysql4' && $this->db->get_sql_layer() != 'mysqli' && $this->db->get_sql_layer() != 'postgres')
|
||||
if ($this->db->get_sql_layer() != 'mysqli' && $this->db->get_sql_layer() != 'postgres')
|
||||
{
|
||||
return $this->user->lang['FULLTEXT_SPHINX_WRONG_DATABASE'];
|
||||
}
|
||||
@@ -233,7 +233,7 @@ class fulltext_sphinx
|
||||
protected function config_generate()
|
||||
{
|
||||
// Check if Database is supported by Sphinx
|
||||
if ($this->db->get_sql_layer() =='mysql' || $this->db->get_sql_layer() == 'mysql4' || $this->db->get_sql_layer() == 'mysqli')
|
||||
if ($this->db->get_sql_layer() == 'mysqli')
|
||||
{
|
||||
$this->dbtype = 'mysql';
|
||||
}
|
||||
@@ -335,6 +335,7 @@ class fulltext_sphinx
|
||||
array('charset_table', 'U+FF10..U+FF19->0..9, 0..9, U+FF41..U+FF5A->a..z, U+FF21..U+FF3A->a..z, A..Z->a..z, a..z, U+0149, U+017F, U+0138, U+00DF, U+00FF, U+00C0..U+00D6->U+00E0..U+00F6, U+00E0..U+00F6, U+00D8..U+00DE->U+00F8..U+00FE, U+00F8..U+00FE, U+0100->U+0101, U+0101, U+0102->U+0103, U+0103, U+0104->U+0105, U+0105, U+0106->U+0107, U+0107, U+0108->U+0109, U+0109, U+010A->U+010B, U+010B, U+010C->U+010D, U+010D, U+010E->U+010F, U+010F, U+0110->U+0111, U+0111, U+0112->U+0113, U+0113, U+0114->U+0115, U+0115, U+0116->U+0117, U+0117, U+0118->U+0119, U+0119, U+011A->U+011B, U+011B, U+011C->U+011D, U+011D, U+011E->U+011F, U+011F, U+0130->U+0131, U+0131, U+0132->U+0133, U+0133, U+0134->U+0135, U+0135, U+0136->U+0137, U+0137, U+0139->U+013A, U+013A, U+013B->U+013C, U+013C, U+013D->U+013E, U+013E, U+013F->U+0140, U+0140, U+0141->U+0142, U+0142, U+0143->U+0144, U+0144, U+0145->U+0146, U+0146, U+0147->U+0148, U+0148, U+014A->U+014B, U+014B, U+014C->U+014D, U+014D, U+014E->U+014F, U+014F, U+0150->U+0151, U+0151, U+0152->U+0153, U+0153, U+0154->U+0155, U+0155, U+0156->U+0157, U+0157, U+0158->U+0159, U+0159, U+015A->U+015B, U+015B, U+015C->U+015D, U+015D, U+015E->U+015F, U+015F, U+0160->U+0161, U+0161, U+0162->U+0163, U+0163, U+0164->U+0165, U+0165, U+0166->U+0167, U+0167, U+0168->U+0169, U+0169, U+016A->U+016B, U+016B, U+016C->U+016D, U+016D, U+016E->U+016F, U+016F, U+0170->U+0171, U+0171, U+0172->U+0173, U+0173, U+0174->U+0175, U+0175, U+0176->U+0177, U+0177, U+0178->U+00FF, U+00FF, U+0179->U+017A, U+017A, U+017B->U+017C, U+017C, U+017D->U+017E, U+017E, U+0410..U+042F->U+0430..U+044F, U+0430..U+044F, U+4E00..U+9FFF'),
|
||||
array('min_prefix_len', '0'),
|
||||
array('min_infix_len', '0'),
|
||||
array('html_strip', '1'),
|
||||
),
|
||||
'index index_phpbb_' . $this->id . '_delta : index_phpbb_' . $this->id . '_main' => array(
|
||||
array('path', $this->config['fulltext_sphinx_data_path'] . 'index_phpbb_' . $this->id . '_delta'),
|
||||
@@ -644,7 +645,7 @@ class fulltext_sphinx
|
||||
|
||||
$this->sphinx->SetFilter('deleted', array(0));
|
||||
|
||||
$this->sphinx->SetLimits((int) $start, (int) $per_page, SPHINX_MAX_MATCHES);
|
||||
$this->sphinx->SetLimits((int) $start, (int) $per_page, max(SPHINX_MAX_MATCHES, (int) $start + $per_page));
|
||||
$result = $this->sphinx->Query($search_query_prefix . $this->sphinx->EscapeString(str_replace('"', '"', $this->search_query)), $this->indexes);
|
||||
|
||||
// Could be connection to localhost:9312 failed (errno=111,
|
||||
@@ -675,7 +676,7 @@ class fulltext_sphinx
|
||||
{
|
||||
$start = floor(($result_count - 1) / $per_page) * $per_page;
|
||||
|
||||
$this->sphinx->SetLimits((int) $start, (int) $per_page, SPHINX_MAX_MATCHES);
|
||||
$this->sphinx->SetLimits((int) $start, (int) $per_page, max(SPHINX_MAX_MATCHES, (int) $start + $per_page));
|
||||
$result = $this->sphinx->Query($search_query_prefix . $this->sphinx->EscapeString(str_replace('"', '"', $this->search_query)), $this->indexes);
|
||||
|
||||
// Could be connection to localhost:9312 failed (errno=111,
|
||||
|
||||
Reference in New Issue
Block a user