TYPO3  7.6
BackendModuleController.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Install\Controller;
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 
27 {
31  protected $enableFileService;
32 
36  protected $formProtection;
37 
41  public function injectEnableFileService(\TYPO3\CMS\Install\Service\EnableFileService $enableFileService)
42  {
43  $this->enableFileService = $enableFileService;
44  }
45 
49  public function initializeAction()
50  {
51  $this->formProtection = \TYPO3\CMS\Core\FormProtection\FormProtectionFactory::get();
52  }
53 
59  public function indexAction()
60  {
61  if ($this->enableFileService->checkInstallToolEnableFile()) {
62  $this->redirect('sysext/install/Start/Install.php?install[context]=backend');
63  } else {
64  $this->forward('showEnableInstallToolButton');
65  }
66  }
67 
74  {
75  $token = $this->formProtection->generateToken('installTool');
76  $this->view->assign('installToolEnableToken', $token);
77  }
78 
85  public function enableInstallToolAction($installToolEnableToken)
86  {
87  if (!$this->formProtection->validateToken($installToolEnableToken, 'installTool')) {
88  throw new \RuntimeException('Given form token was not valid', 1369161225);
89  }
90  $this->enableFileService->createInstallToolEnableFile();
91  $this->forward('index');
92  }
93 
99  protected function redirect($uri)
100  {
101  \TYPO3\CMS\Core\Utility\HttpUtility::redirect($uri);
102  }
103 }