Skip to content

Commit

Permalink
Fix legacy cache purger when eZ is not yet installed
Browse files Browse the repository at this point in the history
  • Loading branch information
Jérôme Vieilledent committed Jul 30, 2013
1 parent 47da9ce commit a0fe058
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion eZ/Bundle/EzPublishLegacyBundle/Cache/LegacyCachePurger.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

namespace eZ\Bundle\EzPublishLegacyBundle\Cache;

use eZ\Bundle\EzPublishLegacyBundle\LegacyMapper\Configuration;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpKernel\CacheClearer\CacheClearerInterface;
use eZCacheHelper;
use eZCLI;
Expand All @@ -26,9 +28,16 @@ class LegacyCachePurger implements CacheClearerInterface
*/
private $legacyKernelClosure;

public function __construct( \Closure $legacyKernelClosure )
public function __construct( \Closure $legacyKernelClosure, Configuration $configurationMapper, Filesystem $fs, $legacyRootDir )
{
$this->legacyKernelClosure = $legacyKernelClosure;

// If ezp_extension.php doesn't exist, it means that eZ Publish is not yet installed.
// Hence we deactivate configuration mapper to avoid potential issues (e.g. ezxFormToken which cannot be loaded).
if ( !$fs->exists( "$legacyRootDir/var/autoload/ezp_extension.php" ) )
{
$configurationMapper->setIsEnabled( false );
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ services:

ezpublish_legacy.legacy_cache_purger:
class: %ezpublish_legacy.legacy_cache_purger.class%
arguments: [@ezpublish_legacy.kernel]
arguments: [@ezpublish_legacy.kernel, @ezpublish_legacy.configuration_mapper, @filesystem, %ezpublish_legacy.root_dir%]
tags:
- { name: kernel.cache_clearer }

Expand Down

0 comments on commit a0fe058

Please sign in to comment.