From 1a18604033129c48f508f0a820edd74c5b2eeb3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20B=C3=BCrk?= <stefan@buerk.tech> Date: Wed, 6 Sep 2023 12:43:22 +0200 Subject: [PATCH] [BUGFIX] Ensure package state file using the setup command MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With #99221 the cli setup command has been introduced to setup a instance from the command line and improved with followup changes. This works pretty fine in composer mode installations. In non-composer mode installations the package state file is not created using the cli command whereas the web based installation process creates one. This change ensures that a package state file is created if none exists. If no file is found, it creates it based on default factory settings like the installer. Resolves: #101678 Related: #100719 Related: #99221 Releases: main, 12.4 Change-Id: I022c4300131d0eca82569ef0463d0c0078c53055 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/80900 Tested-by: Stefan Bürk <stefan@buerk.tech> Tested-by: core-ci <typo3@b13.com> Reviewed-by: Stefan Bürk <stefan@buerk.tech> --- typo3/sysext/install/Classes/Command/SetupCommand.php | 6 +++++- typo3/sysext/install/Classes/Service/SetupService.php | 4 +++- typo3/sysext/install/Classes/ServiceProvider.php | 3 ++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/typo3/sysext/install/Classes/Command/SetupCommand.php b/typo3/sysext/install/Classes/Command/SetupCommand.php index 30e03a309e0b..e38f99adaa8a 100644 --- a/typo3/sysext/install/Classes/Command/SetupCommand.php +++ b/typo3/sysext/install/Classes/Command/SetupCommand.php @@ -28,6 +28,7 @@ use Symfony\Component\Console\Question\ConfirmationQuestion; use Symfony\Component\Console\Question\Question; use TYPO3\CMS\Core\Configuration\ConfigurationManager; use TYPO3\CMS\Core\Database\ConnectionPool; +use TYPO3\CMS\Core\Package\FailsafePackageManager; use TYPO3\CMS\Core\Resource\Exception\ExistingTargetFileNameException; use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -56,7 +57,8 @@ class SetupCommand extends Command private readonly SetupDatabaseService $setupDatabaseService, private readonly SetupService $setupService, private readonly ConfigurationManager $configurationManager, - private readonly LateBootService $lateBootService + private readonly LateBootService $lateBootService, + private readonly FailsafePackageManager $packageManager, ) { parent::__construct($name); @@ -210,6 +212,8 @@ EOT $serverType = $this->getServerType($questionHelper, $input, $output); $folderStructureFactory = GeneralUtility::makeInstance(DefaultFactory::class); $folderStructureFactory->getStructure($serverType)->fix(); + // Ensure existing PackageStates.php for non-composer installation. + $this->packageManager->recreatePackageStatesFileIfMissing(true); try { $force = $input->getOption('force'); diff --git a/typo3/sysext/install/Classes/Service/SetupService.php b/typo3/sysext/install/Classes/Service/SetupService.php index 94c55991d320..bedc731a57d4 100644 --- a/typo3/sysext/install/Classes/Service/SetupService.php +++ b/typo3/sysext/install/Classes/Service/SetupService.php @@ -135,7 +135,9 @@ class SetupService ); } - // @todo: Remove once LocalConfiguration.php support was dropped. + // @todo Remove once LocalConfiguration.php support was dropped. + // @todo Web installer creates default configuration based on default factory configuration. Recheck if we + // should use this here too instead of an empty array. // Ugly hack to write system/settings.php, to avoid fallback to // LocalConfiguration.php causing issues because it does not exist! @unlink($configurationFileLocation); diff --git a/typo3/sysext/install/Classes/ServiceProvider.php b/typo3/sysext/install/Classes/ServiceProvider.php index f72e507cf137..a2d41531d273 100644 --- a/typo3/sysext/install/Classes/ServiceProvider.php +++ b/typo3/sysext/install/Classes/ServiceProvider.php @@ -359,7 +359,8 @@ class ServiceProvider extends AbstractServiceProvider $container->get(Service\SetupDatabaseService::class), $container->get(Service\SetupService::class), $container->get(ConfigurationManager::class), - $container->get(LateBootService::class) + $container->get(LateBootService::class), + $container->get(FailsafePackageManager::class), ); } -- GitLab