2 namespace TYPO3\CMS\Install\Controller;
29 'environmentAndFolders',
33 'defaultConfiguration',
47 $this->loadBaseExtensions();
48 $this->initializeObjectManager();
50 $this->outputInstallToolNotEnabledMessageIfNeeded();
51 $this->outputInstallToolPasswordNotSetMessageIfNeeded();
52 $this->recreatePackageStatesFileIfNotExisting();
53 $this->executeOrOutputFirstInstallStepIfNeeded();
54 $this->adjustTrustedHostsPatternIfNeeded();
55 $this->executeSilentConfigurationUpgradesIfNeeded();
56 $this->initializeSession();
57 $this->checkSessionToken();
59 $this->loginIfRequested();
78 if ($action && isset($postValues[
'set']) && $postValues[
'set'] ===
'execute') {
79 $stepAction = $this->getActionInstance($action);
80 $stepAction->setAction($action);
81 $stepAction->setToken($this->generateTokenForAction($action));
83 $messages = $stepAction->execute();
100 if ($action ===
'') {
104 $stepAction = $this->getActionInstance($action);
105 $stepAction->setAction($action);
106 $stepAction->setController(
'step');
107 $stepAction->setToken($this->generateTokenForAction($action));
110 $needsExecution =
true;
114 $needsExecution = $stepAction->needsExecution();
115 }
catch (
Exception\RedirectException $e) {
119 if ($needsExecution) {
120 if ($this->isInitialInstallationInProgress()) {
121 $currentStep = (array_search($action, $this->authenticationActions) + 1);
122 $totalSteps = count($this->authenticationActions);
123 $stepAction->setStepsCounter($currentStep, $totalSteps);
125 $stepAction->setMessages($this->session->getMessagesAndFlush());
126 $this->
output($stepAction->handle());
129 $currentPosition = array_keys($this->authenticationActions, $action,
true);
130 $nextAction = array_slice($this->authenticationActions, $currentPosition[0] + 1, 1);
131 if (!empty($nextAction)) {
132 $this->
redirect(
'', $nextAction[0]);
144 protected function getActionInstance($action)
147 $actionClass = ucfirst($action);
149 $stepAction = $this->objectManager->get(
'TYPO3\\CMS\\Install\\Controller\\Action\\Step\\' . $actionClass);
150 if (!($stepAction instanceof Action\Step\StepInterface)) {
152 $action .
' does non implement StepInterface',
183 protected function recreatePackageStatesFileIfNotExisting()
186 $configurationManager = $this->objectManager->get(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
187 $localConfigurationFileLocation = $configurationManager->getLocalConfigurationFileLocation();
188 $localConfigurationFileExists = is_file($localConfigurationFileLocation);
189 $packageStatesFilePath = PATH_typo3conf .
'PackageStates.php';
190 $localConfigurationBackupFilePath = preg_replace(
192 '.beforePackageStatesMigration.php',
193 $configurationManager->getLocalConfigurationFileLocation()
196 if (file_exists($packageStatesFilePath)
197 || (is_dir(PATH_typo3conf) && !$localConfigurationFileExists)
198 || !is_dir(PATH_typo3conf)
205 $packageManager = \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->getEarlyInstance(\TYPO3\CMS\Core\Package\PackageManager::class);
208 $packages = $packageManager->getAvailablePackages();
209 foreach ($packages as $package) {
211 if ($package instanceof \TYPO3\CMS\Core\Package\PackageInterface
212 && $package->isPartOfMinimalUsableSystem()
214 $packageManager->activatePackage($package->getPackageKey());
220 $configurationManager->getLocalConfigurationFileLocation(),
221 $localConfigurationBackupFilePath
224 $packageManager->forceSortAndSavePackageStates();
228 }
catch (\Exception $exception) {
229 if (file_exists($packageStatesFilePath)) {
230 unlink($packageStatesFilePath);
232 if (file_exists($localConfigurationBackupFilePath)) {
233 unlink($localConfigurationBackupFilePath);
253 protected function executeOrOutputFirstInstallStepIfNeeded()
257 $wasExecuted =
false;
258 $errorMessagesFromExecute = array();
259 if (isset($postValues[
'action'])
260 && $postValues[
'action'] ===
'environmentAndFolders'
263 $action = $this->objectManager->get(\TYPO3\CMS\Install\Controller\Action\Step\EnvironmentAndFolders::class);
264 $errorMessagesFromExecute = $action->execute();
269 $action = $this->objectManager->get(\TYPO3\CMS\Install\Controller\Action\Step\EnvironmentAndFolders::class);
271 $needsExecution =
true;
275 $needsExecution = $action->needsExecution();
276 }
catch (Exception\RedirectException $e) {
280 $testReflection = new \ReflectionMethod(get_class($this), __FUNCTION__);
281 if (!@is_dir(PATH_typo3conf)
283 || $testReflection->getDocComment() === false
286 $action = $this->objectManager->get(\TYPO3\CMS\Install\Controller\Action\Step\EnvironmentAndFolders::class);
287 if ($this->isInitialInstallationInProgress()) {
288 $currentStep = (array_search(
'environmentAndFolders', $this->authenticationActions) + 1);
289 $totalSteps = count($this->authenticationActions);
290 $action->setStepsCounter($currentStep, $totalSteps);
292 $action->setController(
'step');
293 $action->setAction(
'environmentAndFolders');
294 if (!empty($errorMessagesFromExecute)) {
295 $action->setMessages($errorMessagesFromExecute);
297 $this->
output($action->handle());
308 protected function adjustTrustedHostsPatternIfNeeded()
315 $configurationManager = $this->objectManager->get(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
316 $configurationManager->setLocalConfigurationValueByPath(
'SYS/trustedHostsPattern',
'.*');
325 protected function executeSilentConfigurationUpgradesIfNeeded()
328 $upgradeService = $this->objectManager->get(SilentConfigurationUpgradeService::class);
330 $upgradeService->execute();
331 }
catch (Exception\RedirectException $e) {