28 'environmentAndFolders',
32 'defaultConfiguration',
45 $this->loadBaseExtensions();
46 $this->initializeObjectManager();
48 $this->outputInstallToolNotEnabledMessageIfNeeded();
49 $this->migrateLocalconfToLocalConfigurationIfNeeded();
50 $this->outputInstallToolPasswordNotSetMessageIfNeeded();
51 $this->migrateExtensionListToPackageStatesFile();
52 $this->executeOrOutputFirstInstallStepIfNeeded();
53 $this->executeSilentConfigurationUpgradesIfNeeded();
54 $this->initializeSession();
55 $this->checkSessionToken();
57 $this->loginIfRequested();
75 if ($action && isset($postValues[
'set']) && $postValues[
'set'] ===
'execute') {
76 $stepAction = $this->getActionInstance($action);
77 $stepAction->setAction($action);
78 $stepAction->setToken($this->generateTokenForAction($action));
80 $messages = $stepAction->execute();
100 $stepAction = $this->getActionInstance($action);
101 $stepAction->setAction($action);
102 $stepAction->setController(
'step');
103 $stepAction->setToken($this->generateTokenForAction($action));
106 $needsExecution = TRUE;
110 $needsExecution = $stepAction->needsExecution();
111 }
catch (
Exception\RedirectException $e) {
115 if ($needsExecution) {
116 if ($this->isInitialInstallationInProgress()) {
117 $currentStep = (array_search($action, $this->authenticationActions) + 1);
118 $totalSteps = count($this->authenticationActions);
119 $stepAction->setStepsCounter($currentStep, $totalSteps);
121 $stepAction->setMessages($this->session->getMessagesAndFlush());
122 $this->
output($stepAction->handle());
125 $currentPosition = array_keys($this->authenticationActions, $action, TRUE);
126 $nextAction = array_slice($this->authenticationActions, $currentPosition[0] + 1, 1);
127 if (!empty($nextAction)) {
128 $this->
redirect(
'', $nextAction[0]);
140 protected function getActionInstance($action) {
142 $actionClass = ucfirst($action);
144 $stepAction = $this->objectManager->get(
'TYPO3\\CMS\\Install\\Controller\\Action\\Step\\' . $actionClass);
145 if (!($stepAction instanceof Action\Step\StepInterface)) {
147 $action .
' does non implement StepInterface',
174 protected function migrateLocalconfToLocalConfigurationIfNeeded() {
176 $configurationManager = $this->objectManager->get(
'TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager');
178 $localConfigurationFileLocation = $configurationManager->getLocalConfigurationFileLocation();
179 $localConfigurationFileExists = is_file($localConfigurationFileLocation);
180 $localConfFileLocation = PATH_typo3conf .
'localconf.php';
181 $localConfFileExists = is_file($localConfFileLocation);
183 if (is_dir(PATH_typo3conf) && $localConfFileExists && !$localConfigurationFileExists) {
184 $localConfContent = file($localConfFileLocation);
187 $typo3ConfigurationVariables = array();
188 $typo3DatabaseVariables = array();
189 $additionalConfiguration = array();
190 foreach ($localConfContent as $line) {
195 preg_match(
'/^\\$TYPO3_CONF_VARS\\[\'EXT\'\\]\\[\'extList\'\\] *={1} *\'(.+)\';{1}/', $line, $matches) === 1
196 || preg_match(
'/^\\$GLOBALS\\[\'TYPO3_CONF_VARS\'\\]\\[\'EXT\'\\]\\[\'extList\'\\] *={1} *\'(.+)\';{1}/', $line, $matches) === 1
199 $typo3ConfigurationVariables[] =
'$TYPO3_CONF_VARS[\'EXT\'][\'extListArray\'] = ' . var_export($extListAsArray, TRUE) .
';';
201 preg_match(
'/^\\$TYPO3_CONF_VARS.+;{1}/', $line, $matches) === 1
203 $typo3ConfigurationVariables[] = $matches[0];
205 preg_match(
'/^\\$GLOBALS\\[\'TYPO3_CONF_VARS\'\\].+;{1}/', $line, $matches) === 1
207 $lineWithoutGlobals = str_replace(
'$GLOBALS[\'TYPO3_CONF_VARS\']',
'$TYPO3_CONF_VARS', $matches[0]);
208 $typo3ConfigurationVariables[] = $lineWithoutGlobals;
210 preg_match(
'/^\\$typo_db.+;{1}/', $line, $matches) === 1
213 if (isset($typo_db_host)) {
214 $typo3DatabaseVariables[
'host'] = $typo_db_host;
215 } elseif (isset($typo_db)) {
216 $typo3DatabaseVariables[
'database'] = $typo_db;
217 } elseif (isset($typo_db_username)) {
218 $typo3DatabaseVariables[
'username'] = $typo_db_username;
219 } elseif (isset($typo_db_password)) {
220 $typo3DatabaseVariables[
'password'] = $typo_db_password;
221 } elseif (isset($typo_db_extTableDef_script)) {
222 $typo3DatabaseVariables[
'extTablesDefinitionScript'] = $typo_db_extTableDef_script;
224 unset($typo_db_host, $typo_db, $typo_db_username, $typo_db_password, $typo_db_extTableDef_script);
226 strlen($line) > 0 && preg_match(
'/^\\/\\/.+|^#.+|^<\\?php$|^<\\?$|^\\?>$/', $line, $matches) === 0
228 $additionalConfiguration[] = $line;
235 $evalData = implode(LF, $typo3ConfigurationVariables);
246 if (
sizeof($additionalConfiguration) > 0) {
247 $configurationManager->writeAdditionalConfiguration($additionalConfiguration);
249 @unlink($configurationManager->getAdditionalConfigurationFileLocation());
253 rename($localConfFileLocation, PATH_site .
'typo3conf/localconf.obsolete.php');
276 protected function migrateExtensionListToPackageStatesFile() {
278 $configurationManager = $this->objectManager->get(
'TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager');
279 $localConfigurationFileLocation = $configurationManager->getLocalConfigurationFileLocation();
280 $localConfigurationFileExists = is_file($localConfigurationFileLocation);
281 $packageStatesFilePath = PATH_typo3conf .
'PackageStates.php';
282 $localConfigurationBackupFilePath = preg_replace(
284 '.beforePackageStatesMigration.php',
285 $configurationManager->getLocalConfigurationFileLocation()
288 if (file_exists($packageStatesFilePath)
289 || (is_dir(PATH_typo3conf) && !$localConfigurationFileExists)
290 || !is_dir(PATH_typo3conf)
300 $packages = $packageManager->getAvailablePackages();
301 foreach ($packages as $package) {
303 if ($package instanceof \
TYPO3\CMS\Core\Package\PackageInterface
304 && $package->isPartOfMinimalUsableSystem()
306 $packageManager->activatePackage($package->getPackageKey());
311 $extensionsFromExtListArray = array();
313 $extensionsFromExtListArray = $configurationManager->getLocalConfigurationValueByPath(
'EXT/extListArray');
314 }
catch (\RuntimeException $exception) {
316 foreach ($extensionsFromExtListArray as $loadedExtension) {
318 $packageManager->activatePackage($loadedExtension);
319 }
catch (\
TYPO3\Flow\Package\
Exception\UnknownPackageException $exception) {
326 $configurationManager->getLocalConfigurationFileLocation(),
327 $localConfigurationBackupFilePath
330 $packageManager->forceSortAndSavePackageStates();
335 if (file_exists($packageStatesFilePath)) {
336 unlink($packageStatesFilePath);
338 if (file_exists($localConfigurationBackupFilePath)) {
339 unlink($localConfigurationBackupFilePath);
359 protected function executeOrOutputFirstInstallStepIfNeeded() {
362 $wasExecuted = FALSE;
363 $errorMessagesFromExecute = array();
364 if (isset($postValues[
'action'])
365 && $postValues[
'action'] ===
'environmentAndFolders' 368 $action = $this->objectManager->get(
'TYPO3\\CMS\\Install\\Controller\\Action\\Step\\EnvironmentAndFolders');
369 $errorMessagesFromExecute = $action->execute();
374 $action = $this->objectManager->get(
'TYPO3\\CMS\\Install\\Controller\\Action\\Step\\EnvironmentAndFolders');
376 $needsExecution = TRUE;
380 $needsExecution = $action->needsExecution();
381 }
catch (
Exception\RedirectException $e) {
385 $testReflection = new \ReflectionMethod(get_class($this), __FUNCTION__);
386 if (!@is_dir(PATH_typo3conf)
388 || $testReflection->getDocComment() === FALSE
391 $action = $this->objectManager->get(
'TYPO3\\CMS\\Install\\Controller\\Action\\Step\\EnvironmentAndFolders');
392 if ($this->isInitialInstallationInProgress()) {
393 $currentStep = (array_search(
'environmentAndFolders', $this->authenticationActions) + 1);
394 $totalSteps = count($this->authenticationActions);
395 $action->setStepsCounter($currentStep, $totalSteps);
397 $action->setController(
'step');
398 $action->setAction(
'environmentAndFolders');
399 if (count($errorMessagesFromExecute) > 0) {
400 $action->setMessages($errorMessagesFromExecute);
402 $this->
output($action->handle());
415 protected function executeSilentConfigurationUpgradesIfNeeded() {
417 $upgradeService = $this->objectManager->get(
418 'TYPO3\\CMS\\Install\\Service\\SilentConfigurationUpgradeService' 421 $upgradeService->execute();
422 }
catch (
Exception\RedirectException $e) {
$TYPO3_CONF_VARS['SYS']['contentTable']
static trimExplode($delim, $string, $removeEmptyValues=FALSE, $limit=0)
outputLoginFormIfNotAuthorized()
redirect($controller='', $action='')
static sortByKeyRecursive(array $array)
addSessionMessages(array $messages)
validateAuthenticationAction($action)