mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[feature/sphinx-fulltext-search] add support for postgres
Don't generate sphinx config file if database is not supported. Add property $dbtype to write into sphinx config file according to sql_layer. PHPBB3-10946
This commit is contained in:
parent
609ce3ae8f
commit
a3d103c9c0
1 changed files with 20 additions and 3 deletions
|
@ -44,6 +44,7 @@ class phpbb_search_fulltext_sphinx
|
||||||
private $config;
|
private $config;
|
||||||
private $db;
|
private $db;
|
||||||
private $db_tools;
|
private $db_tools;
|
||||||
|
private $dbtype;
|
||||||
private $user;
|
private $user;
|
||||||
private $config_file_data = '';
|
private $config_file_data = '';
|
||||||
public $word_length = array();
|
public $word_length = array();
|
||||||
|
@ -130,8 +131,25 @@ class phpbb_search_fulltext_sphinx
|
||||||
{
|
{
|
||||||
global $phpbb_root_path, $phpEx;
|
global $phpbb_root_path, $phpEx;
|
||||||
|
|
||||||
|
// Check if Database is supported by Sphinx
|
||||||
|
if ($this->db->sql_layer =='mysql' || $this->db->sql_layer == 'mysql4' || $this->db->sql_layer == 'mysqli')
|
||||||
|
{
|
||||||
|
$this->dbtype = 'mysql';
|
||||||
|
}
|
||||||
|
else if ($this->db->sql_layer == 'postgres')
|
||||||
|
{
|
||||||
|
$this->dbtype = 'pgsql';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->config_file_data = $this->user->lang('FULLTEXT_SPHINX_WRONG_DATABASE');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if directory paths have been filled
|
||||||
if (!$this->config['fulltext_sphinx_data_path'] || !$this->config['fulltext_sphinx_config_path'])
|
if (!$this->config['fulltext_sphinx_data_path'] || !$this->config['fulltext_sphinx_config_path'])
|
||||||
{
|
{
|
||||||
|
$this->config_file_data = $this->user->lang('FULLTEXT_SPHINX_NO_CONFIG_DATA');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,10 +159,9 @@ class phpbb_search_fulltext_sphinx
|
||||||
generate a config for the index. We use a config value
|
generate a config for the index. We use a config value
|
||||||
fulltext_sphinx_id for this, as it should be unique. */
|
fulltext_sphinx_id for this, as it should be unique. */
|
||||||
$config_object = new phpbb_search_sphinx_config($this->config_file_data);
|
$config_object = new phpbb_search_sphinx_config($this->config_file_data);
|
||||||
|
|
||||||
$config_data = array(
|
$config_data = array(
|
||||||
'source source_phpbb_' . $this->id . '_main' => array(
|
'source source_phpbb_' . $this->id . '_main' => array(
|
||||||
array('type', 'mysql'),
|
array('type', $this->dbtype),
|
||||||
array('sql_host', $dbhost),
|
array('sql_host', $dbhost),
|
||||||
array('sql_user', $dbuser),
|
array('sql_user', $dbuser),
|
||||||
array('sql_pass', $dbpasswd),
|
array('sql_pass', $dbpasswd),
|
||||||
|
@ -771,7 +788,7 @@ class phpbb_search_fulltext_sphinx
|
||||||
</dl>
|
</dl>
|
||||||
<dl>
|
<dl>
|
||||||
<dt><label for="fulltext_sphinx_config_file">' . $this->user->lang['FULLTEXT_SPHINX_CONFIG_FILE'] . ':</label><br /><span>' . $this->user->lang['FULLTEXT_SPHINX_CONFIG_FILE_EXPLAIN'] . '</dt>
|
<dt><label for="fulltext_sphinx_config_file">' . $this->user->lang['FULLTEXT_SPHINX_CONFIG_FILE'] . ':</label><br /><span>' . $this->user->lang['FULLTEXT_SPHINX_CONFIG_FILE_EXPLAIN'] . '</dt>
|
||||||
<dd>' . (($this->config_generate()) ? '<textarea disabled="disabled" rows="6">' . $this->config_file_data . '</textarea>' : $this->user->lang('FULLTEXT_SPHINX_NO_CONFIG_DATA')) . '</dd>
|
<dd>' . (($this->config_generate()) ? '<textarea disabled="disabled" rows="6">' . $this->config_file_data . '</textarea>' : $this->config_file_data) . '</dd>
|
||||||
<dl>
|
<dl>
|
||||||
';
|
';
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue