Skip to content

Commit

Permalink
Fixed EZP-20757 - %secret% key should be generated at install/update
Browse files Browse the repository at this point in the history
  • Loading branch information
lolautruche committed Apr 30, 2013
1 parent 29da705 commit 33a70a8
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 30 deletions.
3 changes: 2 additions & 1 deletion composer.json
Expand Up @@ -29,7 +29,8 @@
"symfony-cmf/routing": "1.0.*",
"qafoo/rmf": "1.0.*",
"kriswallsmith/buzz": ">=0.9",
"tedivm/stash-bundle": "@dev"
"tedivm/stash-bundle": "@dev",
"sensio/distribution-bundle": "2.2.*"
},
"require-dev": {
"ezsystems/ezpublish-legacy": "@dev",
Expand Down
105 changes: 78 additions & 27 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -165,7 +165,12 @@ services:

ezpublish_legacy.setup_wizard.configuration_dumper:
class: %ezpublish_legacy.setup_wizard.configuration_dumper.class%
arguments: [@filesystem, %ezpublish_legacy.setup_wizard.configuration_dumper.environments%, %kernel.root_dir%, %kernel.cache_dir%]
arguments:
- @filesystem
- %ezpublish_legacy.setup_wizard.configuration_dumper.environments%
- %kernel.root_dir%
- %kernel.cache_dir%
- @?sensio.distribution.webconfigurator

# Image alias generator using legacy
ezpublish_legacy.fieldType.ezimage.variation_service:
Expand Down
Expand Up @@ -9,6 +9,7 @@

namespace eZ\Bundle\EzPublishLegacyBundle\SetupWizard;

use Sensio\Bundle\DistributionBundle\Configurator\Configurator;
use eZ\Publish\Core\MVC\Symfony\ConfigDumperInterface;
use Symfony\Component\Yaml\Yaml;
use Symfony\Component\Filesystem\Filesystem;
Expand All @@ -20,6 +21,11 @@ class ConfigurationDumper implements ConfigDumperInterface
*/
protected $fs;

/**
* @var \Sensio\Bundle\DistributionBundle\Configurator\Configurator
*/
protected $sensioConfigurator;

/**
* Path to root dir (kernel.root_dir)
*
Expand All @@ -42,12 +48,13 @@ class ConfigurationDumper implements ConfigDumperInterface
*/
protected $envs;

public function __construct( Filesystem $fs, array $envs, $rootDir, $cacheDir )
public function __construct( Filesystem $fs, array $envs, $rootDir, $cacheDir, Configurator $sensioConfigurator = null )
{
$this->fs = $fs;
$this->rootDir = $rootDir;
$this->cacheDir = $cacheDir;
$this->envs = array_fill_keys( $envs, true );
$this->sensioConfigurator = $sensioConfigurator;
}

/**
Expand Down Expand Up @@ -97,6 +104,18 @@ public function dump( array $configArray, $options = ConfigDumperInterface::OPT_
file_put_contents( $configFile, Yaml::dump( $envConfigArray, 7 ) );
}

// Handling %secret%
if ( $this->sensioConfigurator !== null )
{
$this->sensioConfigurator->mergeParameters(
array(
// Step #1 is SecretStep
'secret' => $this->sensioConfigurator->getStep( 1 )->secret
)
);
$this->sensioConfigurator->write();
}

$this->clearCache();
}

Expand Down

0 comments on commit 33a70a8

Please sign in to comment.