aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/search
diff options
context:
space:
mode:
authorDhruv <dhruv.goel92@gmail.com>2012-07-12 18:08:50 +0530
committerDhruv <dhruv.goel92@gmail.com>2012-07-19 23:01:50 +0530
commita3d103c9c03c79fe67963b9db5a5471c766fa401 (patch)
tree7803b6ffb1382bf8f522cec2c7eff785f2cd63ab /phpBB/includes/search
parent609ce3ae8fb55e717ff188d2ec9c10c6ae252b7a (diff)
downloadforums-a3d103c9c03c79fe67963b9db5a5471c766fa401.tar
forums-a3d103c9c03c79fe67963b9db5a5471c766fa401.tar.gz
forums-a3d103c9c03c79fe67963b9db5a5471c766fa401.tar.bz2
forums-a3d103c9c03c79fe67963b9db5a5471c766fa401.tar.xz
forums-a3d103c9c03c79fe67963b9db5a5471c766fa401.zip
[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
Diffstat (limited to 'phpBB/includes/search')
-rw-r--r--phpBB/includes/search/fulltext_sphinx.php23
1 files changed, 20 insertions, 3 deletions
diff --git a/phpBB/includes/search/fulltext_sphinx.php b/phpBB/includes/search/fulltext_sphinx.php
index 76caf9ae8c..a4341f46e0 100644
--- a/phpBB/includes/search/fulltext_sphinx.php
+++ b/phpBB/includes/search/fulltext_sphinx.php
@@ -44,6 +44,7 @@ class phpbb_search_fulltext_sphinx
private $config;
private $db;
private $db_tools;
+ private $dbtype;
private $user;
private $config_file_data = '';
public $word_length = array();
@@ -130,8 +131,25 @@ class phpbb_search_fulltext_sphinx
{
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'])
{
+ $this->config_file_data = $this->user->lang('FULLTEXT_SPHINX_NO_CONFIG_DATA');
return false;
}
@@ -141,10 +159,9 @@ class phpbb_search_fulltext_sphinx
generate a config for the index. We use a config value
fulltext_sphinx_id for this, as it should be unique. */
$config_object = new phpbb_search_sphinx_config($this->config_file_data);
-
$config_data = array(
'source source_phpbb_' . $this->id . '_main' => array(
- array('type', 'mysql'),
+ array('type', $this->dbtype),
array('sql_host', $dbhost),
array('sql_user', $dbuser),
array('sql_pass', $dbpasswd),
@@ -771,7 +788,7 @@ class phpbb_search_fulltext_sphinx
</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>
- <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>
';