fd584df5f75ebd7232a16dc29ab50e92cfd95c42
[Packages/TYPO3.CMS.git] / typo3 / sysext / install / Classes / Controller / Action / Tool / FolderStructure.php
1 <?php
2 namespace TYPO3\CMS\Install\Controller\Action\Tool;
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\Core\Utility\GeneralUtility;
18 use TYPO3\CMS\Install\Controller\Action;
19
20 /**
21 * Handle folder structure
22 */
23 class FolderStructure extends Action\AbstractAction
24 {
25 /**
26 * Executes the tool
27 *
28 * @return string Rendered content
29 */
30 protected function executeAction()
31 {
32 /** @var $folderStructureFactory \TYPO3\CMS\Install\FolderStructure\DefaultFactory */
33 $folderStructureFactory = GeneralUtility::makeInstance(\TYPO3\CMS\Install\FolderStructure\DefaultFactory::class);
34 /** @var $structureFacade \TYPO3\CMS\Install\FolderStructure\StructureFacade */
35 $structureFacade = $folderStructureFactory->getStructure();
36
37 $fixedStatusObjects = array();
38 if (isset($this->postValues['set']['fix'])) {
39 $fixedStatusObjects = $structureFacade->fix();
40 }
41
42 $statusObjects = $structureFacade->getStatus();
43 /** @var $statusUtility \TYPO3\CMS\Install\Status\StatusUtility */
44 $statusUtility = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Status\StatusUtility::class);
45
46 $errorStatus = array_merge(
47 $statusUtility->filterBySeverity($statusObjects, 'error'),
48 $statusUtility->filterBySeverity($statusObjects, 'warning')
49 );
50 $okStatus = array_merge(
51 $statusUtility->filterBySeverity($statusObjects, 'notice'),
52 $statusUtility->filterBySeverity($statusObjects, 'information'),
53 $statusUtility->filterBySeverity($statusObjects, 'ok')
54 );
55
56 /** @var \TYPO3\CMS\Install\FolderStructure\DefaultPermissionsCheck $permissionCheck */
57 $permissionCheck = GeneralUtility::makeInstance(\TYPO3\CMS\Install\FolderStructure\DefaultPermissionsCheck::class);
58 $filePermissionStatus = $permissionCheck->getMaskStatus('fileCreateMask');
59 $directoryPermissionStatus = $permissionCheck->getMaskStatus('folderCreateMask');
60
61 $this->view
62 ->assign('filePermissionStatus', $filePermissionStatus)
63 ->assign('directoryPermissionStatus', $directoryPermissionStatus)
64 ->assign('fixedStatus', $fixedStatusObjects)
65 ->assign('errorStatus', $errorStatus)
66 ->assign('okStatus', $okStatus);
67
68 return $this->view->render();
69 }
70 }