Skip to content

Commit a0fe058

Browse files
author
Jérôme Vieilledent
committed
Fix legacy cache purger when eZ is not yet installed
1 parent 47da9ce commit a0fe058

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

eZ/Bundle/EzPublishLegacyBundle/Cache/LegacyCachePurger.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
namespace eZ\Bundle\EzPublishLegacyBundle\Cache;
1111

12+
use eZ\Bundle\EzPublishLegacyBundle\LegacyMapper\Configuration;
13+
use Symfony\Component\Filesystem\Filesystem;
1214
use Symfony\Component\HttpKernel\CacheClearer\CacheClearerInterface;
1315
use eZCacheHelper;
1416
use eZCLI;
@@ -26,9 +28,16 @@ class LegacyCachePurger implements CacheClearerInterface
2628
*/
2729
private $legacyKernelClosure;
2830

29-
public function __construct( \Closure $legacyKernelClosure )
31+
public function __construct( \Closure $legacyKernelClosure, Configuration $configurationMapper, Filesystem $fs, $legacyRootDir )
3032
{
3133
$this->legacyKernelClosure = $legacyKernelClosure;
34+
35+
// If ezp_extension.php doesn't exist, it means that eZ Publish is not yet installed.
36+
// Hence we deactivate configuration mapper to avoid potential issues (e.g. ezxFormToken which cannot be loaded).
37+
if ( !$fs->exists( "$legacyRootDir/var/autoload/ezp_extension.php" ) )
38+
{
39+
$configurationMapper->setIsEnabled( false );
40+
}
3241
}
3342

3443
/**

eZ/Bundle/EzPublishLegacyBundle/Resources/config/services.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ services:
165165

166166
ezpublish_legacy.legacy_cache_purger:
167167
class: %ezpublish_legacy.legacy_cache_purger.class%
168-
arguments: [@ezpublish_legacy.kernel]
168+
arguments: [@ezpublish_legacy.kernel, @ezpublish_legacy.configuration_mapper, @filesystem, %ezpublish_legacy.root_dir%]
169169
tags:
170170
- { name: kernel.cache_clearer }
171171

0 commit comments

Comments
 (0)