TYPO3 CMS  TYPO3_8-7
EnvironmentAndFolders.php
Go to the documentation of this file.
1 <?php
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 
21 
30 {
38  public function execute()
39  {
41  $folderStructureFactory = GeneralUtility::makeInstance(\TYPO3\CMS\Install\FolderStructure\DefaultFactory::class);
43  $structureFacade = $folderStructureFactory->getStructure();
44  $structureFixMessages = $structureFacade->fix();
46  $statusUtility = GeneralUtility::makeInstance(StatusUtility::class);
47  $errorsFromStructure = $statusUtility->filterBySeverity($structureFixMessages, 'error');
48 
49  if (@is_dir(PATH_typo3conf)) {
51  $configurationManager = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Configuration\ConfigurationManager::class);
52  $configurationManager->createLocalConfigurationFromFactoryConfiguration();
53 
54  // Create a PackageStates.php with all packages activated marked as "part of factory default"
55  if (!file_exists(PATH_typo3conf . 'PackageStates.php')) {
57  $packageManager = \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->getEarlyInstance(\TYPO3\CMS\Core\Package\PackageManager::class);
58  $packages = $packageManager->getAvailablePackages();
59  foreach ($packages as $package) {
61  if ($package instanceof \TYPO3\CMS\Core\Package\PackageInterface
62  && $package->isPartOfFactoryDefault()
63  ) {
64  $packageManager->activatePackage($package->getPackageKey());
65  }
66  }
67  $packageManager->forceSortAndSavePackageStates();
68  }
69 
70  // Create enable install tool file after typo3conf & LocalConfiguration were created
72  $installToolService = GeneralUtility::makeInstance(\TYPO3\CMS\Install\Service\EnableFileService::class);
73  $installToolService->removeFirstInstallFile();
74  $installToolService->createInstallToolEnableFile();
75  }
76 
77  return $errorsFromStructure;
78  }
79 
85  public function needsExecution()
86  {
87  if (@is_file(PATH_typo3conf . 'LocalConfiguration.php')) {
88  return false;
89  }
90  return true;
91  }
92 
98  protected function executeAction()
99  {
100  $statusObjects = array_merge(
101  GeneralUtility::makeInstance(Check::class)->getStatus(),
102  GeneralUtility::makeInstance(SetupCheck::class)->getStatus()
103  );
105  $statusUtility = GeneralUtility::makeInstance(StatusUtility::class);
106  $environmentStatus = $statusUtility->sortBySeverity($statusObjects);
107  $alerts = $statusUtility->filterBySeverity($statusObjects, 'alert');
108  $this->view->assign('alerts', $alerts);
109  $this->view->assign('environmentStatus', $environmentStatus);
110 
112  $folderStructureFactory = GeneralUtility::makeInstance(\TYPO3\CMS\Install\FolderStructure\DefaultFactory::class);
114  $structureFacade = $folderStructureFactory->getStructure();
115  $structureMessages = $structureFacade->getStatus();
117  $structureErrors = $statusUtility->filterBySeverity($structureMessages, 'error');
118  $this->view->assign('structureErrors', $structureErrors);
119 
120  if (!empty($environmentStatus['error']) || !empty($environmentStatus['warning']) || !empty($structureErrors)) {
121  $this->view->assign('errorsOrWarningsFromStatus', true);
122  }
123  $this->assignSteps();
124 
125  return $this->view->render();
126  }
127 }
static makeInstance($className,... $constructorArguments)