mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-10 11:33:17 +00:00
check all configuration in a row
This commit is contained in:
@@ -25,10 +25,10 @@ use Alchemy\Phrasea\Core;
|
|||||||
*/
|
*/
|
||||||
class module_console_fileConfigCheck extends Command
|
class module_console_fileConfigCheck extends Command
|
||||||
{
|
{
|
||||||
|
|
||||||
const PROD = 'prod';
|
const PROD = 'prod';
|
||||||
const DEV = 'dev';
|
const DEV = 'dev';
|
||||||
const TEST = 'test';
|
const TEST = 'test';
|
||||||
|
|
||||||
const ALERT = 1;
|
const ALERT = 1;
|
||||||
const ERROR = 0;
|
const ERROR = 0;
|
||||||
|
|
||||||
@@ -50,26 +50,28 @@ class module_console_fileConfigCheck extends Command
|
|||||||
{
|
{
|
||||||
parent::__construct($name);
|
parent::__construct($name);
|
||||||
|
|
||||||
$this
|
$this->setDescription('check configuration file');
|
||||||
->setDescription('check configuration file')
|
|
||||||
->addArgument(
|
|
||||||
'environment'
|
|
||||||
, InputArgument::REQUIRED
|
|
||||||
, 'check an environment configuration from configuration file'
|
|
||||||
);
|
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function execute(InputInterface $input, OutputInterface $output)
|
public function execute(InputInterface $input, OutputInterface $output)
|
||||||
{
|
{
|
||||||
$this->env = $input->getArgument('environment');
|
|
||||||
|
foreach (array(self::DEV, self::PROD, self::TEST) as $env)
|
||||||
|
{
|
||||||
|
$output->writeln("");
|
||||||
|
$output->writeln(sprintf("Checking for %s configuration settings", $env));
|
||||||
|
$output->writeln("=========================================");
|
||||||
|
$output->writeln("");
|
||||||
|
$this->env = $env;
|
||||||
|
|
||||||
$this->initTests();
|
$this->initTests();
|
||||||
|
|
||||||
$this->prepareTests($output);
|
$this->prepareTests($output);
|
||||||
|
|
||||||
$this->runTests($output);
|
$this->runTests($output);
|
||||||
|
}
|
||||||
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
@@ -318,7 +320,7 @@ class module_console_fileConfigCheck extends Command
|
|||||||
catch (\Exception $e)
|
catch (\Exception $e)
|
||||||
{
|
{
|
||||||
$message = sprintf(
|
$message = sprintf(
|
||||||
"%s called from %s in %s:template_engine scope"
|
"%s called from %s in %s:%s:template_engine scope"
|
||||||
, $e->getMessage()
|
, $e->getMessage()
|
||||||
, $this->configuration->getFile()->getFilename()
|
, $this->configuration->getFile()->getFilename()
|
||||||
, $this->env
|
, $this->env
|
||||||
@@ -427,7 +429,7 @@ class module_console_fileConfigCheck extends Command
|
|||||||
$serviceBuilder = new Core\ServiceBuilder\Orm(
|
$serviceBuilder = new Core\ServiceBuilder\Orm(
|
||||||
$ormName
|
$ormName
|
||||||
, $configuration
|
, $configuration
|
||||||
, array('registry'=> $registry)
|
, array('registry' => $registry)
|
||||||
);
|
);
|
||||||
|
|
||||||
$service = $serviceBuilder->buildService();
|
$service = $serviceBuilder->buildService();
|
||||||
@@ -498,7 +500,7 @@ class module_console_fileConfigCheck extends Command
|
|||||||
$e = new \Exception(sprintf(
|
$e = new \Exception(sprintf(
|
||||||
"Missing parameter %s for %s service declared in %s scope."
|
"Missing parameter %s for %s service declared in %s scope."
|
||||||
, $e->getKey()
|
, $e->getKey()
|
||||||
, $templateEngineName
|
, $service->getName()
|
||||||
, $this->env
|
, $this->env
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user