Commit d8dda294 authored by Benjamin Franzke's avatar Benjamin Franzke Committed by Andreas Fernandez
Browse files

[BUGFIX] Provide symfony container in install tool "Check TCA" action

A booted symfony container is needed as ext_localconf.php is
loaded since #89713 for the "Check TCA" action.
ext_localconf.php files may depend on a fully-booted
symfony container, therefore we need to provide it in this
case as well – or ext_localconf.php loading may fail.

Adapt the LateBootService to allow to reset to a
previously backuped container (even if it has been
reset in the meantime by another method).

Currently affected extensions were EXT:news before commit
ac0cb20c (which added a workaround for this case).
Thus the bugfix can be verified against the parent of that commit:
georgringer/news:205cb3e

Releases: master
Resolves: #91073
Related: #89713
Change-Id: Iaceb5efae26c1ae2e08e0db31ff2c223cc803ce7
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64190


Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: default avatarJosef Glatz <josefglatz@gmail.com>
Tested-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Tested-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Reviewed-by: Andreas Fernandez's avatarAndreas Fernandez <a.fernandez@scripting-base.de>
parent 9fb677f6
......@@ -789,6 +789,8 @@ class UpgradeController extends AbstractController
$loadTcaService = GeneralUtility::makeInstance(LoadTcaService::class);
$loadTcaService->loadExtensionTablesWithoutMigration();
$baseTca = $GLOBALS['TCA'];
$container = $this->lateBootService->getContainer();
$backup = $this->lateBootService->makeCurrent($container);
foreach ($this->packageManager->getActivePackages() as $package) {
$this->extensionCompatTesterLoadExtLocalconfForExtension($package);
......@@ -807,6 +809,7 @@ class UpgradeController extends AbstractController
$baseTca = $newTca;
}
}
$this->lateBootService->makeCurrent(null, $backup);
return new JsonResponse([
'success' => true,
'status' => $messageQueue,
......
......@@ -85,15 +85,16 @@ class LateBootService
* is specified
*
* @param ContainerInterface $container
* @param array $oldBackup
* @param array $backup
* @return array
*/
public function makeCurrent(ContainerInterface $container = null, array $oldBackup = []): array
public function makeCurrent(ContainerInterface $container = null, array $backup = []): array
{
$container = $container ?? $this->failsafeContainer;
$container = $container ?? $backup['container'] ?? $this->failsafeContainer;
$backup = [
'singletonInstances', GeneralUtility::getSingletonInstances(),
$newBackup = [
'singletonInstances' => GeneralUtility::getSingletonInstances(),
'container' => GeneralUtility::getContainer(),
];
GeneralUtility::purgeInstances();
......@@ -102,12 +103,12 @@ class LateBootService
GeneralUtility::setContainer($container);
ExtensionManagementUtility::setPackageManager($container->get(PackageManager::class));
$backupSingletonInstances = $oldBackup['singletonInstances'] ?? [];
$backupSingletonInstances = $backup['singletonInstances'] ?? [];
foreach ($backupSingletonInstances as $className => $instance) {
GeneralUtility::setSingletonInstance($className, $instance);
}
return $backup;
return $newBackup;
}
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment