Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX] Flush core caches in low level flush #552

Merged
merged 1 commit into from
Sep 5, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 16 additions & 4 deletions Classes/Service/CacheService.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,22 @@ class CacheService implements SingletonInterface
*/
protected $configurationService;

/**
* @var ConsoleBootstrap
*/
private $bootstrap;

/**
* Builds the dependencies correctly
*
* @param CacheManager $cacheManager
* @param ConfigurationService $configurationService
*/
public function __construct(CacheManager $cacheManager, ConfigurationService $configurationService)
public function __construct(CacheManager $cacheManager, ConfigurationService $configurationService, ConsoleBootstrap $bootstrap = null)
{
$this->cacheManager = $cacheManager;
$this->configurationService = $configurationService;
$this->bootstrap = $bootstrap ?: ConsoleBootstrap::getInstance();
}

/**
Expand Down Expand Up @@ -175,6 +181,11 @@ public function getValidCacheGroups()
return array_unique($validGroups);
}

private function reEnableCoreCaches()
{
Scripts::reEnableOriginalCoreCaches($this->bootstrap);
}

/**
* @deprecated can be removed when TYPO3 7.6 support is removed
*/
Expand All @@ -188,7 +199,7 @@ private function ensureDatabaseIsInitialized()
// Already initialized
return;
}
ConsoleBootstrap::getInstance()->initializeDatabaseConnection();
$this->bootstrap->initializeDatabaseConnection();
}

private function ensureBackendUserIsInitialized()
Expand All @@ -197,7 +208,7 @@ private function ensureBackendUserIsInitialized()
// Already initialized
return;
}
Scripts::initializeAuthenticatedOperations(ConsoleBootstrap::getInstance());
Scripts::initializeAuthenticatedOperations($this->bootstrap);
}

/**
Expand All @@ -219,8 +230,9 @@ private function ensureCacheGroupsExist($groups)
*/
private function getFileCaches()
{
$this->reEnableCoreCaches();
$fileCaches = [];
foreach ($this->configurationService->getActive('SYS/caching/cacheConfigurations') as $identifier => $cacheConfiguration) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations'] as $identifier => $cacheConfiguration) {
if (
isset($cacheConfiguration['backend'])
&& (
Expand Down