From 4b40f0d3c6d14adc2b20b866cbeb42586cf8d874 Mon Sep 17 00:00:00 2001 From: Dhruv Date: Wed, 11 Jul 2012 16:25:19 +0530 Subject: [PATCH] [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 --- phpBB/includes/search/fulltext_sphinx.php | 22 +++++++++++++--------- phpBB/language/en/acp/search.php | 3 +++ 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

' . $this->user->lang['FULLTEXT_SPHINX_INDEXER_MEM_LIMIT_EXPLAIN'] . '
' . $this->user->lang['MIB'] . '
+
+

' . $this->user->lang['FULLTEXT_SPHINX_CONFIG_FILE_EXPLAIN'] . '
+
' . (($this->config_generate()) ? '' : $this->user->lang('FULLTEXT_SPHINX_NO_CONFIG_DATA')) . '
+
'; // 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',