[BUGFIX] Install Tool fatal with Oracle database
[Packages/TYPO3.CMS.git] / typo3 / sysext / install / Classes / Controller / Action / Step / DefaultConfiguration.php
1 <?php
2 namespace TYPO3\CMS\Install\Controller\Action\Step;
3
4 /***************************************************************
5 * Copyright notice
6 *
7 * (c) 2013 Christian Kuhn <lolli@schwarzbu.ch>
8 * All rights reserved
9 *
10 * This script is part of the TYPO3 project. The TYPO3 project is
11 * free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * The GNU General Public License can be found at
17 * http://www.gnu.org/copyleft/gpl.html.
18 *
19 * This script is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * This copyright notice MUST APPEAR in all copies of the script!
25 ***************************************************************/
26
27 use TYPO3\CMS\Install\Controller\Action;
28
29 /**
30 * Set production defaults
31 */
32 class DefaultConfiguration extends Action\AbstractAction implements StepInterface {
33
34 /**
35 * Set defaults of auto configuration, mark installation as completed
36 *
37 * @return array<\TYPO3\CMS\Install\Status\StatusInterface>
38 */
39 public function execute() {
40 /** @var \TYPO3\CMS\Install\Configuration\FeatureManager $featureManager */
41 $featureManager = $this->objectManager->get('TYPO3\\CMS\\Install\\Configuration\\FeatureManager');
42 // Get best matching configuration presets
43 $configurationValues = $featureManager->getBestMatchingConfigurationForAllFeatures();
44
45 // Setting SYS/isInitialInstallationInProgress to FALSE marks this instance installation as complete
46 $configurationValues['SYS/isInitialInstallationInProgress'] = FALSE;
47
48 /** @var $configurationManager \TYPO3\CMS\Core\Configuration\ConfigurationManager */
49 $configurationManager = $this->objectManager->get('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager');
50 $configurationManager->setLocalConfigurationValuesByPathValuePairs($configurationValues);
51
52 /** @var \TYPO3\CMS\Install\Service\SessionService $session */
53 $session = $this->objectManager->get('TYPO3\\CMS\\Install\\Service\\SessionService');
54 $session->destroySession();
55
56 /** @var $formProtection \TYPO3\CMS\Core\FormProtection\InstallToolFormProtection */
57 $formProtection = \TYPO3\CMS\Core\FormProtection\FormProtectionFactory::get(
58 'TYPO3\\CMS\\Core\\FormProtection\\InstallToolFormProtection'
59 );
60 $formProtection->clean();
61
62 // @TODO: This and similar code in ToolController should be moved to enable install file service
63 $enableInstallToolFile = PATH_site . 'typo3conf/ENABLE_INSTALL_TOOL';
64 if (is_file($enableInstallToolFile) && trim(file_get_contents($enableInstallToolFile)) !== 'KEEP_FILE') {
65 unlink($enableInstallToolFile);
66 }
67
68 \TYPO3\CMS\Core\Utility\HttpUtility::redirect('../../../index.php', \TYPO3\CMS\Core\Utility\HttpUtility::HTTP_STATUS_303);
69 }
70
71 /**
72 * Step needs to be executed if 'isInitialInstallationInProgress' is set to TRUE in LocalConfiguration
73 *
74 * @return boolean
75 */
76 public function needsExecution() {
77 $result = FALSE;
78 if (isset($GLOBALS['TYPO3_CONF_VARS']['SYS']['isInitialInstallationInProgress'])
79 && $GLOBALS['TYPO3_CONF_VARS']['SYS']['isInitialInstallationInProgress'] === TRUE
80 ) {
81 $result = TRUE;
82 }
83 return $result;
84 }
85
86 /**
87 * Render this step
88 *
89 * @return string
90 */
91 public function handle() {
92 $this->initializeHandle();
93 return $this->view->render();
94 }
95 }