mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 15:03:25 +00:00
Remove phraseanet services, update configuration
This commit is contained in:
@@ -60,58 +60,7 @@ class patch_3803 implements patchInterface
|
||||
*/
|
||||
public function apply(base $appbox, Application $app)
|
||||
{
|
||||
$searchEngine = $app['phraseanet.registry']->get('GV_sphinx') ? 'sphinxsearch' : 'phrasea';
|
||||
|
||||
$confs = $app['phraseanet.configuration']->getConfigurations();
|
||||
|
||||
foreach ($confs as $env => $conf) {
|
||||
|
||||
if (in_array($env, array('environment', 'key'))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isset($conf['search-engine'])) {
|
||||
$confs[$env]['search-engine'] = $searchEngine;
|
||||
}
|
||||
}
|
||||
|
||||
$app['phraseanet.configuration']->setConfigurations($confs);
|
||||
|
||||
$services = $app['phraseanet.configuration']->getServices();
|
||||
|
||||
if (!isset($services['SearchEngine'])) {
|
||||
$app['phraseanet.configuration']->resetServices('SearchEngine');
|
||||
}
|
||||
|
||||
if (!$app['phraseanet.registry']->get('GV_sphinx')) {
|
||||
|
||||
$phraseaConfiguration = $app['phraseanet.SE']->getConfigurationPanel()->getConfiguration();
|
||||
|
||||
if ($app['phraseanet.registry']->get('GV_phrasea_sort')) {
|
||||
$phraseaConfiguration['default_sort'] = $app['phraseanet.registry']->get('GV_phrasea_sort');
|
||||
}
|
||||
|
||||
$app['phraseanet.SE']->getConfigurationPanel()->saveConfiguration($phraseaConfiguration);
|
||||
|
||||
} else {
|
||||
|
||||
$sphinxConfiguration = $app['phraseanet.SE']->getConfigurationPanel()->getConfiguration();
|
||||
|
||||
if ($app['phraseanet.registry']->get('GV_sphinx_rt_port')) {
|
||||
$sphinxConfiguration['rt_port'] = $app['phraseanet.registry']->get('GV_sphinx_rt_port');
|
||||
}
|
||||
if ($app['phraseanet.registry']->get('GV_sphinx_rt_host')) {
|
||||
$sphinxConfiguration['rt_host'] = $app['phraseanet.registry']->get('GV_sphinx_rt_host');
|
||||
}
|
||||
if ($app['phraseanet.registry']->get('GV_sphinx_port')) {
|
||||
$sphinxConfiguration['port'] = $app['phraseanet.registry']->get('GV_sphinx_port');
|
||||
}
|
||||
if ($app['phraseanet.registry']->get('GV_sphinx_host')) {
|
||||
$sphinxConfiguration['host'] = $app['phraseanet.registry']->get('GV_sphinx_host');
|
||||
}
|
||||
|
||||
$app['phraseanet.SE']->getConfigurationPanel()->saveConfiguration($sphinxConfiguration);
|
||||
}
|
||||
$app['phraseanet.configuration']->setDefault('main', 'search-engine');
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user