mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 23:13:15 +00:00
Refactor Appbox
This commit is contained in:
@@ -26,9 +26,9 @@ use Alchemy\Phrasea\Core;
|
||||
class module_console_fileConfigCheck extends Command
|
||||
{
|
||||
|
||||
const PROD = 'prod';
|
||||
const DEV = 'dev';
|
||||
const TEST = 'test';
|
||||
const PROD = 'prod';
|
||||
const DEV = 'dev';
|
||||
const TEST = 'test';
|
||||
const ALERT = 1;
|
||||
const ERROR = 0;
|
||||
|
||||
@@ -39,10 +39,10 @@ class module_console_fileConfigCheck extends Command
|
||||
protected $configuration;
|
||||
protected $env;
|
||||
protected $testSuite = array(
|
||||
'checkPhraseanetScope'
|
||||
, 'checkDatabaseScope'
|
||||
, 'checkTeamplateEngineService'
|
||||
, 'checkOrmService'
|
||||
'checkPhraseanetScope'
|
||||
, 'checkDatabaseScope'
|
||||
, 'checkTeamplateEngineService'
|
||||
, 'checkOrmService'
|
||||
);
|
||||
protected $connexionOk = false;
|
||||
|
||||
@@ -78,8 +78,8 @@ class module_console_fileConfigCheck extends Command
|
||||
|
||||
private function initTests(OutputInterface $output)
|
||||
{
|
||||
$spec = new Core\Configuration\Application();
|
||||
$parser = new Core\Configuration\Parser\Yaml();
|
||||
$spec = new Core\Configuration\Application();
|
||||
$parser = new Core\Configuration\Parser\Yaml();
|
||||
$handler = new Core\Configuration\Handler($spec, $parser);
|
||||
|
||||
$this->configuration = new Core\Configuration($handler, $this->env);
|
||||
@@ -105,11 +105,11 @@ class module_console_fileConfigCheck extends Command
|
||||
$previous = $e->getPrevious();
|
||||
|
||||
$output->writeln(sprintf(
|
||||
"<error>%s FATAL error : %s</error>"
|
||||
, $e->getMessage()
|
||||
, $previous instanceof \Exception ?
|
||||
$previous->getMessage() : 'Unknown.'
|
||||
)
|
||||
"<error>%s FATAL error : %s</error>"
|
||||
, $e->getMessage()
|
||||
, $previous instanceof \Exception ?
|
||||
$previous->getMessage() : 'Unknown.'
|
||||
)
|
||||
);
|
||||
$output->writeln(sprintf("\nConfig check test suite can not continue please correct FATAL error and relaunch.\n"));
|
||||
|
||||
@@ -132,11 +132,11 @@ class module_console_fileConfigCheck extends Command
|
||||
$previous = $e->getPrevious();
|
||||
|
||||
$output->writeln(sprintf(
|
||||
"<error>%s FAILED : %s</error>"
|
||||
, $e->getMessage()
|
||||
, $previous instanceof \Exception ?
|
||||
$previous->getMessage() : 'Unknow'
|
||||
)
|
||||
"<error>%s FAILED : %s</error>"
|
||||
, $e->getMessage()
|
||||
, $previous instanceof \Exception ?
|
||||
$previous->getMessage() : 'Unknow'
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -146,25 +146,25 @@ class module_console_fileConfigCheck extends Command
|
||||
|
||||
private function checkParse(OutputInterface $output)
|
||||
{
|
||||
$parser = $this
|
||||
->configuration
|
||||
->getConfigurationHandler()
|
||||
->getParser();
|
||||
$fileConfig = $this
|
||||
->configuration
|
||||
->getConfigurationHandler()
|
||||
->getSpecification()
|
||||
->getConfigurationFile();
|
||||
$fileService = $this
|
||||
->configuration
|
||||
->getConfigurationHandler()
|
||||
->getSpecification()
|
||||
->getServiceFile();
|
||||
$parser = $this
|
||||
->configuration
|
||||
->getConfigurationHandler()
|
||||
->getParser();
|
||||
$fileConfig = $this
|
||||
->configuration
|
||||
->getConfigurationHandler()
|
||||
->getSpecification()
|
||||
->getConfigurationFile();
|
||||
$fileService = $this
|
||||
->configuration
|
||||
->getConfigurationHandler()
|
||||
->getSpecification()
|
||||
->getServiceFile();
|
||||
$fileConnexion = $this
|
||||
->configuration
|
||||
->getConfigurationHandler()
|
||||
->getSpecification()
|
||||
->getConnexionFile();
|
||||
->configuration
|
||||
->getConfigurationHandler()
|
||||
->getSpecification()
|
||||
->getConnexionFile();
|
||||
|
||||
try
|
||||
{
|
||||
@@ -175,7 +175,7 @@ class module_console_fileConfigCheck extends Command
|
||||
catch (\Exception $e)
|
||||
{
|
||||
$message = str_replace("\\", "", $e->getMessage());
|
||||
$e = new \Exception($message);
|
||||
$e = new \Exception($message);
|
||||
throw new \Exception(sprintf("Check parsing file\n"), null, $e);
|
||||
}
|
||||
$output->writeln("<info>Parsing File OK</info>");
|
||||
@@ -200,8 +200,8 @@ class module_console_fileConfigCheck extends Command
|
||||
|
||||
private function checkGetSelectedEnvironementFromFile(OutputInterface $output)
|
||||
{
|
||||
$spec = new Core\Configuration\Application();
|
||||
$parser = new Core\Configuration\Parser\Yaml();
|
||||
$spec = new Core\Configuration\Application();
|
||||
$parser = new Core\Configuration\Parser\Yaml();
|
||||
$handler = new Core\Configuration\Handler($spec, $parser);
|
||||
|
||||
$configuration = new Core\Configuration($handler);
|
||||
@@ -232,18 +232,18 @@ class module_console_fileConfigCheck extends Command
|
||||
if ($phraseanet->get("debug") !== true)
|
||||
{
|
||||
$output->writeln(sprintf(
|
||||
"<comment>%s:phraseanet:debug must be initialized to true<:comment>"
|
||||
, $this->env
|
||||
)
|
||||
"<comment>%s:phraseanet:debug must be initialized to true<:comment>"
|
||||
, $this->env
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if ($phraseanet->get("display_errors") !== true)
|
||||
{
|
||||
throw new \Exception(sprintf(
|
||||
"%s:phraseanet:debug must be initialized to true"
|
||||
, $this->env
|
||||
)
|
||||
"%s:phraseanet:debug must be initialized to true"
|
||||
, $this->env
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -253,18 +253,18 @@ class module_console_fileConfigCheck extends Command
|
||||
if ($phraseanet->get("debug") !== false)
|
||||
{
|
||||
throw new \Exception(sprintf(
|
||||
"%s:phraseanet:debug must be initialized to false"
|
||||
, $this->env
|
||||
)
|
||||
"%s:phraseanet:debug must be initialized to false"
|
||||
, $this->env
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if ($phraseanet->get("display_errors") !== false)
|
||||
{
|
||||
throw new \Exception(sprintf(
|
||||
"%s:phraseanet:debug must be initialized to false"
|
||||
, $this->env
|
||||
)
|
||||
"%s:phraseanet:debug must be initialized to false"
|
||||
, $this->env
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -284,14 +284,14 @@ class module_console_fileConfigCheck extends Command
|
||||
try
|
||||
{
|
||||
$connexionName = $this->configuration->getPhraseanet()->get('database');
|
||||
$connexion = $this->configuration->getConnexion($connexionName);
|
||||
$connexion = $this->configuration->getConnexion($connexionName);
|
||||
|
||||
try
|
||||
{
|
||||
$config = new \Doctrine\DBAL\Configuration();
|
||||
$conn = \Doctrine\DBAL\DriverManager::getConnection(
|
||||
$connexion->all()
|
||||
, $config
|
||||
$conn = \Doctrine\DBAL\DriverManager::getConnection(
|
||||
$connexion->all()
|
||||
, $config
|
||||
);
|
||||
unset($conn);
|
||||
$this->connexionOk = true;
|
||||
@@ -299,10 +299,10 @@ class module_console_fileConfigCheck extends Command
|
||||
catch (\Exception $e)
|
||||
{
|
||||
throw new \Exception(sprintf(
|
||||
"Unable to connect to database declared in connexion '%s' for the following reason %s"
|
||||
, $connexionName
|
||||
, $e->getMessage()
|
||||
)
|
||||
"Unable to connect to database declared in connexion '%s' for the following reason %s"
|
||||
, $connexionName
|
||||
, $e->getMessage()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -328,24 +328,23 @@ class module_console_fileConfigCheck extends Command
|
||||
catch (\Exception $e)
|
||||
{
|
||||
$message = sprintf(
|
||||
"%s called from %s in %s:%s:template_engine scope"
|
||||
, $e->getMessage()
|
||||
, $this->configuration->getFile()->getFilename()
|
||||
, $this->env
|
||||
, $templateEngineName
|
||||
"%s called from %s in %s:%s:template_engine scope"
|
||||
, $e->getMessage()
|
||||
, $this->configuration->getFile()->getFilename()
|
||||
, $this->env
|
||||
, $templateEngineName
|
||||
);
|
||||
$e = new \Exception($message);
|
||||
$e = new \Exception($message);
|
||||
throw $e;
|
||||
}
|
||||
|
||||
|
||||
$serviceBuilder = new Core\ServiceBuilder\TemplateEngine(
|
||||
$templateEngineName
|
||||
, $configuration
|
||||
$service = Core\Service\Builder::create(
|
||||
\bootstrap::getCore()
|
||||
, $templateEngineName
|
||||
, $configuration
|
||||
);
|
||||
|
||||
$service = $serviceBuilder->buildService();
|
||||
|
||||
if ($service->getType() === 'twig')
|
||||
{
|
||||
$twig = $service->getService();
|
||||
@@ -376,20 +375,20 @@ class module_console_fileConfigCheck extends Command
|
||||
if ($e->getKey() === 'template_engine')
|
||||
{
|
||||
$e = new \Exception(sprintf(
|
||||
"Missing parameter %s for %s environment scope"
|
||||
, $e->getKey()
|
||||
, $this->env
|
||||
)
|
||||
"Missing parameter %s for %s environment scope"
|
||||
, $e->getKey()
|
||||
, $this->env
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$e = new \Exception(sprintf(
|
||||
"Missing parameter %s for %s service declared in %s scope."
|
||||
, $e->getKey()
|
||||
, $templateEngineName
|
||||
, $this->env
|
||||
)
|
||||
"Missing parameter %s for %s service declared in %s scope."
|
||||
, $e->getKey()
|
||||
, $templateEngineName
|
||||
, $this->env
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -422,26 +421,22 @@ class module_console_fileConfigCheck extends Command
|
||||
catch (\Exception $e)
|
||||
{
|
||||
$message = sprintf(
|
||||
"%s called from %s in %s:orm scope"
|
||||
, $e->getMessage()
|
||||
, $this->configuration->getFile()->getFilename()
|
||||
, $this->env
|
||||
, $ormName
|
||||
"%s called from %s in %s:orm scope"
|
||||
, $e->getMessage()
|
||||
, $this->configuration->getFile()->getFilename()
|
||||
, $this->env
|
||||
, $ormName
|
||||
);
|
||||
$e = new \Exception($message);
|
||||
$e = new \Exception($message);
|
||||
throw $e;
|
||||
}
|
||||
|
||||
$registry = \registry::get_instance();
|
||||
|
||||
$serviceBuilder = new Core\ServiceBuilder\Orm(
|
||||
$ormName
|
||||
, $configuration
|
||||
, array('registry' => $registry)
|
||||
$service = Core\Service\Builder::create(
|
||||
\bootstrap::getCore()
|
||||
, $ormName
|
||||
, $configuration
|
||||
);
|
||||
|
||||
$service = $serviceBuilder->buildService();
|
||||
|
||||
if ($service->getType() === 'doctrine')
|
||||
{
|
||||
$caches = $service->getCacheServices();
|
||||
@@ -449,17 +444,17 @@ class module_console_fileConfigCheck extends Command
|
||||
if ($service->isDebug() && self::PROD === $this->env)
|
||||
{
|
||||
$output->writeln(sprintf(
|
||||
"<comment>%s service should not be in debug mode </comment>"
|
||||
, $service->getName()
|
||||
)
|
||||
"<comment>%s service should not be in debug mode </comment>"
|
||||
, $service->getName()
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ((self::TEST === $this->env || self::DEV === $this->env) && !$service->isDebug())
|
||||
{
|
||||
$output->writeln(sprintf(
|
||||
"<comment>%s service should be in debug mode</comment>"
|
||||
, $service->getName()
|
||||
)
|
||||
"<comment>%s service should be in debug mode</comment>"
|
||||
, $service->getName()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -468,23 +463,23 @@ class module_console_fileConfigCheck extends Command
|
||||
if ($cache->getType() === 'array' && self::PROD === $this->env)
|
||||
{
|
||||
$output->writeln(sprintf(
|
||||
"<comment>%s:doctrine:orm:%s %s service should not be an array cache type for %s environment</comment>"
|
||||
, $service->getName()
|
||||
, $key
|
||||
, $cache->getName()
|
||||
, $this->env
|
||||
)
|
||||
"<comment>%s:doctrine:orm:%s %s service should not be an array cache type for %s environment</comment>"
|
||||
, $service->getName()
|
||||
, $key
|
||||
, $cache->getName()
|
||||
, $this->env
|
||||
)
|
||||
);
|
||||
}
|
||||
elseif ($cache->getType() !== 'array' && (self::TEST === $this->env || self::DEV === $this->env))
|
||||
{
|
||||
$output->writeln(sprintf(
|
||||
"<comment>%s:doctrine:orm:%s %s service should be an array cache type for %s environment</comment>"
|
||||
, $service->getName()
|
||||
, $key
|
||||
, $cache->getName()
|
||||
, $this->env
|
||||
)
|
||||
"<comment>%s:doctrine:orm:%s %s service should be an array cache type for %s environment</comment>"
|
||||
, $service->getName()
|
||||
, $key
|
||||
, $cache->getName()
|
||||
, $this->env
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -497,20 +492,20 @@ class module_console_fileConfigCheck extends Command
|
||||
if ($e->getKey() === 'orm')
|
||||
{
|
||||
$e = new \Exception(sprintf(
|
||||
"Missing parameter %s for %s environment scope"
|
||||
, $e->getKey()
|
||||
, $this->env
|
||||
)
|
||||
"Missing parameter %s for %s environment scope"
|
||||
, $e->getKey()
|
||||
, $this->env
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$e = new \Exception(sprintf(
|
||||
"Missing parameter %s for %s service declared in %s scope."
|
||||
, $e->getKey()
|
||||
, $service->getName()
|
||||
, $this->env
|
||||
)
|
||||
"Missing parameter %s for %s service declared in %s scope."
|
||||
, $e->getKey()
|
||||
, $service->getName()
|
||||
, $this->env
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -37,10 +37,10 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
protected $configuration;
|
||||
protected $env;
|
||||
protected $testSuite = array(
|
||||
'checkPhraseanetScope'
|
||||
, 'checkDatabaseScope'
|
||||
, 'checkTeamplateEngineService'
|
||||
, 'checkOrmService'
|
||||
'checkPhraseanetScope'
|
||||
, 'checkDatabaseScope'
|
||||
, 'checkTeamplateEngineService'
|
||||
, 'checkOrmService'
|
||||
);
|
||||
protected $connexionOk = false;
|
||||
|
||||
@@ -67,8 +67,8 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
|
||||
private function initTests(OutputInterface $output)
|
||||
{
|
||||
$spec = new Core\Configuration\Application();
|
||||
$parser = new Core\Configuration\Parser\Yaml();
|
||||
$spec = new Core\Configuration\Application();
|
||||
$parser = new Core\Configuration\Parser\Yaml();
|
||||
$handler = new Core\Configuration\Handler($spec, $parser);
|
||||
|
||||
$this->configuration = new Core\Configuration($handler);
|
||||
@@ -94,11 +94,11 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
$previous = $e->getPrevious();
|
||||
|
||||
$output->writeln(sprintf(
|
||||
"<error>%s FATAL error : %s</error>"
|
||||
, $e->getMessage()
|
||||
, $previous instanceof \Exception ?
|
||||
$previous->getMessage() : 'Unknown.'
|
||||
)
|
||||
"<error>%s FATAL error : %s</error>"
|
||||
, $e->getMessage()
|
||||
, $previous instanceof \Exception ?
|
||||
$previous->getMessage() : 'Unknown.'
|
||||
)
|
||||
);
|
||||
$output->writeln(sprintf("\nCheck test suite can not continue please correct FATAL error and relaunch.\n"));
|
||||
|
||||
@@ -142,11 +142,11 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
$previous = $e->getPrevious();
|
||||
|
||||
$output->writeln(sprintf(
|
||||
"<error>%s FAILED : %s</error>"
|
||||
, $e->getMessage()
|
||||
, $previous instanceof \Exception ?
|
||||
$previous->getMessage() : 'Unknow'
|
||||
)
|
||||
"<error>%s FAILED : %s</error>"
|
||||
, $e->getMessage()
|
||||
, $previous instanceof \Exception ?
|
||||
$previous->getMessage() : 'Unknow'
|
||||
)
|
||||
);
|
||||
$output->writeln("");
|
||||
}
|
||||
@@ -165,25 +165,25 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
|
||||
private function checkParse(OutputInterface $output)
|
||||
{
|
||||
$parser = $this
|
||||
->configuration
|
||||
->getConfigurationHandler()
|
||||
->getParser();
|
||||
$fileConfig = $this
|
||||
->configuration
|
||||
->getConfigurationHandler()
|
||||
->getSpecification()
|
||||
->getConfigurationFile();
|
||||
$fileService = $this
|
||||
->configuration
|
||||
->getConfigurationHandler()
|
||||
->getSpecification()
|
||||
->getServiceFile();
|
||||
$parser = $this
|
||||
->configuration
|
||||
->getConfigurationHandler()
|
||||
->getParser();
|
||||
$fileConfig = $this
|
||||
->configuration
|
||||
->getConfigurationHandler()
|
||||
->getSpecification()
|
||||
->getConfigurationFile();
|
||||
$fileService = $this
|
||||
->configuration
|
||||
->getConfigurationHandler()
|
||||
->getSpecification()
|
||||
->getServiceFile();
|
||||
$fileConnexion = $this
|
||||
->configuration
|
||||
->getConfigurationHandler()
|
||||
->getSpecification()
|
||||
->getConnexionFile();
|
||||
->configuration
|
||||
->getConfigurationHandler()
|
||||
->getSpecification()
|
||||
->getConnexionFile();
|
||||
|
||||
try
|
||||
{
|
||||
@@ -194,7 +194,7 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
catch (\Exception $e)
|
||||
{
|
||||
$message = str_replace("\\", "", $e->getMessage());
|
||||
$e = new \Exception($message);
|
||||
$e = new \Exception($message);
|
||||
throw new \Exception(sprintf("CHECK parsing file\n"), null, $e);
|
||||
}
|
||||
|
||||
@@ -217,8 +217,8 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
|
||||
private function checkGetSelectedEnvironementFromFile(OutputInterface $output)
|
||||
{
|
||||
$spec = new Core\Configuration\Application();
|
||||
$parser = new Core\Configuration\Parser\Yaml();
|
||||
$spec = new Core\Configuration\Application();
|
||||
$parser = new Core\Configuration\Parser\Yaml();
|
||||
$handler = new Core\Configuration\Handler($spec, $parser);
|
||||
|
||||
$configuration = new Core\Configuration($handler);
|
||||
@@ -297,7 +297,7 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
try
|
||||
{
|
||||
$connexionName = $this->configuration->getPhraseanet()->get('database');
|
||||
$connexion = $this->configuration->getConnexion($connexionName);
|
||||
$connexion = $this->configuration->getConnexion($connexionName);
|
||||
|
||||
$output->writeln(sprintf("Current connexion is '%s'", $connexionName));
|
||||
$output->writeln("");
|
||||
@@ -314,9 +314,9 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
try
|
||||
{
|
||||
$config = new \Doctrine\DBAL\Configuration();
|
||||
$conn = \Doctrine\DBAL\DriverManager::getConnection(
|
||||
$connexion->all()
|
||||
, $config
|
||||
$conn = \Doctrine\DBAL\DriverManager::getConnection(
|
||||
$connexion->all()
|
||||
, $config
|
||||
);
|
||||
unset($conn);
|
||||
$this->connexionOk = true;
|
||||
@@ -324,10 +324,10 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
catch (\Exception $e)
|
||||
{
|
||||
throw new \Exception(sprintf(
|
||||
"Unable to connect to database declared in connexion '%s' for the following reason %s"
|
||||
, $connexionName
|
||||
, $e->getMessage()
|
||||
)
|
||||
"Unable to connect to database declared in connexion '%s' for the following reason %s"
|
||||
, $connexionName
|
||||
, $e->getMessage()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -358,23 +358,22 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
catch (\Exception $e)
|
||||
{
|
||||
$message = sprintf(
|
||||
"%s called from %s in %s:template_engine scope"
|
||||
, $e->getMessage()
|
||||
, $this->configuration->getFile()->getFilename()
|
||||
, "PROD"
|
||||
, $templateEngineName
|
||||
"%s called from %s in %s:template_engine scope"
|
||||
, $e->getMessage()
|
||||
, $this->configuration->getFile()->getFilename()
|
||||
, "PROD"
|
||||
, $templateEngineName
|
||||
);
|
||||
$e = new \Exception($message);
|
||||
$e = new \Exception($message);
|
||||
throw $e;
|
||||
}
|
||||
|
||||
$serviceBuilder = new Core\ServiceBuilder\TemplateEngine(
|
||||
$templateEngineName
|
||||
, $configuration
|
||||
$service = Core\Service\Builder::create(
|
||||
\bootstrap::getCore()
|
||||
, $templateEngineName
|
||||
, $configuration
|
||||
);
|
||||
|
||||
$service = $serviceBuilder->buildService();
|
||||
|
||||
if ($service->getType() === 'twig')
|
||||
{
|
||||
$twig = $service->getService();
|
||||
@@ -397,18 +396,18 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
if ($e->getKey() === 'template_engine')
|
||||
{
|
||||
$e = new \Exception(sprintf(
|
||||
"Missing parameter %s "
|
||||
, $e->getKey()
|
||||
)
|
||||
"Missing parameter %s "
|
||||
, $e->getKey()
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$e = new \Exception(sprintf(
|
||||
"Missing parameter %s for %s service"
|
||||
, $e->getKey()
|
||||
, $templateEngineName
|
||||
)
|
||||
"Missing parameter %s for %s service"
|
||||
, $e->getKey()
|
||||
, $templateEngineName
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -443,25 +442,23 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
$message = sprintf(
|
||||
"%s called from %s in %s scope"
|
||||
, $e->getMessage()
|
||||
, $this->configuration->getFile()->getFilename()
|
||||
, $ormName
|
||||
$message = sprintf(
|
||||
"%s called from %s in %s scope"
|
||||
, $e->getMessage()
|
||||
, $this->configuration->getFile()->getFilename()
|
||||
, $ormName
|
||||
);
|
||||
$e = new \Exception($message);
|
||||
$e = new \Exception($message);
|
||||
throw $e;
|
||||
}
|
||||
$registry = \registry::get_instance();
|
||||
|
||||
$serviceBuilder = new Core\ServiceBuilder\Orm(
|
||||
$ormName
|
||||
, $configuration
|
||||
, array('registry' => $registry)
|
||||
$service = new Core\Service\Builder(
|
||||
\bootstrap::getCore()
|
||||
, $ormName
|
||||
, $configuration
|
||||
);
|
||||
|
||||
$service = $serviceBuilder->buildService();
|
||||
|
||||
if ($service->getType() === 'doctrine')
|
||||
{
|
||||
$output->writeln("");
|
||||
@@ -471,9 +468,9 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
if ($service->isDebug())
|
||||
{
|
||||
throw new \Exception(sprintf(
|
||||
"%s service should not be in debug mode"
|
||||
, $service->getName()
|
||||
)
|
||||
"%s service should not be in debug mode"
|
||||
, $service->getName()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -485,15 +482,15 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
{
|
||||
|
||||
throw new \Exception(sprintf(
|
||||
"%s:doctrine:orm:cache must not be empty. In production environment the cache is highly recommanded."
|
||||
, $service->getName()
|
||||
)
|
||||
"%s:doctrine:orm:cache must not be empty. In production environment the cache is highly recommanded."
|
||||
, $service->getName()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
foreach ($caches as $key => $cache)
|
||||
{
|
||||
$originalServiceName = $options['orm']['cache'][$key];
|
||||
$originalServiceName = $options['orm']['cache'][$key];
|
||||
$originalConfiguration = $this->configuration->getService($originalServiceName);
|
||||
|
||||
$cacheOptions = $originalConfiguration->all();
|
||||
@@ -504,12 +501,9 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
$this->printConf($output, $key . ":" . $originalServiceName, $cacheOptions["options"]);
|
||||
}
|
||||
|
||||
$serviceBuilder = new Core\ServiceBuilder\Cache(
|
||||
$originalServiceName,
|
||||
$originalConfiguration,
|
||||
array("registry" => $registry)
|
||||
$originalService = Core\Service\Builder::create(
|
||||
\bootstrap::getCore(), $originalServiceName, $originalConfiguration
|
||||
);
|
||||
$originalService = $serviceBuilder->buildService();
|
||||
|
||||
if ($originalService->getType() === 'memcache')
|
||||
{
|
||||
@@ -521,11 +515,11 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
if ($originalService->getType() === 'array')
|
||||
{
|
||||
throw new \Exception(sprintf(
|
||||
"%s:doctrine:orm:%s %s service should not be an array cache type"
|
||||
, $service->getName()
|
||||
, $key
|
||||
, $cache->getName()
|
||||
)
|
||||
"%s:doctrine:orm:%s %s service should not be an array cache type"
|
||||
, $service->getName()
|
||||
, $key
|
||||
, $cache->getName()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -533,28 +527,27 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
try
|
||||
{
|
||||
$logServiceName = $options['log'];
|
||||
$configuration = $this->configuration->getService($logServiceName);
|
||||
$serviceBuilder = new Core\ServiceBuilder\Log(
|
||||
$logServiceName
|
||||
, $configuration
|
||||
$configuration = $this->configuration->getService($logServiceName);
|
||||
$serviceLog = Core\Service\Builder::create(
|
||||
\bootstrap::getCore()
|
||||
, $logServiceName
|
||||
, $configuration
|
||||
);
|
||||
|
||||
$serviceLog = $serviceBuilder->buildService();
|
||||
|
||||
$exists = true;
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
$exists = false;
|
||||
}
|
||||
|
||||
if($exists)
|
||||
|
||||
if ($exists)
|
||||
{
|
||||
throw new \Exception(sprintf(
|
||||
"doctrine:orm:log %s service should not be enable"
|
||||
, $serviceLog->getName()
|
||||
)
|
||||
);
|
||||
"doctrine:orm:log %s service should not be enable"
|
||||
, $serviceLog->getName()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -565,19 +558,19 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
if ($e->getKey() === 'orm')
|
||||
{
|
||||
$e = new \Exception(sprintf(
|
||||
"Missing parameter %s for service %s"
|
||||
, $e->getKey()
|
||||
, $service->getName()
|
||||
)
|
||||
"Missing parameter %s for service %s"
|
||||
, $e->getKey()
|
||||
, $service->getName()
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
$e = new \Exception(sprintf(
|
||||
"Missing parameter %s for %s service declared"
|
||||
, $e->getKey()
|
||||
, $service->getName()
|
||||
)
|
||||
"Missing parameter %s for %s service declared"
|
||||
, $e->getKey()
|
||||
, $service->getName()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -47,7 +47,7 @@ class module_console_schedulerState extends Command
|
||||
|
||||
try
|
||||
{
|
||||
$appbox = appbox::get_instance();
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$task_manager = new task_manager($appbox);
|
||||
$state = $task_manager->get_scheduler_state();
|
||||
if ($state['schedstatus'] == 'started')
|
||||
|
@@ -47,7 +47,7 @@ class module_console_schedulerStop extends Command
|
||||
|
||||
try
|
||||
{
|
||||
$appbox = appbox::get_instance();
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$task_manager = new task_manager($appbox);
|
||||
$task_manager->set_sched_status(task_manager::STATUS_SCHED_TOSTOP);
|
||||
|
||||
|
@@ -54,7 +54,7 @@ class module_console_systemBackupDB extends Command
|
||||
|
||||
$output->write('Phraseanet is going to be backup...', true);
|
||||
|
||||
$appbox = appbox::get_instance();
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
|
||||
$ok = true;
|
||||
|
||||
|
@@ -83,12 +83,8 @@ class module_console_systemClearCache extends Command
|
||||
|
||||
if(setup::is_installed())
|
||||
{
|
||||
$registry = registry::get_instance();
|
||||
$cache = cache_adapter::get_instance($registry);
|
||||
if($cache->ping())
|
||||
{
|
||||
$cache->flush();
|
||||
}
|
||||
$Core = \bootstrap::getCore();
|
||||
$Core['CacheService']->flushAll();
|
||||
}
|
||||
|
||||
$output->write('Finished !', true);
|
||||
|
@@ -43,7 +43,7 @@ class module_console_systemMailCheck extends Command
|
||||
public function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
|
||||
$appbox = appbox::get_instance();
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
|
||||
$output->writeln("Processing...");
|
||||
|
||||
|
@@ -104,7 +104,7 @@ class module_console_systemUpgrade extends Command
|
||||
try
|
||||
{
|
||||
$output->write('<info>Upgrading...</info>', true);
|
||||
$appbox = appbox::get_instance();
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
|
||||
if (count(User_Adapter::get_wrong_email_users($appbox)) > 0)
|
||||
{
|
||||
|
@@ -48,7 +48,7 @@ class module_console_tasklist extends Command
|
||||
|
||||
try
|
||||
{
|
||||
$appbox = appbox::get_instance();
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$task_manager = new task_manager($appbox);
|
||||
$tasks = $task_manager->get_tasks();
|
||||
|
||||
|
@@ -65,7 +65,7 @@ class module_console_taskrun extends Command
|
||||
|
||||
try
|
||||
{
|
||||
$appbox = appbox::get_instance();
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$task_manager = new task_manager($appbox);
|
||||
$task = $task_manager->get_task($task_id);
|
||||
|
||||
|
@@ -341,7 +341,7 @@ class module_report_activity extends module_report
|
||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
$login = User_Adapter::getInstance($usr, appbox::get_instance())->get_display_name();
|
||||
$login = User_Adapter::getInstance($usr, appbox::get_instance(\bootstrap::getCore()))->get_display_name();
|
||||
|
||||
$this->setChamp($rs);
|
||||
($config) ? $this->setConfigColumn($config) :
|
||||
@@ -739,7 +739,7 @@ class module_report_activity extends module_report
|
||||
$this->setChamp($rs);
|
||||
$this->initDefaultConfigColumn($this->champ);
|
||||
|
||||
$appbox = appbox::get_instance();
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
|
||||
$i = 0;
|
||||
foreach ($rs as $row)
|
||||
|
@@ -77,7 +77,7 @@ class module_report_add extends module_report
|
||||
|
||||
$ret = array();
|
||||
|
||||
$appbox = appbox::get_instance();
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
|
||||
foreach ($rs as $row)
|
||||
{
|
||||
|
@@ -66,7 +66,7 @@ class module_report_dashboard_feed implements module_report_dashboard_componentI
|
||||
*/
|
||||
public static function getInstance($sbasid, $sbas_coll, $dmin, $dmax)
|
||||
{
|
||||
$appbox = appbox::get_instance();
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
$cache_id = 'feed_' . md5($sbasid . '_' . $sbas_coll . '_' . $dmin . '_' . $dmax);
|
||||
|
||||
try
|
||||
|
@@ -76,7 +76,7 @@ class module_report_edit extends module_report
|
||||
$rs = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
$stmt->closeCursor();
|
||||
|
||||
$appbox = appbox::get_instance();
|
||||
$appbox = appbox::get_instance(\bootstrap::getCore());
|
||||
|
||||
$ret = array();
|
||||
foreach ($rs as $row)
|
||||
|
Reference in New Issue
Block a user