i18n/L10n review, extension credits added.

This commit is contained in:
Siebrand Mazeland 2010-10-04 00:02:24 +02:00
parent 362f395e03
commit 1652ded48c
5 changed files with 33 additions and 12 deletions

View File

@ -41,8 +41,6 @@ foreach($sphinxDefaults as $key => $val) {
} }
} }
/** /**
* Plugin for Sphinx search backend. * Plugin for Sphinx search backend.
* *
@ -53,7 +51,6 @@ foreach($sphinxDefaults as $key => $val) {
* @link http://laconi.ca/ * @link http://laconi.ca/
* @link http://twitter.com/ * @link http://twitter.com/
*/ */
class SphinxSearchPlugin extends Plugin class SphinxSearchPlugin extends Plugin
{ {
/** /**
@ -86,7 +83,8 @@ class SphinxSearchPlugin extends Plugin
{ {
if (common_config('sphinx', 'enabled')) { if (common_config('sphinx', 'enabled')) {
if (!class_exists('SphinxClient')) { 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); $engine = new SphinxSearch($target, $table);
if ($engine->is_connected()) { if ($engine->is_connected()) {
@ -97,4 +95,28 @@ class SphinxSearchPlugin extends Plugin
// Sphinx disabled or disconnected // Sphinx disabled or disconnected
return true; 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;
}
} }

View File

@ -70,8 +70,6 @@ searchd
END; END;
/** /**
* Build config entries for a single site * Build config entries for a single site
* @fixme we only seem to have master DB currently available... * @fixme we only seem to have master DB currently available...

View File

@ -42,20 +42,20 @@ sphinx_iterate_sites('sphinx_index_update');
function sphinx_index_update($sn) function sphinx_index_update($sn)
{ {
$base = sphinx_base(); $base = sphinx_base();
$baseIndexes = array('notice', 'profile'); $baseIndexes = array('notice', 'profile');
$params = array(); $params = array();
if (have_option('rotate')) { if (have_option('rotate')) {
$params[] = '--rotate'; $params[] = '--rotate';
} }
foreach ($baseIndexes as $index) { foreach ($baseIndexes as $index) {
$params[] = "{$sn->dbname}_{$index}"; $params[] = "{$sn->dbname}_{$index}";
} }
$params = implode(' ', $params); $params = implode(' ', $params);
$cmd = "$base/bin/indexer --config $base/etc/sphinx.conf $params"; $cmd = "$base/bin/indexer --config $base/etc/sphinx.conf $params";
print "$cmd\n"; print "$cmd\n";
system($cmd); system($cmd);
} }

View File

@ -60,4 +60,3 @@ function sphinx_iterate_sites($callback)
} }
} }
} }

View File

@ -91,6 +91,8 @@ class SphinxSearch extends SearchEngine
if (preg_match('!^.*?://.*?:.*?@.*?/(.*?)$!', common_config('db', 'database'), $matches)) { if (preg_match('!^.*?://.*?:.*?@.*?/(.*?)$!', common_config('db', 'database'), $matches)) {
return $matches[1]; 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."));
} }
} }