aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDhruv <dhruv.goel92@gmail.com>2012-07-11 16:25:19 +0530
committerDhruv <dhruv.goel92@gmail.com>2012-07-19 23:01:41 +0530
commit4b40f0d3c6d14adc2b20b866cbeb42586cf8d874 (patch)
tree049ba647244ca30f2758a1bca51926ca4c019617
parentb16e70ae1d03587c7d7d7e106299a4e576491751 (diff)
downloadforums-4b40f0d3c6d14adc2b20b866cbeb42586cf8d874.tar
forums-4b40f0d3c6d14adc2b20b866cbeb42586cf8d874.tar.gz
forums-4b40f0d3c6d14adc2b20b866cbeb42586cf8d874.tar.bz2
forums-4b40f0d3c6d14adc2b20b866cbeb42586cf8d874.tar.xz
forums-4b40f0d3c6d14adc2b20b866cbeb42586cf8d874.zip
[feature/sphinx-fulltext-search] display config file in ACP
sphinx config file is generated and displayed in the ACP for user to use it to start sphinx search daemon. PHPBB3-10946
-rw-r--r--phpBB/includes/search/fulltext_sphinx.php22
-rw-r--r--phpBB/language/en/acp/search.php3
2 files changed, 16 insertions, 9 deletions
diff --git a/phpBB/includes/search/fulltext_sphinx.php b/phpBB/includes/search/fulltext_sphinx.php
index 6488cbcd40..6e554eec00 100644
--- a/phpBB/includes/search/fulltext_sphinx.php
+++ b/phpBB/includes/search/fulltext_sphinx.php
@@ -112,11 +112,6 @@ class phpbb_search_fulltext_sphinx
return $this->user->lang['FULLTEXT_SPHINX_WRONG_DATABASE'];
}
- if ($error = $this->config_updated())
- {
- return $error;
- }
-
// Move delta to main index each hour
set_config('search_gc', 3600);
@@ -124,16 +119,21 @@ class phpbb_search_fulltext_sphinx
}
/**
- * Updates the config file sphinx.conf and generates the same in case autoconf is selected
+ * Generates content of sphinx.conf
*
- * @return string|bool Language key of the error/incompatiblity occured otherwise false
+ * @return bool True if sphinx.conf content is correctly generated, false otherwise
*
* @access private
*/
- function config_updated()
+ function config_generate()
{
global $phpbb_root_path, $phpEx;
+ if (!$this->config['fulltext_sphinx_data_path'] || !$this->config['fulltext_sphinx_config_path'])
+ {
+ return false;
+ }
+
include ($phpbb_root_path . 'config.' . $phpEx);
/* Now that we're sure everything was entered correctly,
@@ -280,7 +280,7 @@ class phpbb_search_fulltext_sphinx
}
$this->config_file_data = $config_object->get_data();
- return false;
+ return true;
}
/**
@@ -767,6 +767,10 @@ class phpbb_search_fulltext_sphinx
<dt><label for="fulltext_sphinx_indexer_mem_limit">' . $this->user->lang['FULLTEXT_SPHINX_INDEXER_MEM_LIMIT'] . ':</label><br /><span>' . $this->user->lang['FULLTEXT_SPHINX_INDEXER_MEM_LIMIT_EXPLAIN'] . '</span></dt>
<dd><input id="fulltext_sphinx_indexer_mem_limit" type="text" size="4" maxlength="10" name="config[fulltext_sphinx_indexer_mem_limit]" value="' . $this->config['fulltext_sphinx_indexer_mem_limit'] . '" />' . $this->user->lang['MIB'] . '</dd>
</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>
+ <dl>
';
// These are fields required in the config table
diff --git a/phpBB/language/en/acp/search.php b/phpBB/language/en/acp/search.php
index 9618bb90c5..778f9ddec5 100644
--- a/phpBB/language/en/acp/search.php
+++ b/phpBB/language/en/acp/search.php
@@ -85,6 +85,9 @@ $lang = array_merge($lang, array(
'FULLTEXT_SPHINX_WRONG_DATABASE' => 'The sphinx plugin for phpBB currently only supports MySQL',
'FULLTEXT_SPHINX_STOPWORDS_FILE' => 'Stopwords activated',
'FULLTEXT_SPHINX_STOPWORDS_FILE_EXPLAIN' => 'This setting only works with autoconf enabled. You can place a file called sphinx_stopwords.txt containing one word in each line in your config directory. If this file is present these words will be excluded from the indexing process.',
+ 'FULLTEXT_SPHINX_CONFIG_FILE' => 'Sphinx config file',
+ 'FULLTEXT_SPHINX_CONFIG_FILE_EXPLAIN' => 'The generated content of the sphinx config file. This data needs to be pasted into the sphinx.conf which is used by sphinx search daemon.',
+ 'FULLTEXT_SPHINX_NO_CONFIG_DATA' => 'The sphinx data and config directory paths are not defined. Please define them to generate the config file.',
'GENERAL_SEARCH_SETTINGS' => 'General search settings',
'GO_TO_SEARCH_INDEX' => 'Go to search index page',