[TASK] Use fully qualified name resolution in PHP 5.5
[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 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 use TYPO3\CMS\Install\Service\EnableFileService;
18
19 /**
20 * Set production defaults
21 */
22 class DefaultConfiguration extends AbstractStepAction {
23
24 /**
25 * Set defaults of auto configuration, mark installation as completed
26 *
27 * @return array<\TYPO3\CMS\Install\Status\StatusInterface>
28 */
29 public function execute() {
30 /** @var \TYPO3\CMS\Install\Configuration\FeatureManager $featureManager */
31 $featureManager = $this->objectManager->get('TYPO3\\CMS\\Install\\Configuration\\FeatureManager');
32 // Get best matching configuration presets
33 $configurationValues = $featureManager->getBestMatchingConfigurationForAllFeatures();
34
35 // let the admin user redirect to the distributions page on first login
36 if (isset($this->postValues['values']['loaddistributions'])) {
37
38 // update the admin backend user to show the distribution management on login
39 $adminUserFirstLogin = array('startModuleOnFirstLogin' => 'tools_ExtensionmanagerExtensionmanager->tx_extensionmanager_tools_extensionmanagerextensionmanager%5Baction%5D=distributions&tx_extensionmanager_tools_extensionmanagerextensionmanager%5Bcontroller%5D=List');
40 $this->getDatabaseConnection()->exec_UPDATEquery(
41 'be_users',
42 'admin=1',
43 array('uc' => serialize($adminUserFirstLogin))
44 );
45 }
46
47 // Setting SYS/isInitialInstallationInProgress to FALSE marks this instance installation as complete
48 $configurationValues['SYS/isInitialInstallationInProgress'] = FALSE;
49
50 /** @var $configurationManager \TYPO3\CMS\Core\Configuration\ConfigurationManager */
51 $configurationManager = $this->objectManager->get('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager');
52 $configurationManager->setLocalConfigurationValuesByPathValuePairs($configurationValues);
53
54 /** @var \TYPO3\CMS\Install\Service\SessionService $session */
55 $session = $this->objectManager->get('TYPO3\\CMS\\Install\\Service\\SessionService');
56 $session->destroySession();
57
58 /** @var $formProtection \TYPO3\CMS\Core\FormProtection\InstallToolFormProtection */
59 $formProtection = \TYPO3\CMS\Core\FormProtection\FormProtectionFactory::get(
60 'TYPO3\\CMS\\Core\\FormProtection\\InstallToolFormProtection'
61 );
62 $formProtection->clean();
63
64 if (!EnableFileService::isInstallToolEnableFilePermanent()) {
65 EnableFileService::removeInstallToolEnableFile();
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 bool
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 * Executes the step
88 *
89 * @return string Rendered content
90 */
91 protected function executeAction() {
92 $this->assignSteps();
93 return $this->view->render();
94 }
95 }