[!!!][TASK] Rewrite install tool
[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 // @TODO: Implement "auto configuration"
41
42 /** @var $configurationManager \TYPO3\CMS\Core\Configuration\ConfigurationManager */
43 $configurationManager = $this->objectManager->get('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager');
44 $configurationManager->setLocalConfigurationValueByPath('SYS/isInitialInstallationInProgress', FALSE);
45
46 /** @var \TYPO3\CMS\Install\Service\SessionService $session */
47 $session = $this->objectManager->get('TYPO3\\CMS\\Install\\Service\\SessionService');
48 $session->destroySession();
49
50 /** @var $formProtection \TYPO3\CMS\Core\FormProtection\InstallToolFormProtection */
51 $formProtection = \TYPO3\CMS\Core\FormProtection\FormProtectionFactory::get(
52 'TYPO3\\CMS\\Core\\FormProtection\\InstallToolFormProtection'
53 );
54 $formProtection->clean();
55
56 // @TODO: This and similar code in ToolController should be moved to enable install file service
57 $enableInstallToolFile = PATH_site . 'typo3conf/ENABLE_INSTALL_TOOL';
58 if (is_file($enableInstallToolFile) && trim(file_get_contents($enableInstallToolFile)) !== 'KEEP_FILE') {
59 unlink($enableInstallToolFile);
60 }
61
62 \TYPO3\CMS\Core\Utility\HttpUtility::redirect('../../../index.php', \TYPO3\CMS\Core\Utility\HttpUtility::HTTP_STATUS_303);
63 }
64
65 /**
66 * Step needs to be executed if 'isInitialInstallationInProgress' is set to TRUE in LocalConfiguration
67 *
68 * @return boolean
69 */
70 public function needsExecution() {
71 $result = FALSE;
72 if (isset($GLOBALS['TYPO3_CONF_VARS']['SYS']['isInitialInstallationInProgress'])
73 && $GLOBALS['TYPO3_CONF_VARS']['SYS']['isInitialInstallationInProgress'] === TRUE
74 ) {
75 $result = TRUE;
76 }
77 return $result;
78 }
79
80 /**
81 * Render this step
82 *
83 * @return string
84 */
85 public function handle() {
86 $this->initialize();
87 return $this->view->render();
88 }
89 }
90 ?>