mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 15:03:25 +00:00
add enhancement
This commit is contained in:
@@ -38,11 +38,11 @@ class Application implements Specification
|
|||||||
*/
|
*/
|
||||||
public function getConfFileFromEnvName($name)
|
public function getConfFileFromEnvName($name)
|
||||||
{
|
{
|
||||||
if($name === self::EXTENDED_MAIN_KEYWORD)
|
if ($name === self::EXTENDED_MAIN_KEYWORD)
|
||||||
{
|
{
|
||||||
return $this->getMainFile();
|
return $this->getMainConfigurationFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
return new \SplFileObject(sprintf("%s/config_%s.%s"
|
return new \SplFileObject(sprintf("%s/config_%s.%s"
|
||||||
, $this->getConfigurationFilePath()
|
, $this->getConfigurationFilePath()
|
||||||
, $name
|
, $name
|
||||||
@@ -58,8 +58,12 @@ class Application implements Specification
|
|||||||
{
|
{
|
||||||
return __DIR__ . '/../../../../../config';
|
return __DIR__ . '/../../../../../config';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMainFile()
|
/**
|
||||||
|
*
|
||||||
|
* {@inheritdoc}
|
||||||
|
*/
|
||||||
|
public function getMainConfigurationFile()
|
||||||
{
|
{
|
||||||
$path = __DIR__ . '/../../../../../config/config.yml';
|
$path = __DIR__ . '/../../../../../config/config.yml';
|
||||||
return new \SplFileObject($path);
|
return new \SplFileObject($path);
|
||||||
|
@@ -40,20 +40,38 @@ class Handler
|
|||||||
* @param ConfigurationSpecification $configSpec
|
* @param ConfigurationSpecification $configSpec
|
||||||
* @param Parser\ParserInterface $parser
|
* @param Parser\ParserInterface $parser
|
||||||
*/
|
*/
|
||||||
public function __construct(Application $configSpec, Parser $parser)
|
public function __construct(Specification $configSpec, Parser $parser)
|
||||||
{
|
{
|
||||||
$this->confSpecification = $configSpec;
|
$this->confSpecification = $configSpec;
|
||||||
$this->parser = $parser;
|
$this->parser = $parser;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Getter
|
||||||
|
* @return Specification
|
||||||
|
*/
|
||||||
|
public function getSpecification()
|
||||||
|
{
|
||||||
|
return $this->confSpecification;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getter
|
||||||
|
* @return Parser
|
||||||
|
*/
|
||||||
|
public function getParser()
|
||||||
|
{
|
||||||
|
return $this->parser;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
* Stacks all envrironnement in $env that extends the loaded configuration file
|
* Stacks all envrironnement in $env that extends the loaded configuration file
|
||||||
*
|
*
|
||||||
* @param SplFileObject $file File of the current loaded config file
|
* @param SplFileObject $file File of the current loaded config file
|
||||||
* @param array $envs A stack of conf environnments
|
* @param array $envs A stack of conf environnments
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function retrieveExtendedEnvFromFile(\SplFileObject $file, Array $allEnvs = array())
|
public function retrieveExtendedEnvFromFile(\SplFileObject $file, Array $allEnvs = array())
|
||||||
{
|
{
|
||||||
$env = $this->parser->parse($file);
|
$env = $this->parser->parse($file);
|
||||||
|
|
||||||
@@ -119,7 +137,6 @@ class Handler
|
|||||||
*/
|
*/
|
||||||
public function handle($name)
|
public function handle($name)
|
||||||
{
|
{
|
||||||
|
|
||||||
//get the corresepondant file
|
//get the corresepondant file
|
||||||
$file = $this->confSpecification->getConfFileFromEnvName($name);
|
$file = $this->confSpecification->getConfFileFromEnvName($name);
|
||||||
|
|
||||||
@@ -171,10 +188,6 @@ class Handler
|
|||||||
$searchArray[$k] = $value;
|
$searchArray[$k] = $value;
|
||||||
break; //quit
|
break; //quit
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -29,6 +29,13 @@ interface Specification
|
|||||||
*/
|
*/
|
||||||
const EXTENDED_MAIN_KEYWORD = 'main';
|
const EXTENDED_MAIN_KEYWORD = 'main';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the main configuration file
|
||||||
|
*
|
||||||
|
* @return \SplFileObject
|
||||||
|
*/
|
||||||
|
public function getMainConfigurationFile();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return an array of paths that CAN'T be extended by ONLY one or more of their value
|
* Return an array of paths that CAN'T be extended by ONLY one or more of their value
|
||||||
* but must be fully replaced with new values
|
* but must be fully replaced with new values
|
||||||
|
Reference in New Issue
Block a user