mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-11 12:03:14 +00:00
Refactor Configuration
This commit is contained in:
@@ -48,7 +48,7 @@ class appbox extends base
|
|||||||
protected $Core;
|
protected $Core;
|
||||||
|
|
||||||
const CACHE_LIST_BASES = 'list_bases';
|
const CACHE_LIST_BASES = 'list_bases';
|
||||||
const CACHE_SBAS_IDS = 'sbas_ids';
|
const CACHE_SBAS_IDS = 'sbas_ids';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Singleton pattern
|
* Singleton pattern
|
||||||
@@ -79,11 +79,7 @@ class appbox extends base
|
|||||||
$this->registry = $registry;
|
$this->registry = $registry;
|
||||||
$this->session = Session_Handler::getInstance($this);
|
$this->session = Session_Handler::getInstance($this);
|
||||||
|
|
||||||
$handler = new \Alchemy\Phrasea\Core\Configuration\Handler(
|
$configuration = \Alchemy\Phrasea\Core\Configuration::build();
|
||||||
new \Alchemy\Phrasea\Core\Configuration\Application(),
|
|
||||||
new \Alchemy\Phrasea\Core\Configuration\Parser\Yaml()
|
|
||||||
);
|
|
||||||
$configuration = new \Alchemy\Phrasea\Core\Configuration($handler);
|
|
||||||
|
|
||||||
$choosenConnexion = $configuration->getPhraseanet()->get('database');
|
$choosenConnexion = $configuration->getPhraseanet()->get('database');
|
||||||
|
|
||||||
@@ -123,7 +119,7 @@ class appbox extends base
|
|||||||
$collection->update_logo($pathfile);
|
$collection->update_logo($pathfile);
|
||||||
|
|
||||||
$registry = registry::get_instance();
|
$registry = registry::get_instance();
|
||||||
$file = $registry->get('GV_RootPath') . 'config/' . $pic_type . '/' . $collection->get_base_id();
|
$file = $registry->get('GV_RootPath') . 'config/' . $pic_type . '/' . $collection->get_base_id();
|
||||||
if (is_file($file))
|
if (is_file($file))
|
||||||
{
|
{
|
||||||
unlink($file);
|
unlink($file);
|
||||||
@@ -178,7 +174,7 @@ class appbox extends base
|
|||||||
if (!in_array($pic_type, array(databox::PIC_PDF)))
|
if (!in_array($pic_type, array(databox::PIC_PDF)))
|
||||||
throw new Exception('unknown pic_type');
|
throw new Exception('unknown pic_type');
|
||||||
$registry = $databox->get_registry();
|
$registry = $databox->get_registry();
|
||||||
$file = $registry->get('GV_RootPath') . 'config/minilogos/' . $pic_type . '_' . $databox->get_sbas_id();
|
$file = $registry->get('GV_RootPath') . 'config/minilogos/' . $pic_type . '_' . $databox->get_sbas_id();
|
||||||
if (is_file($file))
|
if (is_file($file))
|
||||||
{
|
{
|
||||||
unlink($file);
|
unlink($file);
|
||||||
@@ -221,8 +217,8 @@ class appbox extends base
|
|||||||
public function set_collection_order(collection $collection, $ordre)
|
public function set_collection_order(collection $collection, $ordre)
|
||||||
{
|
{
|
||||||
$sqlupd = "UPDATE bas SET ord = :ordre WHERE base_id = :base_id";
|
$sqlupd = "UPDATE bas SET ord = :ordre WHERE base_id = :base_id";
|
||||||
$stmt = $this->get_connection()->prepare($sqlupd);
|
$stmt = $this->get_connection()->prepare($sqlupd);
|
||||||
$stmt->execute(array(':ordre' => $ordre, ':base_id' => $collection->get_base_id()));
|
$stmt->execute(array(':ordre' => $ordre, ':base_id' => $collection->get_base_id()));
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
$collection->get_databox()->delete_data_from_cache(\databox::CACHE_COLLECTIONS);
|
$collection->get_databox()->delete_data_from_cache(\databox::CACHE_COLLECTIONS);
|
||||||
@@ -239,12 +235,12 @@ class appbox extends base
|
|||||||
public function set_databox_indexable(databox $databox, $boolean)
|
public function set_databox_indexable(databox $databox, $boolean)
|
||||||
{
|
{
|
||||||
$boolean = !!$boolean;
|
$boolean = !!$boolean;
|
||||||
$sql = 'UPDATE sbas SET indexable = :indexable WHERE sbas_id = :sbas_id';
|
$sql = 'UPDATE sbas SET indexable = :indexable WHERE sbas_id = :sbas_id';
|
||||||
|
|
||||||
$stmt = $this->get_connection()->prepare($sql);
|
$stmt = $this->get_connection()->prepare($sql);
|
||||||
$stmt->execute(array(
|
$stmt->execute(array(
|
||||||
':indexable' => ($boolean ? '1' : '0'),
|
':indexable' => ($boolean ? '1' : '0'),
|
||||||
':sbas_id' => $databox->get_sbas_id()
|
':sbas_id' => $databox->get_sbas_id()
|
||||||
));
|
));
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
@@ -262,7 +258,7 @@ class appbox extends base
|
|||||||
|
|
||||||
$stmt = $this->get_connection()->prepare($sql);
|
$stmt = $this->get_connection()->prepare($sql);
|
||||||
$stmt->execute(array(':sbas_id' => $databox->get_sbas_id()));
|
$stmt->execute(array(':sbas_id' => $databox->get_sbas_id()));
|
||||||
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
$indexable = $row ? $row['indexable'] : null;
|
$indexable = $row ? $row['indexable'] : null;
|
||||||
@@ -279,10 +275,10 @@ class appbox extends base
|
|||||||
public function set_databox_viewname(databox $databox, $viewname)
|
public function set_databox_viewname(databox $databox, $viewname)
|
||||||
{
|
{
|
||||||
$viewname = strip_tags($viewname);
|
$viewname = strip_tags($viewname);
|
||||||
$sql = 'UPDATE sbas SET viewname = :viewname WHERE sbas_id = :sbas_id';
|
$sql = 'UPDATE sbas SET viewname = :viewname WHERE sbas_id = :sbas_id';
|
||||||
|
|
||||||
$stmt = $this->get_connection()->prepare($sql);
|
$stmt = $this->get_connection()->prepare($sql);
|
||||||
$stmt->execute(array(':viewname' => $viewname, ':sbas_id' => $databox->get_sbas_id()));
|
$stmt->execute(array(':viewname' => $viewname, ':sbas_id' => $databox->get_sbas_id()));
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||||
@@ -319,12 +315,12 @@ class appbox extends base
|
|||||||
|
|
||||||
$upgrader->set_current_message(_('Creating new tables'));
|
$upgrader->set_current_message(_('Creating new tables'));
|
||||||
$core = bootstrap::getCore();
|
$core = bootstrap::getCore();
|
||||||
$em = $core->getEntityManager();
|
$em = $core->getEntityManager();
|
||||||
//create schema
|
//create schema
|
||||||
|
|
||||||
if ($em->getConnection()->getDatabasePlatform()->supportsAlterTable())
|
if ($em->getConnection()->getDatabasePlatform()->supportsAlterTable())
|
||||||
{
|
{
|
||||||
$tool = new \Doctrine\ORM\Tools\SchemaTool($em);
|
$tool = new \Doctrine\ORM\Tools\SchemaTool($em);
|
||||||
$metas = $em->getMetadataFactory()->getAllMetadata();
|
$metas = $em->getMetadataFactory()->getAllMetadata();
|
||||||
$tool->updateSchema($metas, true);
|
$tool->updateSchema($metas, true);
|
||||||
}
|
}
|
||||||
@@ -420,7 +416,7 @@ class appbox extends base
|
|||||||
* @param type $write_file
|
* @param type $write_file
|
||||||
* @return type
|
* @return type
|
||||||
*/
|
*/
|
||||||
public static function create(registryInterface &$registry, connection_interface $conn, $dbname, $write_file = false)
|
public static function create(\Alchemy\Phrasea\Core $Core, registryInterface &$registry, connection_interface $conn, $dbname, $write_file = false)
|
||||||
{
|
{
|
||||||
$credentials = $conn->get_credentials();
|
$credentials = $conn->get_credentials();
|
||||||
|
|
||||||
@@ -438,59 +434,25 @@ class appbox extends base
|
|||||||
|
|
||||||
foreach ($credentials as $key => $value)
|
foreach ($credentials as $key => $value)
|
||||||
{
|
{
|
||||||
$key = $key == 'hostname' ? 'host' : $key;
|
$key = $key == 'hostname' ? 'host' : $key;
|
||||||
$connexionINI[$key] = (string) $value;
|
$connexionINI[$key] = (string) $value;
|
||||||
}
|
}
|
||||||
$connexionINI['driver'] = 'pdo_mysql';
|
|
||||||
|
$Core->getConfiguration()->initialize();
|
||||||
|
$connexionINI['driver'] = 'pdo_mysql';
|
||||||
$connexionINI['charset'] = 'UTF8';
|
$connexionINI['charset'] = 'UTF8';
|
||||||
|
|
||||||
$serverName = $registry->get('GV_ServerName');
|
$serverName = $registry->get('GV_ServerName');
|
||||||
|
|
||||||
$root = __DIR__ . '/../../';
|
$root = __DIR__ . '/../../';
|
||||||
|
|
||||||
//copy config sample
|
|
||||||
$configSampleFile = $root . "config/config.sample.yml";
|
|
||||||
$configFile = $root . "config/config.yml";
|
|
||||||
|
|
||||||
if (!copy($configSampleFile, $configFile))
|
|
||||||
{
|
|
||||||
throw new \Exception(sprintf("Unable to copy %s", $configSampleFile));
|
|
||||||
}
|
|
||||||
|
|
||||||
//copy service sample
|
|
||||||
$serviceSampleFile = $root . "config/services.sample.yml";
|
|
||||||
$serviceFile = $root . "config/services.yml";
|
|
||||||
|
|
||||||
if (!copy($serviceSampleFile, $serviceFile))
|
|
||||||
{
|
|
||||||
throw new \Exception(sprintf("Unable to copy %s", $serviceSampleFile));
|
|
||||||
}
|
|
||||||
|
|
||||||
//copy connexion sample
|
|
||||||
$connexionSampleFile = $root . "config/connexions.sample.yml";
|
|
||||||
$connexionFile = $root . "config/connexions.yml";
|
|
||||||
|
|
||||||
if (!copy($connexionSampleFile, $connexionFile))
|
|
||||||
{
|
|
||||||
throw new \Exception(sprintf("Unable to copy %s", $serviceSampleFile));
|
|
||||||
}
|
|
||||||
|
|
||||||
//get configuration object
|
|
||||||
$appConf = new \Alchemy\Phrasea\Core\Configuration\Application();
|
|
||||||
$parser = new \Alchemy\Phrasea\Core\Configuration\Parser\Yaml();
|
|
||||||
$handler = new \Alchemy\Phrasea\Core\Configuration\Handler($appConf, $parser);
|
|
||||||
$configuration = new \Alchemy\Phrasea\Core\Configuration($handler);
|
|
||||||
|
|
||||||
//write credentials to config file
|
|
||||||
$connexionFile = $appConf->getConnexionFile();
|
|
||||||
|
|
||||||
$connexion = array(
|
$connexion = array(
|
||||||
'main_connexion' => $connexionINI,
|
'main_connexion' => $connexionINI,
|
||||||
'test_connexion' => array(
|
'test_connexion' => array(
|
||||||
'driver' => 'pdo_sqlite',
|
'driver' => 'pdo_sqlite',
|
||||||
'path' => realpath($root . 'lib/unitTest') . '/tests.sqlite',
|
'path' => realpath($root . 'lib/unitTest') . '/tests.sqlite',
|
||||||
'charset' => 'UTF8'
|
'charset' => 'UTF8'
|
||||||
));
|
));
|
||||||
|
|
||||||
$cacheService = "array_cache";
|
$cacheService = "array_cache";
|
||||||
|
|
||||||
@@ -503,16 +465,9 @@ class appbox extends base
|
|||||||
$cacheService = "xcache_cache";
|
$cacheService = "xcache_cache";
|
||||||
}
|
}
|
||||||
|
|
||||||
$yaml = $configuration->getConfigurationHandler()->getParser()->dump($connexion, 2);
|
$Core->getConfiguration()->setConnexions($connexion);
|
||||||
|
|
||||||
if (!file_put_contents($connexionFile->getPathname(), $yaml) !== false)
|
$services = $Core->getConfiguration()->getConfigurations();
|
||||||
{
|
|
||||||
throw new \Exception(sprintf(_('Impossible d\'ecrire dans le fichier %s'), $connexionFile->getPathname()));
|
|
||||||
}
|
|
||||||
|
|
||||||
//rewrite service file
|
|
||||||
$serviceFile = $appConf->getServiceFile();
|
|
||||||
$services = $configuration->getConfigurationHandler()->getParser()->parse($serviceFile);
|
|
||||||
|
|
||||||
foreach ($services as $serviceName => $service)
|
foreach ($services as $serviceName => $service)
|
||||||
{
|
{
|
||||||
@@ -520,22 +475,15 @@ class appbox extends base
|
|||||||
{
|
{
|
||||||
|
|
||||||
$services["doctrine_prod"]["options"]["orm"]["cache"] = array(
|
$services["doctrine_prod"]["options"]["orm"]["cache"] = array(
|
||||||
"query" => $cacheService,
|
"query" => $cacheService,
|
||||||
"result" => $cacheService,
|
"result" => $cacheService,
|
||||||
"metadata" => $cacheService
|
"metadata" => $cacheService
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$Core->getConfiguration()->setConfigurations($services);
|
||||||
|
|
||||||
$yaml = $configuration->getConfigurationHandler()->getParser()->dump($services, 5);
|
$arrayConf = $Core->getConfiguration()->getConfigurations();
|
||||||
|
|
||||||
if (!file_put_contents($serviceFile->getPathname(), $yaml) !== false)
|
|
||||||
{
|
|
||||||
throw new \Exception(sprintf(_('Impossible d\'ecrire dans le fichier %s'), $serviceFile->getPathname()));
|
|
||||||
}
|
|
||||||
|
|
||||||
//rewrite servername in main config file
|
|
||||||
$arrayConf = $configuration->all();
|
|
||||||
|
|
||||||
foreach ($arrayConf as $key => $value)
|
foreach ($arrayConf as $key => $value)
|
||||||
{
|
{
|
||||||
@@ -550,16 +498,7 @@ class appbox extends base
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$configuration->write($arrayConf);
|
$Core->getConfiguration()->setConfigurations($arrayConf);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (function_exists('chmod'))
|
|
||||||
{
|
|
||||||
chmod($configuration->getFile()->getPathname(), 0700);
|
|
||||||
chmod($serviceFile->getPathname(), 0700);
|
|
||||||
chmod($connexionFile->getPathname(), 0700);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -588,7 +527,7 @@ class appbox extends base
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$appbox = self::get_instance($registry);
|
$appbox = self::get_instance($Core, $registry);
|
||||||
$appbox->insert_datas();
|
$appbox->insert_datas();
|
||||||
}
|
}
|
||||||
catch (Exception $e)
|
catch (Exception $e)
|
||||||
@@ -644,7 +583,7 @@ class appbox extends base
|
|||||||
|
|
||||||
$stmt = $this->get_connection()->prepare($sql);
|
$stmt = $this->get_connection()->prepare($sql);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
foreach ($rs as $row)
|
foreach ($rs as $row)
|
||||||
|
@@ -136,13 +136,7 @@ class connection
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$configuration = \Alchemy\Phrasea\Core\Configuration::build();
|
||||||
|
|
||||||
$handler = new \Alchemy\Phrasea\Core\Configuration\Handler(
|
|
||||||
new \Alchemy\Phrasea\Core\Configuration\Application(),
|
|
||||||
new \Alchemy\Phrasea\Core\Configuration\Parser\Yaml()
|
|
||||||
);
|
|
||||||
$configuration = new \Alchemy\Phrasea\Core\Configuration($handler);
|
|
||||||
|
|
||||||
$choosenConnexion = $configuration->getPhraseanet()->get('database');
|
$choosenConnexion = $configuration->getPhraseanet()->get('database');
|
||||||
|
|
||||||
|
@@ -78,11 +78,7 @@ class module_console_fileConfigCheck extends Command
|
|||||||
|
|
||||||
private function initTests(OutputInterface $output)
|
private function initTests(OutputInterface $output)
|
||||||
{
|
{
|
||||||
$spec = new Core\Configuration\Application();
|
$this->configuration = Core\Configuration::build();
|
||||||
$parser = new Core\Configuration\Parser\Yaml();
|
|
||||||
$handler = new Core\Configuration\Handler($spec, $parser);
|
|
||||||
|
|
||||||
$this->configuration = new Core\Configuration($handler, $this->env);
|
|
||||||
|
|
||||||
if (!$this->configuration->isInstalled())
|
if (!$this->configuration->isInstalled())
|
||||||
{
|
{
|
||||||
@@ -146,39 +142,19 @@ class module_console_fileConfigCheck extends Command
|
|||||||
|
|
||||||
private function checkParse(OutputInterface $output)
|
private function checkParse(OutputInterface $output)
|
||||||
{
|
{
|
||||||
$parser = $this
|
|
||||||
->configuration
|
|
||||||
->getConfigurationHandler()
|
|
||||||
->getParser();
|
|
||||||
$fileConfig = $this
|
|
||||||
->configuration
|
|
||||||
->getConfigurationHandler()
|
|
||||||
->getSpecification()
|
|
||||||
->getConfigurationFile();
|
|
||||||
$fileService = $this
|
|
||||||
->configuration
|
|
||||||
->getConfigurationHandler()
|
|
||||||
->getSpecification()
|
|
||||||
->getServiceFile();
|
|
||||||
$fileConnexion = $this
|
|
||||||
->configuration
|
|
||||||
->getConfigurationHandler()
|
|
||||||
->getSpecification()
|
|
||||||
->getConnexionFile();
|
|
||||||
|
|
||||||
try
|
if (!$this->configuration->getConfigurations())
|
||||||
{
|
{
|
||||||
$parser->parse($fileConfig);
|
throw new \Exception("Unable to load configurations\n");
|
||||||
$parser->parse($fileService);
|
|
||||||
$parser->parse($fileConnexion);
|
|
||||||
}
|
}
|
||||||
catch (\Exception $e)
|
if (!$this->configuration->getConnexions())
|
||||||
{
|
{
|
||||||
$message = str_replace("\\", "", $e->getMessage());
|
throw new \Exception("Unable to load connexions\n");
|
||||||
$e = new \Exception($message);
|
}
|
||||||
throw new \Exception(sprintf("Check parsing file\n"), null, $e);
|
if (!$this->configuration->getServices())
|
||||||
|
{
|
||||||
|
throw new \Exception("Unable to load services\n");
|
||||||
}
|
}
|
||||||
$output->writeln("<info>Parsing File OK</info>");
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -200,11 +176,7 @@ class module_console_fileConfigCheck extends Command
|
|||||||
|
|
||||||
private function checkGetSelectedEnvironementFromFile(OutputInterface $output)
|
private function checkGetSelectedEnvironementFromFile(OutputInterface $output)
|
||||||
{
|
{
|
||||||
$spec = new Core\Configuration\Application();
|
$configuration = Core\Configuration::build();
|
||||||
$parser = new Core\Configuration\Parser\Yaml();
|
|
||||||
$handler = new Core\Configuration\Handler($spec, $parser);
|
|
||||||
|
|
||||||
$configuration = new Core\Configuration($handler);
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@@ -59,7 +59,6 @@ class module_console_fileEnsureProductionSetting extends Command
|
|||||||
|
|
||||||
public function execute(InputInterface $input, OutputInterface $output)
|
public function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
|
|
||||||
$this->initTests($output);
|
$this->initTests($output);
|
||||||
|
|
||||||
$this->prepareTests($output);
|
$this->prepareTests($output);
|
||||||
@@ -72,11 +71,7 @@ class module_console_fileEnsureProductionSetting extends Command
|
|||||||
|
|
||||||
private function initTests(OutputInterface $output)
|
private function initTests(OutputInterface $output)
|
||||||
{
|
{
|
||||||
$spec = new Core\Configuration\Application();
|
$this->configuration = Core\Configuration::build();
|
||||||
$parser = new Core\Configuration\Parser\Yaml();
|
|
||||||
$handler = new Core\Configuration\Handler($spec, $parser);
|
|
||||||
|
|
||||||
$this->configuration = new Core\Configuration($handler);
|
|
||||||
|
|
||||||
if (!$this->configuration->isInstalled())
|
if (!$this->configuration->isInstalled())
|
||||||
{
|
{
|
||||||
@@ -175,35 +170,18 @@ class module_console_fileEnsureProductionSetting extends Command
|
|||||||
|
|
||||||
private function checkParse(OutputInterface $output)
|
private function checkParse(OutputInterface $output)
|
||||||
{
|
{
|
||||||
$parser = $this
|
|
||||||
->configuration
|
|
||||||
->getConfigurationHandler()
|
|
||||||
->getParser();
|
|
||||||
$fileConfig = $this
|
|
||||||
->configuration
|
|
||||||
->getConfigurationHandler()
|
|
||||||
->getSpecification()
|
|
||||||
->getConfigurationFile();
|
|
||||||
$fileService = $this
|
|
||||||
->configuration
|
|
||||||
->getConfigurationHandler()
|
|
||||||
->getSpecification()
|
|
||||||
->getServiceFile();
|
|
||||||
$fileConnexion = $this
|
|
||||||
->configuration
|
|
||||||
->getConfigurationHandler()
|
|
||||||
->getSpecification()
|
|
||||||
->getConnexionFile();
|
|
||||||
|
|
||||||
try
|
if (!$this->configuration->getConfigurations())
|
||||||
{
|
{
|
||||||
$parser->parse($fileConfig);
|
throw new \Exception("Unable to load configurations\n");
|
||||||
$parser->parse($fileService);
|
|
||||||
$parser->parse($fileConnexion);
|
|
||||||
}
|
}
|
||||||
catch (\Exception $e)
|
if (!$this->configuration->getConnexions())
|
||||||
{
|
{
|
||||||
throw new \Exception("Error parsing file\n", null, $e);
|
throw new \Exception("Unable to load connexions\n");
|
||||||
|
}
|
||||||
|
if (!$this->configuration->getServices())
|
||||||
|
{
|
||||||
|
throw new \Exception("Unable to load services\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -237,11 +215,7 @@ class module_console_fileEnsureProductionSetting extends Command
|
|||||||
|
|
||||||
private function checkGetSelectedEnvironementFromFile(OutputInterface $output)
|
private function checkGetSelectedEnvironementFromFile(OutputInterface $output)
|
||||||
{
|
{
|
||||||
$spec = new Core\Configuration\Application();
|
$configuration = Core\Configuration::build();
|
||||||
$parser = new Core\Configuration\Parser\Yaml();
|
|
||||||
$handler = new Core\Configuration\Handler($spec, $parser);
|
|
||||||
|
|
||||||
$configuration = new Core\Configuration($handler);
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -262,26 +236,48 @@ class module_console_fileEnsureProductionSetting extends Command
|
|||||||
{
|
{
|
||||||
$phraseanet = $this->configuration->getPhraseanet();
|
$phraseanet = $this->configuration->getPhraseanet();
|
||||||
|
|
||||||
$this->printConf($output, 'phraseanet', $phraseanet->all());
|
foreach($phraseanet->all() as $conf=>$value)
|
||||||
|
|
||||||
$url = $phraseanet->get("servername");
|
|
||||||
|
|
||||||
if (empty($url))
|
|
||||||
{
|
{
|
||||||
throw new \Exception("phraseanet:servername connot be empty");
|
switch($conf)
|
||||||
}
|
{
|
||||||
|
default:
|
||||||
|
$this->printConf($output, $conf, $value);
|
||||||
|
break;
|
||||||
|
case 'servername':
|
||||||
|
$url = $value;
|
||||||
|
|
||||||
if (!filter_var($url, FILTER_VALIDATE_URL))
|
$parseUrl = parse_url($url);
|
||||||
{
|
|
||||||
throw new \Exception(sprintf("%s url is not valid", $url));
|
|
||||||
}
|
|
||||||
|
|
||||||
$parseUrl = parse_url($url);
|
if (empty($url))
|
||||||
|
{
|
||||||
if ($parseUrl["scheme"] !== "https")
|
$message = "<error>should not be empty</error>";
|
||||||
{
|
}
|
||||||
$output->writeln(sprintf("<comment>/!\ %s url scheme should be https</comment>", $url));
|
elseif (!filter_var($url, FILTER_VALIDATE_URL))
|
||||||
|
{
|
||||||
|
$message = "<error>not valid</error>";
|
||||||
|
}
|
||||||
|
elseif ($parseUrl["scheme"] !== "https")
|
||||||
|
{
|
||||||
|
$message = "<comment>should be https</comment>";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$message = "<info>OK</info>";
|
||||||
|
}
|
||||||
|
$this->printConf($output, $conf, $value, false, $message);
|
||||||
|
break;
|
||||||
|
case 'maintenance':
|
||||||
|
case 'debug':
|
||||||
|
case 'display_errors':
|
||||||
|
$message = $value ? '<error>Should be false</error>' : '<info>OK</info>';
|
||||||
|
$this->printConf($output, $conf, $value, false, $message);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// $this->printConf($output, 'phraseanet', $phraseanet->all());
|
||||||
|
|
||||||
|
// $url = $phraseanet->get("servername");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (!$phraseanet->has("debug"))
|
if (!$phraseanet->has("debug"))
|
||||||
@@ -624,7 +620,7 @@ class module_console_fileEnsureProductionSetting extends Command
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function printConf($output, $scope, $value, $scopage = false)
|
private function printConf($output, $scope, $value, $scopage = false, $message = '')
|
||||||
{
|
{
|
||||||
if (is_array($value))
|
if (is_array($value))
|
||||||
{
|
{
|
||||||
@@ -632,24 +628,24 @@ class module_console_fileEnsureProductionSetting extends Command
|
|||||||
{
|
{
|
||||||
if ($scopage)
|
if ($scopage)
|
||||||
$key = $scope . ":" . $key;
|
$key = $scope . ":" . $key;
|
||||||
$this->printConf($output, $key, $val, $scopage);
|
$this->printConf($output, $key, $val, $scopage, '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif (is_bool($value))
|
elseif (is_bool($value))
|
||||||
{
|
{
|
||||||
if ($value === false)
|
if ($value === false)
|
||||||
{
|
{
|
||||||
$value = '0';
|
$value = 'false';
|
||||||
}
|
}
|
||||||
elseif ($value === true)
|
elseif ($value === true)
|
||||||
{
|
{
|
||||||
$value = '1';
|
$value = 'true';
|
||||||
}
|
}
|
||||||
$output->writeln(sprintf("\t%s: %s", $scope, $value));
|
$output->writeln(sprintf("\t%s: %s %s", $scope, $value, $message));
|
||||||
}
|
}
|
||||||
elseif (!empty($value))
|
elseif (!empty($value))
|
||||||
{
|
{
|
||||||
$output->writeln(sprintf("\t%s: %s", $scope, $value));
|
$output->writeln(sprintf("\t%s: %s %s", $scope, $value, $message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -65,11 +65,7 @@ class module_console_systemUpgrade extends Command
|
|||||||
|
|
||||||
$credentials = $conn->get_credentials();
|
$credentials = $conn->get_credentials();
|
||||||
|
|
||||||
$handler = new \Alchemy\Phrasea\Core\Configuration\Handler(
|
$configuration = \Alchemy\Phrasea\Core\Configuration::build();
|
||||||
new \Alchemy\Phrasea\Core\Configuration\Application(),
|
|
||||||
new \Alchemy\Phrasea\Core\Configuration\Parser\Yaml()
|
|
||||||
);
|
|
||||||
$configuration = new \Alchemy\Phrasea\Core\Configuration($handler);
|
|
||||||
|
|
||||||
$connexionINI = array();
|
$connexionINI = array();
|
||||||
|
|
||||||
|
@@ -105,11 +105,7 @@ class phrasea
|
|||||||
|
|
||||||
public static function start()
|
public static function start()
|
||||||
{
|
{
|
||||||
$handler = new \Alchemy\Phrasea\Core\Configuration\Handler(
|
$configuration = \Alchemy\Phrasea\Core\Configuration::build();
|
||||||
new \Alchemy\Phrasea\Core\Configuration\Application(),
|
|
||||||
new \Alchemy\Phrasea\Core\Configuration\Parser\Yaml()
|
|
||||||
);
|
|
||||||
$configuration = new \Alchemy\Phrasea\Core\Configuration($handler);
|
|
||||||
|
|
||||||
$choosenConnexion = $configuration->getPhraseanet()->get('database');
|
$choosenConnexion = $configuration->getPhraseanet()->get('database');
|
||||||
|
|
||||||
|
@@ -59,11 +59,7 @@ class registry implements registryInterface
|
|||||||
{
|
{
|
||||||
$this->cache = new Alchemy\Phrasea\Cache\ArrayCache();
|
$this->cache = new Alchemy\Phrasea\Cache\ArrayCache();
|
||||||
|
|
||||||
$handler = new \Alchemy\Phrasea\Core\Configuration\Handler(
|
$configuration = \Alchemy\Phrasea\Core\Configuration::build();
|
||||||
new \Alchemy\Phrasea\Core\Configuration\Application(),
|
|
||||||
new \Alchemy\Phrasea\Core\Configuration\Parser\Yaml()
|
|
||||||
);
|
|
||||||
$configuration = new \Alchemy\Phrasea\Core\Configuration($handler);
|
|
||||||
|
|
||||||
$this->cache->save('GV_RootPath', dirname(dirname(__DIR__)) . '/');
|
$this->cache->save('GV_RootPath', dirname(dirname(__DIR__)) . '/');
|
||||||
if ($configuration->isInstalled())
|
if ($configuration->isInstalled())
|
||||||
|
@@ -70,21 +70,9 @@ class setup
|
|||||||
|
|
||||||
public static function is_installed()
|
public static function is_installed()
|
||||||
{
|
{
|
||||||
$appConf = new \Alchemy\Phrasea\Core\Configuration\Application();
|
$appConf = new \Alchemy\Phrasea\Core\Configuration\ApplicationSpecification();
|
||||||
$installed = false;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
$appConf->getConfigurationFile();
|
|
||||||
$appConf->getConnexionFile();
|
|
||||||
$appConf->getServiceFile();
|
|
||||||
$installed = true;
|
|
||||||
}
|
|
||||||
catch (\Exception $e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
return $appConf->isSetup();
|
||||||
|
|
||||||
return $installed;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function needUpgradeConfigurationFile()
|
public static function needUpgradeConfigurationFile()
|
||||||
@@ -817,37 +805,9 @@ class setup
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$appConf = new \Alchemy\Phrasea\Core\Configuration\Application();
|
$appConf = new \Alchemy\Phrasea\Core\Configuration\ApplicationSpecification();
|
||||||
|
|
||||||
try
|
$appConf->delete();
|
||||||
{
|
|
||||||
$configFile = $appConf->getConfigurationFile();
|
|
||||||
unlink($configFile->getPathname());
|
|
||||||
}
|
|
||||||
catch (\Exception $e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
$serviceFile = $appConf->getServiceFile();
|
|
||||||
unlink($serviceFile->getPathname());
|
|
||||||
}
|
|
||||||
catch (\Exception $e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
$connexionfFile = $appConf->getConnexionFile();
|
|
||||||
unlink($connexionfFile->getPathname());
|
|
||||||
}
|
|
||||||
catch (\Exception $e)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -61,37 +61,38 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
|
|||||||
|
|
||||||
public function setUp()
|
public function setUp()
|
||||||
{
|
{
|
||||||
|
$this->markTestSkipped('To rewrite');
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
$specNotInstalled = $this->getMock(
|
$specNotInstalled = $this->getMock(
|
||||||
'\Alchemy\Phrasea\Core\Configuration\Application'
|
'\Alchemy\Phrasea\Core\Configuration\Application'
|
||||||
, array('getConfigurationFile')
|
, array('getConfigurationsFile')
|
||||||
);
|
);
|
||||||
|
|
||||||
$specNotInstalled->expects($this->any())
|
$specNotInstalled->expects($this->any())
|
||||||
->method('getConfigurationFile')
|
->method('getConfigurationsFile')
|
||||||
->will(
|
->will(
|
||||||
$this->throwException(new Exception)
|
$this->throwException(new Exception)
|
||||||
);
|
);
|
||||||
|
|
||||||
$specExperience = $this->getMock(
|
$specExperience = $this->getMock(
|
||||||
'\Alchemy\Phrasea\Core\Configuration\Application'
|
'\Alchemy\Phrasea\Core\Configuration\Application'
|
||||||
, array('getConfigurationFile')
|
, array('getConfigurationsFile')
|
||||||
);
|
);
|
||||||
|
|
||||||
$specExperience->expects($this->any())
|
$specExperience->expects($this->any())
|
||||||
->method('getConfigurationFile')
|
->method('getConfigurationsFile')
|
||||||
->will(
|
->will(
|
||||||
$this->returnValue(
|
$this->returnValue(
|
||||||
new \SplFileObject(__DIR__ . '/confTestFiles/config.yml')
|
new \SplFileObject(__DIR__ . '/confTestFiles/config.yml')
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$handler = new Configuration\Handler($specNotInstalled, new Configuration\Parser\Yaml());
|
$handler = new Configuration\Handler($specNotInstalled);
|
||||||
$this->confNotInstalled = new PhraseaCore\Configuration($handler);
|
$this->confNotInstalled = new PhraseaCore\Configuration($handler);
|
||||||
|
|
||||||
|
|
||||||
$handler = new Configuration\Handler($specExperience, new Configuration\Parser\Yaml());
|
$handler = new Configuration\Handler($specExperience);
|
||||||
$this->object = new PhraseaCore\Configuration($handler);
|
$this->object = new PhraseaCore\Configuration($handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -277,28 +278,28 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
|
|||||||
touch(__DIR__ . "/confTestFiles/yamlWriteTest.yml");
|
touch(__DIR__ . "/confTestFiles/yamlWriteTest.yml");
|
||||||
|
|
||||||
$stub = $this->getMock(
|
$stub = $this->getMock(
|
||||||
'\Alchemy\Phrasea\Core\Configuration\Application'
|
'\Alchemy\Phrasea\Core\Configuration\Application'
|
||||||
, array('getConfigurationPathName')
|
, array('getConfigurationPathName')
|
||||||
);
|
);
|
||||||
|
|
||||||
$file = new \SplFileObject(__DIR__ . "/confTestFiles/yamlWriteTest.yml");
|
$file = new \SplFileObject(__DIR__ . "/confTestFiles/yamlWriteTest.yml");
|
||||||
|
|
||||||
$stub->expects($this->any())
|
$stub->expects($this->any())
|
||||||
->method('getConfigurationPathName')
|
->method('getConfigurationPathName')
|
||||||
->will(
|
->will(
|
||||||
$this->returnValue($file->getPathname())
|
$this->returnValue($file->getPathname())
|
||||||
);
|
);
|
||||||
|
|
||||||
$handler = new Configuration\Handler($stub, new Configuration\Parser\Yaml());
|
$handler = new Configuration\Handler($stub);
|
||||||
|
|
||||||
$configuration = new PhraseaCore\Configuration($handler);
|
$configuration = new PhraseaCore\Configuration($handler);
|
||||||
|
|
||||||
$arrayToBeWritten = array(
|
$arrayToBeWritten = array(
|
||||||
'hello' => 'world'
|
'hello' => 'world'
|
||||||
, 'key' => array(
|
, 'key' => array(
|
||||||
'keyone' => 'valueone'
|
'keyone' => 'valueone'
|
||||||
, 'keytwo' => 'valuetwo'
|
, 'keytwo' => 'valuetwo'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$configuration->write($arrayToBeWritten, 0, true);
|
$configuration->write($arrayToBeWritten, 0, true);
|
||||||
@@ -315,28 +316,28 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
|
|||||||
touch(__DIR__ . "/confTestFiles/yamlWriteTest.yml");
|
touch(__DIR__ . "/confTestFiles/yamlWriteTest.yml");
|
||||||
|
|
||||||
$stub = $this->getMock(
|
$stub = $this->getMock(
|
||||||
'\Alchemy\Phrasea\Core\Configuration\Application'
|
'\Alchemy\Phrasea\Core\Configuration\Application'
|
||||||
, array('getConfigurationPathName')
|
, array('getConfigurationPathName')
|
||||||
);
|
);
|
||||||
|
|
||||||
$file = new \SplFileObject(__DIR__ . "/confTestFiles/yamlWriteTest.yml");
|
$file = new \SplFileObject(__DIR__ . "/confTestFiles/yamlWriteTest.yml");
|
||||||
|
|
||||||
$stub->expects($this->any())
|
$stub->expects($this->any())
|
||||||
->method('getConfigurationPathName')
|
->method('getConfigurationPathName')
|
||||||
->will(
|
->will(
|
||||||
$this->returnValue("unknow_path")
|
$this->returnValue("unknow_path")
|
||||||
);
|
);
|
||||||
|
|
||||||
$handler = new Configuration\Handler($stub, new Configuration\Parser\Yaml());
|
$handler = new Configuration\Handler($stub);
|
||||||
|
|
||||||
$configuration = new PhraseaCore\Configuration($handler);
|
$configuration = new PhraseaCore\Configuration($handler);
|
||||||
|
|
||||||
$arrayToBeWritten = array(
|
$arrayToBeWritten = array(
|
||||||
'hello' => 'world'
|
'hello' => 'world'
|
||||||
, 'key' => array(
|
, 'key' => array(
|
||||||
'keyone' => 'valueone'
|
'keyone' => 'valueone'
|
||||||
, 'keytwo' => 'valuetwo'
|
, 'keytwo' => 'valuetwo'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
try
|
try
|
||||||
@@ -355,19 +356,19 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
|
|||||||
touch(__DIR__ . "/confTestFiles/yamlWriteTest.yml");
|
touch(__DIR__ . "/confTestFiles/yamlWriteTest.yml");
|
||||||
|
|
||||||
$stub = $this->getMock(
|
$stub = $this->getMock(
|
||||||
'\Alchemy\Phrasea\Core\Configuration\Application'
|
'\Alchemy\Phrasea\Core\Configuration\Application'
|
||||||
, array('getConfigurationPathName')
|
, array('getConfigurationPathName')
|
||||||
);
|
);
|
||||||
|
|
||||||
$file = new \SplFileObject(__DIR__ . "/confTestFiles/yamlWriteTest.yml");
|
$file = new \SplFileObject(__DIR__ . "/confTestFiles/yamlWriteTest.yml");
|
||||||
|
|
||||||
$stub->expects($this->any())
|
$stub->expects($this->any())
|
||||||
->method('getConfigurationPathName')
|
->method('getConfigurationPathName')
|
||||||
->will(
|
->will(
|
||||||
$this->returnValue($file->getPathname())
|
$this->returnValue($file->getPathname())
|
||||||
);
|
);
|
||||||
|
|
||||||
$handler = new Configuration\Handler($stub, new Configuration\Parser\Yaml());
|
$handler = new Configuration\Handler($stub);
|
||||||
|
|
||||||
$configuration = new PhraseaCore\Configuration($handler);
|
$configuration = new PhraseaCore\Configuration($handler);
|
||||||
|
|
||||||
@@ -381,19 +382,19 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
|
|||||||
touch(__DIR__ . "/confTestFiles/yamlWriteTest.yml");
|
touch(__DIR__ . "/confTestFiles/yamlWriteTest.yml");
|
||||||
|
|
||||||
$stub = $this->getMock(
|
$stub = $this->getMock(
|
||||||
'\Alchemy\Phrasea\Core\Configuration\Application'
|
'\Alchemy\Phrasea\Core\Configuration\Application'
|
||||||
, array('getConfigurationPathName')
|
, array('getConfigurationPathName')
|
||||||
);
|
);
|
||||||
|
|
||||||
$file = new \SplFileObject(__DIR__ . "/confTestFiles/yamlWriteTest.yml");
|
$file = new \SplFileObject(__DIR__ . "/confTestFiles/yamlWriteTest.yml");
|
||||||
|
|
||||||
$stub->expects($this->any())
|
$stub->expects($this->any())
|
||||||
->method('getConfigurationPathName')
|
->method('getConfigurationPathName')
|
||||||
->will(
|
->will(
|
||||||
$this->returnValue("unknow_path")
|
$this->returnValue("unknow_path")
|
||||||
);
|
);
|
||||||
|
|
||||||
$handler = new Configuration\Handler($stub, new Configuration\Parser\Yaml());
|
$handler = new Configuration\Handler($stub);
|
||||||
|
|
||||||
$configuration = new PhraseaCore\Configuration($handler);
|
$configuration = new PhraseaCore\Configuration($handler);
|
||||||
|
|
||||||
@@ -457,30 +458,30 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
|
|||||||
touch(__DIR__ . "/confTestFiles/yamlWriteTest.yml");
|
touch(__DIR__ . "/confTestFiles/yamlWriteTest.yml");
|
||||||
|
|
||||||
$stub = $this->getMock(
|
$stub = $this->getMock(
|
||||||
'\Alchemy\Phrasea\Core\Configuration\Application'
|
'\Alchemy\Phrasea\Core\Configuration\Application'
|
||||||
, array('getConfigurationPathName')
|
, array('getConfigurationPathName')
|
||||||
);
|
);
|
||||||
|
|
||||||
$file = new \SplFileObject(__DIR__ . "/confTestFiles/yamlWriteTest.yml");
|
$file = new \SplFileObject(__DIR__ . "/confTestFiles/yamlWriteTest.yml");
|
||||||
|
|
||||||
$stub->expects($this->any())
|
$stub->expects($this->any())
|
||||||
->method('getConfigurationPathName')
|
->method('getConfigurationPathName')
|
||||||
->will(
|
->will(
|
||||||
$this->returnValue($file->getPathname())
|
$this->returnValue($file->getPathname())
|
||||||
);
|
);
|
||||||
|
|
||||||
$handler = new Configuration\Handler($stub, new Configuration\Parser\Yaml());
|
$handler = new Configuration\Handler($stub);
|
||||||
|
|
||||||
$configuration = new PhraseaCore\Configuration($handler);
|
$configuration = new PhraseaCore\Configuration($handler);
|
||||||
|
|
||||||
$newScope = array("prod" => array('key' => 'value', 'key2' => 'value2'));
|
$newScope = array("prod" => array('key' => 'value', 'key2' => 'value2'));
|
||||||
|
|
||||||
//append new conf
|
//append new conf
|
||||||
$configuration->write($newScope, FILE_APPEND);
|
$configuration->write($newScope, FILE_APPEND);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$configuration->getConfiguration();//it is not loaded
|
$configuration->getConfiguration(); //it is not loaded
|
||||||
$this->fail("should raise an exception");
|
$this->fail("should raise an exception");
|
||||||
}
|
}
|
||||||
catch (\Exception $e)
|
catch (\Exception $e)
|
||||||
@@ -495,23 +496,5 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
|
|||||||
unlink(__DIR__ . "/confTestFiles/yamlWriteTest.yml");
|
unlink(__DIR__ . "/confTestFiles/yamlWriteTest.yml");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSetHandler()
|
|
||||||
{
|
|
||||||
$handler = new Configuration\Handler(new Configuration\Application(), new Configuration\Parser\Yaml());
|
|
||||||
$this->object->setConfigurationHandler($handler);
|
|
||||||
$this->assertEquals($handler, $this->object->getConfigurationHandler());
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testGetHandler()
|
|
||||||
{
|
|
||||||
$stub = $this->getMock(
|
|
||||||
'\Alchemy\Phrasea\Core\Configuration\Application'
|
|
||||||
, array('getConfigurationFile')
|
|
||||||
);
|
|
||||||
|
|
||||||
$handler = new Configuration\Handler($stub, new Configuration\Parser\Yaml());
|
|
||||||
|
|
||||||
$this->assertEquals($handler, $this->object->getConfigurationHandler());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -64,12 +64,6 @@ no_display_errors:
|
|||||||
cache: array_cache
|
cache: array_cache
|
||||||
|
|
||||||
missing_phraseanet:
|
missing_phraseanet:
|
||||||
##phraseanet:
|
|
||||||
##servername: 'http://dev.phrasea.net/'
|
|
||||||
##maintenance: false
|
|
||||||
##debug: true
|
|
||||||
##display_errors: true
|
|
||||||
##database: main_connexion
|
|
||||||
template_engine: twig_debug
|
template_engine: twig_debug
|
||||||
orm: doctrine_test
|
orm: doctrine_test
|
||||||
cache: array_cache
|
cache: array_cache
|
||||||
|
@@ -114,14 +114,12 @@ class CoreTest extends PhraseanetPHPUnitAbstract
|
|||||||
|
|
||||||
set_new_overload(array($this, 'newCallback'));
|
set_new_overload(array($this, 'newCallback'));
|
||||||
|
|
||||||
$handler = new \Alchemy\Phrasea\Core\Configuration\Handler(
|
$specification = new \Alchemy\Phrasea\Core\Configuration\ApplicationSpecification();
|
||||||
new \Alchemy\Phrasea\Core\Configuration\Application()
|
|
||||||
, new \Alchemy\Phrasea\Core\Configuration\Parser\Yaml()
|
|
||||||
);
|
|
||||||
$class = $this->getMock(
|
$class = $this->getMock(
|
||||||
'\Alchemy\Phrasea\Core\Configuration'
|
'\Alchemy\Phrasea\Core\Configuration'
|
||||||
, array('isInstalled')
|
, array('isInstalled')
|
||||||
, array($handler)
|
, array($specification)
|
||||||
, 'ConfMock'
|
, 'ConfMock'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@@ -814,11 +814,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
|||||||
*/
|
*/
|
||||||
protected function resetTwig()
|
protected function resetTwig()
|
||||||
{
|
{
|
||||||
$handler = new \Alchemy\Phrasea\Core\Configuration\Handler(
|
$configuration = \Alchemy\Phrasea\Core\Configuration::build();
|
||||||
new \Alchemy\Phrasea\Core\Configuration\Application(),
|
|
||||||
new \Alchemy\Phrasea\Core\Configuration\Parser\Yaml()
|
|
||||||
);
|
|
||||||
$configuration = new \Alchemy\Phrasea\Core\Configuration($handler);
|
|
||||||
|
|
||||||
$serviceName = $configuration->getTemplating();
|
$serviceName = $configuration->getTemplating();
|
||||||
$confService = $configuration->getService($serviceName);
|
$confService = $configuration->getService($serviceName);
|
||||||
|
Reference in New Issue
Block a user