2 namespace TYPO3\CMS\Install\Controller
;
4 /***************************************************************
7 * (c) 2013 Christian Kuhn <lolli@schwarzbu.ch>
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.
16 * The GNU General Public License can be found at
17 * http://www.gnu.org/copyleft/gpl.html.
18 * A copy is found in the textfile GPL.txt and important notices to the license
19 * from the author is found in LICENSE.txt distributed with these scripts.
22 * This script is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
27 * This copyright notice MUST APPEAR in all copies of the script!
28 ***************************************************************/
31 * Backend module controller
33 * Embeds in backend an only shows the 'enable install tool button' or redirects
34 * to step installer if install tool is enabled.
36 * This is a classic extbase module that does not interfere with the other code
37 * within the install tool.
39 class BackendModuleController
extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController
{
42 * @var \TYPO3\CMS\Install\Service\EnableFileService
45 protected $enableFileService;
48 * @var \TYPO3\CMS\Core\FormProtection\AbstractFormProtection
50 protected $formProtection;
53 * Set formprotection property
55 public function initializeAction() {
56 $this->formProtection
= \TYPO3\CMS\Core\FormProtection\FormProtectionFactory
::get();
60 * Index action shows install tool / step installer or redirect to action to enable install tool
64 public function indexAction() {
65 if ($this->enableFileService
->checkInstallToolEnableFile()) {
66 // Install Tool is already enabled
67 $this->enableFileService
->extendInstallToolEnableFileLifetime();
68 $this->redirect('sysext/install/Start/Install.php?install[context]=backend');
70 $this->forward('showEnableInstallToolButton');
75 * Show enable install tool
79 public function showEnableInstallToolButtonAction() {
80 $token = $this->formProtection
->generateToken('installTool');
81 $this->view
->assign('installToolEnableToken', $token);
85 * Enable the install tool
87 * @param string $installToolEnableToken
88 * @throws \RuntimeException
90 public function enableInstallToolAction($installToolEnableToken) {
91 if (!$this->formProtection
->validateToken($installToolEnableToken, 'installTool')) {
92 throw new \
RuntimeException('Given form token was not valid', 1369161225);
94 $this->enableFileService
->createInstallToolEnableFile();
95 $this->forward('index');
99 * Redirect to specified URI
103 protected function redirect($uri) {
104 \TYPO3\CMS\Core\Utility\HttpUtility
::redirect($uri);