[SearchEngine] Update API monitor

This commit is contained in:
Romain Neutron
2012-10-30 18:26:08 +01:00
parent 858d0fda35
commit 4d6608b9d1
4 changed files with 87 additions and 64 deletions

View File

@@ -47,6 +47,14 @@ class PhraseaEngine implements SearchEngineInterface
$this->options = new SearchEngineOptions();
}
/**
* {@inheritdoc}
*/
public function getName()
{
return 'Phrasea';
}
/**
* {@inheritdoc}
*/

View File

@@ -22,6 +22,13 @@ interface SearchEngineInterface
const GEM_TYPE_STORY = 'story';
const GEM_TYPE_ENTRY = 'entry';
/**
* Returns the name of the search engine
*
* @return string The name of the search-engine
*/
public function getName();
/**
* Check the status of the search engine
*

View File

@@ -71,6 +71,14 @@ class SphinxSearchEngine implements SearchEngineInterface
return $this;
}
/**
* {@inheritdoc}
*/
public function getName()
{
return 'SphinxSearch';
}
/**
* {@inheritdoc}
*/

View File

@@ -324,6 +324,12 @@ class API_V1_adapter extends API_V1_Abstract
*/
protected function get_gv_info(Application $app)
{
try {
$SEStatus = $app['phraseanet.SE']->status();
} catch (\RuntimeException $e) {
$SEStatus = array('error' => $e->getMessage());
}
return array(
'global_values' => array(
'serverName' => $app['phraseanet.registry']->get('GV_ServerName'),
@@ -405,21 +411,14 @@ class API_V1_adapter extends API_V1_Abstract
'configuration' => array(
'defaultQuery' => $app['phraseanet.registry']->get('GV_defaultQuery'),
'defaultQueryType' => $app['phraseanet.registry']->get('GV_defaultQuery_type'),
),
/**
* @todo neutron update this
*/
'sphinx' => array(
'active' => $app['phraseanet.registry']->get('GV_sphinx'),
'host' => $app['phraseanet.registry']->get('GV_sphinx_host'),
'port' => $app['phraseanet.registry']->get('GV_sphinx_port'),
'realtimeHost' => $app['phraseanet.registry']->get('GV_sphinx_rt_host'),
'realtimePort' => $app['phraseanet.registry']->get('GV_sphinx_rt_port'),
),
'phrasea' => array(
'minChar' => $app['phraseanet.registry']->get('GV_min_letters_truncation'),
'sort' => $app['phraseanet.registry']->get('GV_phrasea_sort'),
),
'engine' => array(
'type' => $app['phraseanet.SE']->getName(),
'status' => $SEStatus,
'configuration' => $app['phraseanet.SE']->configurationPanel()->getConfiguration(),
),
),
'binary' => array(
'phpCli' => $app['phraseanet.registry']->get('php_binary'),
@@ -2191,4 +2190,5 @@ class API_V1_adapter extends API_V1_Abstract
return $ret;
}
}