TYPO3 CMS  TYPO3_6-2
EnvironmentAndFolders.php
Go to the documentation of this file.
1 <?php
3 
25 
33  public function execute() {
35  $folderStructureFactory = $this->objectManager->get('TYPO3\\CMS\\Install\\FolderStructure\\DefaultFactory');
37  $structureFacade = $folderStructureFactory->getStructure();
38  $structureFixMessages = $structureFacade->fix();
40  $statusUtility = $this->objectManager->get('TYPO3\\CMS\\Install\\Status\\StatusUtility');
41  $errorsFromStructure = $statusUtility->filterBySeverity($structureFixMessages, 'error');
42 
43  if (@is_dir(PATH_typo3conf)) {
45  $configurationManager = $this->objectManager->get('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager');
46  $configurationManager->createLocalConfigurationFromFactoryConfiguration();
47 
48  // Create a PackageStates.php with all packages activated marked as "part of factory default"
49  if (!file_exists(PATH_typo3conf . 'PackageStates.php')) {
51  $packageManager = \TYPO3\CMS\Core\Core\Bootstrap::getInstance()->getEarlyInstance('TYPO3\\Flow\\Package\\PackageManager');
52  $packages = $packageManager->getAvailablePackages();
53  foreach ($packages as $package) {
55  if ($package instanceof \TYPO3\CMS\Core\Package\PackageInterface
56  && $package->isPartOfFactoryDefault()
57  ) {
58  $packageManager->activatePackage($package->getPackageKey());
59  }
60  }
61  $packageManager->forceSortAndSavePackageStates();
62  }
63 
64  // Create enable install tool file after typo3conf & LocalConfiguration were created
66  $installToolService = $this->objectManager->get('TYPO3\\CMS\\Install\\Service\\EnableFileService');
67  $installToolService->removeFirstInstallFile();
68  $installToolService->createInstallToolEnableFile();
69  }
70 
71  return $errorsFromStructure;
72  }
73 
79  public function needsExecution() {
80  if (@is_file(PATH_typo3conf . 'LocalConfiguration.php')) {
81  return FALSE;
82  } else {
83  return TRUE;
84  }
85  }
86 
92  protected function executeAction() {
94  $statusCheck = $this->objectManager->get('TYPO3\\CMS\\Install\\SystemEnvironment\\Check');
95  $statusObjects = $statusCheck->getStatus();
97  $statusUtility = $this->objectManager->get('TYPO3\\CMS\\Install\\Status\\StatusUtility');
98  $environmentStatus = $statusUtility->sortBySeverity($statusObjects);
99  $alerts = $statusUtility->filterBySeverity($statusObjects, 'alert');
100  $this->view->assign('alerts', $alerts);
101  $this->view->assign('environmentStatus', $environmentStatus);
102 
104  $folderStructureFactory = $this->objectManager->get('TYPO3\\CMS\\Install\\FolderStructure\\DefaultFactory');
106  $structureFacade = $folderStructureFactory->getStructure();
107  $structureMessages = $structureFacade->getStatus();
109  $structureErrors = $statusUtility->filterBySeverity($structureMessages, 'error');
110  $this->view->assign('structureErrors', $structureErrors);
111 
112  if (count($environmentStatus['error']) > 0
113  || count($environmentStatus['warning']) > 0
114  || count($structureErrors) > 0
115  ) {
116  $this->view->assign('errorsOrWarningsFromStatus', TRUE);
117  }
118  $this->assignSteps();
119 
120  return $this->view->render(!empty($alerts));
121  }
122 }