[feature/sphinx-fulltext-search] makes sql host configurable

The SQL server host which sphinx connects to index the posts is now
configurable via ACP.

PHPBB3-10946
This commit is contained in:
Dhruv 2012-07-22 02:50:53 +05:30
parent 0e9eb9401a
commit 161e469b5a
3 changed files with 11 additions and 4 deletions

View file

@ -1,7 +1,7 @@
source source_phpbb_{SPHINX_ID}_main source source_phpbb_{SPHINX_ID}_main
{ {
type = mysql type = mysql #mysql or pgsql
sql_host = localhost sql_host = localhost #SQL server host sphinx connects to
sql_user = username sql_user = username
sql_pass = password sql_pass = password
sql_db = db_name sql_db = db_name

View file

@ -162,11 +162,11 @@ class phpbb_search_fulltext_sphinx
$config_data = array( $config_data = array(
'source source_phpbb_' . $this->id . '_main' => array( 'source source_phpbb_' . $this->id . '_main' => array(
array('type', $this->dbtype), array('type', $this->dbtype),
array('sql_host', $dbhost), array('sql_host', $this->config['fulltext_sphinx_host'] ? $this->config['fulltext_sphinx_host'] : $dbhost),
array('sql_user', $dbuser), array('sql_user', $dbuser),
array('sql_pass', $dbpasswd), array('sql_pass', $dbpasswd),
array('sql_db', $dbname), array('sql_db', $dbname),
array('sql_port', $dbport), array('sql_port', $this->config['fulltext_sphinx_port']),
array('sql_query_pre', 'SET NAMES \'utf8\''), array('sql_query_pre', 'SET NAMES \'utf8\''),
array('sql_query_pre', 'UPDATE ' . SPHINX_TABLE . ' SET max_doc_id = (SELECT MAX(post_id) FROM ' . POSTS_TABLE . ') WHERE counter_id = 1'), array('sql_query_pre', 'UPDATE ' . SPHINX_TABLE . ' SET max_doc_id = (SELECT MAX(post_id) FROM ' . POSTS_TABLE . ') WHERE counter_id = 1'),
array('sql_query_range', 'SELECT MIN(post_id), MAX(post_id) FROM ' . POSTS_TABLE . ''), array('sql_query_range', 'SELECT MIN(post_id), MAX(post_id) FROM ' . POSTS_TABLE . ''),
@ -759,6 +759,7 @@ class phpbb_search_fulltext_sphinx
$config_vars = array( $config_vars = array(
'fulltext_sphinx_config_path' => 'string', 'fulltext_sphinx_config_path' => 'string',
'fulltext_sphinx_data_path' => 'string', 'fulltext_sphinx_data_path' => 'string',
'fulltext_sphinx_host' => 'string',
'fulltext_sphinx_port' => 'int', 'fulltext_sphinx_port' => 'int',
'fulltext_sphinx_stopwords' => 'bool', 'fulltext_sphinx_stopwords' => 'bool',
'fulltext_sphinx_indexer_mem_limit' => 'int', 'fulltext_sphinx_indexer_mem_limit' => 'int',
@ -778,6 +779,10 @@ class phpbb_search_fulltext_sphinx
<dt><label for="fulltext_sphinx_stopwords">' . $this->user->lang['FULLTEXT_SPHINX_STOPWORDS_FILE'] . ':</label><br /><span>' . $this->user->lang['FULLTEXT_SPHINX_STOPWORDS_FILE_EXPLAIN'] . '</span></dt> <dt><label for="fulltext_sphinx_stopwords">' . $this->user->lang['FULLTEXT_SPHINX_STOPWORDS_FILE'] . ':</label><br /><span>' . $this->user->lang['FULLTEXT_SPHINX_STOPWORDS_FILE_EXPLAIN'] . '</span></dt>
<dd><label><input type="radio" id="fulltext_sphinx_stopwords" name="config[fulltext_sphinx_stopwords]" value="1"' . (($this->config['fulltext_sphinx_stopwords']) ? ' checked="checked"' : '') . ' class="radio" /> ' . $this->user->lang['YES'] . '</label><label><input type="radio" name="config[fulltext_sphinx_stopwords]" value="0"' . ((!$this->config['fulltext_sphinx_stopwords']) ? ' checked="checked"' : '') . ' class="radio" /> ' . $this->user->lang['NO'] . '</label></dd> <dd><label><input type="radio" id="fulltext_sphinx_stopwords" name="config[fulltext_sphinx_stopwords]" value="1"' . (($this->config['fulltext_sphinx_stopwords']) ? ' checked="checked"' : '') . ' class="radio" /> ' . $this->user->lang['YES'] . '</label><label><input type="radio" name="config[fulltext_sphinx_stopwords]" value="0"' . ((!$this->config['fulltext_sphinx_stopwords']) ? ' checked="checked"' : '') . ' class="radio" /> ' . $this->user->lang['NO'] . '</label></dd>
</dl> </dl>
<dl>
<dt><label for="fulltext_sphinx_host">' . $this->user->lang['FULLTEXT_SPHINX_HOST'] . ':</label><br /><span>' . $this->user->lang['FULLTEXT_SPHINX_HOST_EXPLAIN'] . '</span></dt>
<dd><input id="fulltext_sphinx_host" type="text" size="40" maxlength="255" name="config[fulltext_sphinx_host]" value="' . $this->config['fulltext_sphinx_host'] . '" /></dd>
</dl>
<dl> <dl>
<dt><label for="fulltext_sphinx_port">' . $this->user->lang['FULLTEXT_SPHINX_PORT'] . ':</label><br /><span>' . $this->user->lang['FULLTEXT_SPHINX_PORT_EXPLAIN'] . '</span></dt> <dt><label for="fulltext_sphinx_port">' . $this->user->lang['FULLTEXT_SPHINX_PORT'] . ':</label><br /><span>' . $this->user->lang['FULLTEXT_SPHINX_PORT_EXPLAIN'] . '</span></dt>
<dd><input id="fulltext_sphinx_port" type="text" size="4" maxlength="10" name="config[fulltext_sphinx_port]" value="' . $this->config['fulltext_sphinx_port'] . '" /></dd> <dd><input id="fulltext_sphinx_port" type="text" size="4" maxlength="10" name="config[fulltext_sphinx_port]" value="' . $this->config['fulltext_sphinx_port'] . '" /></dd>

View file

@ -75,6 +75,8 @@ $lang = array_merge($lang, array(
'FULLTEXT_SPHINX_DATA_PATH' => 'Path to data directory', 'FULLTEXT_SPHINX_DATA_PATH' => 'Path to data directory',
'FULLTEXT_SPHINX_DATA_PATH_EXPLAIN' => 'It will be used to store the indexes and log files. You should create this directory outside the web accessable directories.', 'FULLTEXT_SPHINX_DATA_PATH_EXPLAIN' => 'It will be used to store the indexes and log files. You should create this directory outside the web accessable directories.',
'FULLTEXT_SPHINX_DELTA_POSTS' => 'Number of posts in frequently updated delta index', 'FULLTEXT_SPHINX_DELTA_POSTS' => 'Number of posts in frequently updated delta index',
'FULLTEXT_SPHINX_HOST' => 'SQL server host',
'FULLTEXT_SPHINX_HOST_EXPLAIN' => 'SQL server host, which the sphinx search daemon (searchd) connects to. Leave empty to use the default SQL server host',
'FULLTEXT_SPHINX_INDEXER_MEM_LIMIT' => 'Indexer memory limit', 'FULLTEXT_SPHINX_INDEXER_MEM_LIMIT' => 'Indexer memory limit',
'FULLTEXT_SPHINX_INDEXER_MEM_LIMIT_EXPLAIN' => 'This number should at all times be lower than the RAM available on your machine. If you experience periodic performance problems this might be due to the indexer consuming too many resources. It might help to lower the amount of memory available to the indexer.', 'FULLTEXT_SPHINX_INDEXER_MEM_LIMIT_EXPLAIN' => 'This number should at all times be lower than the RAM available on your machine. If you experience periodic performance problems this might be due to the indexer consuming too many resources. It might help to lower the amount of memory available to the indexer.',
'FULLTEXT_SPHINX_MAIN_POSTS' => 'Number of posts in main index', 'FULLTEXT_SPHINX_MAIN_POSTS' => 'Number of posts in main index',