From 1652ded48c9c62c40157a5142e5231adbc574ddb Mon Sep 17 00:00:00 2001 From: Siebrand Mazeland Date: Mon, 4 Oct 2010 00:02:24 +0200 Subject: [PATCH] i18n/L10n review, extension credits added. --- plugins/SphinxSearch/SphinxSearchPlugin.php | 30 ++++++++++++++++--- plugins/SphinxSearch/scripts/gen_config.php | 2 -- plugins/SphinxSearch/scripts/index_update.php | 8 ++--- plugins/SphinxSearch/scripts/sphinx-utils.php | 1 - plugins/SphinxSearch/sphinxsearch.php | 4 ++- 5 files changed, 33 insertions(+), 12 deletions(-) diff --git a/plugins/SphinxSearch/SphinxSearchPlugin.php b/plugins/SphinxSearch/SphinxSearchPlugin.php index 7a27a4c042..ad34a7cc15 100644 --- a/plugins/SphinxSearch/SphinxSearchPlugin.php +++ b/plugins/SphinxSearch/SphinxSearchPlugin.php @@ -41,8 +41,6 @@ foreach($sphinxDefaults as $key => $val) { } } - - /** * Plugin for Sphinx search backend. * @@ -53,7 +51,6 @@ foreach($sphinxDefaults as $key => $val) { * @link http://laconi.ca/ * @link http://twitter.com/ */ - class SphinxSearchPlugin extends Plugin { /** @@ -86,7 +83,8 @@ class SphinxSearchPlugin extends Plugin { if (common_config('sphinx', 'enabled')) { if (!class_exists('SphinxClient')) { - throw new ServerException('Sphinx PHP extension must be installed.'); + // TRANS: Server exception. + throw new ServerException(_m('Sphinx PHP extension must be installed.')); } $engine = new SphinxSearch($target, $table); if ($engine->is_connected()) { @@ -97,4 +95,28 @@ class SphinxSearchPlugin extends Plugin // Sphinx disabled or disconnected return true; } + + /** + * Provide plugin version information. + * + * This data is used when showing the version page. + * + * @param array &$versions array of version data arrays; see EVENTS.txt + * + * @return boolean hook value + */ + function onPluginVersion(&$versions) + { + $url = 'http://status.net/wiki/Plugin:SphinxSearch'; + + $versions[] = array('name' => 'SphinxSearch', + 'version' => STATUSNET_VERSION, + 'author' => 'Brion Vibber', + 'homepage' => $url, + 'rawdescription' => + // TRANS: Plugin description. + _m('Plugin for Sphinx search backend.')); + + return true; + } } diff --git a/plugins/SphinxSearch/scripts/gen_config.php b/plugins/SphinxSearch/scripts/gen_config.php index d5a00b6b6b..e7f3977478 100755 --- a/plugins/SphinxSearch/scripts/gen_config.php +++ b/plugins/SphinxSearch/scripts/gen_config.php @@ -70,8 +70,6 @@ searchd END; - - /** * Build config entries for a single site * @fixme we only seem to have master DB currently available... diff --git a/plugins/SphinxSearch/scripts/index_update.php b/plugins/SphinxSearch/scripts/index_update.php index 23c60ced76..abac5434f7 100755 --- a/plugins/SphinxSearch/scripts/index_update.php +++ b/plugins/SphinxSearch/scripts/index_update.php @@ -42,20 +42,20 @@ sphinx_iterate_sites('sphinx_index_update'); function sphinx_index_update($sn) { $base = sphinx_base(); - + $baseIndexes = array('notice', 'profile'); $params = array(); - + if (have_option('rotate')) { $params[] = '--rotate'; } foreach ($baseIndexes as $index) { $params[] = "{$sn->dbname}_{$index}"; } - + $params = implode(' ', $params); $cmd = "$base/bin/indexer --config $base/etc/sphinx.conf $params"; - + print "$cmd\n"; system($cmd); } diff --git a/plugins/SphinxSearch/scripts/sphinx-utils.php b/plugins/SphinxSearch/scripts/sphinx-utils.php index 7bbc252702..22d70fb8d1 100644 --- a/plugins/SphinxSearch/scripts/sphinx-utils.php +++ b/plugins/SphinxSearch/scripts/sphinx-utils.php @@ -60,4 +60,3 @@ function sphinx_iterate_sites($callback) } } } - diff --git a/plugins/SphinxSearch/sphinxsearch.php b/plugins/SphinxSearch/sphinxsearch.php index 654b9c9d5b..1ce9bfd72d 100644 --- a/plugins/SphinxSearch/sphinxsearch.php +++ b/plugins/SphinxSearch/sphinxsearch.php @@ -91,6 +91,8 @@ class SphinxSearch extends SearchEngine if (preg_match('!^.*?://.*?:.*?@.*?/(.*?)$!', common_config('db', 'database'), $matches)) { return $matches[1]; } - throw new ServerException("Sphinx search could not identify database name"); + + // TRANS: Server exception thrown when a database name cannot be identified. + throw new ServerException(_m("Sphinx search could not identify database name.")); } }