mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-13 21:13:26 +00:00
Fix unit tests, bump to version 3.8.0 alpha 3
This commit is contained in:
@@ -59,50 +59,53 @@ class patch_3803 implements patchInterface
|
||||
*/
|
||||
public function apply(base $appbox, Application $app)
|
||||
{
|
||||
$searchEngine = $app['phraseanet.registry']->get('GV_sphinx') ? 'sphinx-search' : 'phrasea';
|
||||
$searchEngine = $app['phraseanet.registry']->get('GV_sphinx') ? 'sphinxsearch' : 'phrasea';
|
||||
|
||||
$app['phraseanet.registry']->set('GV_search_engine', $searchEngine, \registry::TYPE_ENUM);
|
||||
$confs = $app['phraseanet.configuration']->getConfigurations();
|
||||
|
||||
$phraseaConfiguration = null;
|
||||
$phraseaConfigFile = __DIR__ . '/../../../config/phrasea-engine.json';
|
||||
|
||||
if (file_exists($phraseaConfigFile)) {
|
||||
$phraseaConfiguration = json_decode(file_get_contents($phraseaConfigFile), true);
|
||||
}
|
||||
if (!is_array($phraseaConfiguration)) {
|
||||
$phraseaConfiguration = array();
|
||||
foreach ($confs as $env => $conf) {
|
||||
if (in_array($env, array('environment', 'key'))) {
|
||||
continue;
|
||||
}
|
||||
if (!isset($conf['search-engine'])) {
|
||||
$confs[$env]['search-engine'] = $searchEngine;
|
||||
}
|
||||
}
|
||||
|
||||
if ($app['phraseanet.registry']->get('GV_phrasea_sort')) {
|
||||
$phraseaConfiguration['default_sort'] = $app['phraseanet.registry']->get('GV_phrasea_sort');
|
||||
}
|
||||
|
||||
file_put_contents($phraseaConfigFile, $phraseaConfiguration);
|
||||
|
||||
$sphinxConfiguration = null;
|
||||
$sphinxConfigFile = __DIR__ . '/../../../config/sphinx-search.json';
|
||||
$app['phraseanet.configuration']->setConfigurations($confs);
|
||||
|
||||
if (file_exists($sphinxConfigFile)) {
|
||||
$sphinxConfiguration = json_decode(file_get_contents($sphinxConfigFile), true);
|
||||
}
|
||||
if (!is_array($sphinxConfiguration)) {
|
||||
$sphinxConfiguration = array();
|
||||
$services = $app['phraseanet.configuration']->getServices();
|
||||
|
||||
if (!isset($services['SearchEngine'])) {
|
||||
$app['phraseanet.configuration']->resetServices('SearchEngine');
|
||||
}
|
||||
|
||||
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')) {
|
||||
$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);
|
||||
}
|
||||
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');
|
||||
}
|
||||
|
||||
file_put_contents($sphinxConfigFile, $sphinxConfiguration);
|
||||
|
||||
return;
|
||||
}
|
||||
|
84
lib/classes/patch/3804.php
Normal file
84
lib/classes/patch/3804.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Phraseanet
|
||||
*
|
||||
* (c) 2005-2013 Alchemy
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Alchemy\Phrasea\Application;
|
||||
|
||||
class patch_3804 implements patchInterface
|
||||
{
|
||||
/**
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $release = '3.8.0.a3';
|
||||
|
||||
/**
|
||||
*
|
||||
* @var Array
|
||||
*/
|
||||
private $concern = array(base::APPLICATION_BOX);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_release()
|
||||
{
|
||||
return $this->release;
|
||||
}
|
||||
|
||||
public function require_all_upgrades()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Array
|
||||
*/
|
||||
public function concern()
|
||||
{
|
||||
return $this->concern;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param base $appbox
|
||||
*/
|
||||
public function apply(base $appbox, Application $app)
|
||||
{
|
||||
try {
|
||||
$confs = $app['phraseanet.configuration']->getConfigurations();
|
||||
|
||||
foreach ($confs as $env => $conf) {
|
||||
if (in_array($env, array('environment', 'key'))) {
|
||||
continue;
|
||||
}
|
||||
if (!isset($conf['task-manager'])) {
|
||||
$confs[$env]['task-manager'] = 'task_manager';
|
||||
}
|
||||
}
|
||||
|
||||
$app['phraseanet.configuration']->setConfigurations($confs);
|
||||
|
||||
$services = $app['phraseanet.configuration']->getServices();
|
||||
|
||||
if (!isset($services['TaskManager'])) {
|
||||
$app['phraseanet.configuration']->resetServices('TaskManager');
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user