[BUGFIX] ext:install Better error handling in first folder step 35/24135/6
authorChristian Kuhn <lolli@schwarzbu.ch>
Sun, 29 Sep 2013 17:40:33 +0000 (19:40 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sun, 29 Sep 2013 20:01:34 +0000 (22:01 +0200)
During installation it may happen that the folder structure reports
errors during creation, but still creates the main folder structure.
This is the case for example if the document root or fileadmin
is a link and not a directory. In those cases the installer does not
create a LocalConfiguration and shows the first step again. It will
stop with a "ENABLE_INSTALL_TOOL" file missing message afterwards.

This is better sanitized with the patch: If the folder structure
reports errors but still successfully created a typo3conf folder, the
LocalConfiguration is also created and the next step is called after
redirect.

Furthermore, two possible warnings are caught in the folder structure
and adapted status messages are created.

Change-Id: I54d99f826336c513641028f29d389da845d7d26a
Resolves: #52367
Releases: 6.2
Reviewed-on: https://review.typo3.org/24135
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
Reviewed-by: Susanne Moog
Tested-by: Susanne Moog
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/install/Classes/Controller/Action/Step/EnvironmentAndFolders.php
typo3/sysext/install/Classes/Controller/StepController.php
typo3/sysext/install/Classes/FolderStructure/DirectoryNode.php
typo3/sysext/install/Classes/FolderStructure/FileNode.php

index aba3630..67c0fd2 100644 (file)
@@ -52,8 +52,7 @@ class EnvironmentAndFolders extends Action\AbstractAction implements StepInterfa
                $statusUtility = $this->objectManager->get('TYPO3\\CMS\\Install\\Status\\StatusUtility');
                $errorsFromStructure = $statusUtility->filterBySeverity($structureFixMessages, 'error');
 
-               // Proceed with creating LocalConfiguration.php only if folder creation did not throw errors
-               if (empty($errorsFromStructure)) {
+               if (@is_dir(PATH_typo3conf)) {
                        /** @var \TYPO3\CMS\Core\Configuration\ConfigurationManager $configurationManager */
                        $configurationManager = $this->objectManager->get('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager');
                        $configurationManager->createLocalConfigurationFromFactoryConfiguration();
index 70ed1af..19ec296 100644 (file)
@@ -296,8 +296,7 @@ class StepController extends AbstractController {
                        $this->redirect();
                }
 
-               if (!is_dir(PATH_typo3conf)
-                       || count($errorMessagesFromExecute) > 0
+               if (!@is_dir(PATH_typo3conf)
                        || $needsExecution
                ) {
                        /** @var \TYPO3\CMS\Install\Controller\Action\Step\StepInterface $action */
@@ -332,4 +331,4 @@ class StepController extends AbstractController {
                }
        }
 }
-?>
+?>
\ No newline at end of file
index fd1dbc0..b405721 100644 (file)
@@ -130,10 +130,18 @@ class DirectoryNode extends AbstractNode implements NodeInterface {
                if (!$this->isDirectory()) {
                        $status = new Status\ErrorStatus();
                        $status->setTitle('Path ' . $this->getRelativePathBelowSiteRoot() . ' is not a directory');
-                       $status->setMessage(
-                               'The target ' . $this->getRelativePathBelowSiteRoot() . ' should be a directory,' .
-                               ' but is of type ' . filetype($this->getAbsolutePath()) . '. I can not fix this. Please investigate.'
-                       );
+                       $fileType = @filetype($this->getAbsolutePath());
+                       if ($fileType) {
+                               $status->setMessage(
+                                       'The target ' . $this->getRelativePathBelowSiteRoot() . ' should be a directory,' .
+                                       ' but is of type ' . $fileType . '. I can not fix this. Please investigate.'
+                               );
+                       } else {
+                               $status->setMessage(
+                                       'The target ' . $this->getRelativePathBelowSiteRoot() . ' should be a directory,' .
+                                       ' but is of unknown type, probably because some upper level directory does not exist. Please investigate.'
+                               );
+                       }
                        $result[] = $status;
                } elseif (!$this->isPermissionCorrect()) {
                        $result[] = $this->fixPermission();
index e633356..3458695 100644 (file)
@@ -139,10 +139,18 @@ class FileNode extends AbstractNode implements NodeInterface {
                if (!$this->isFile()) {
                        $status = new Status\ErrorStatus();
                        $status->setTitle('Path ' . $this->getRelativePathBelowSiteRoot() . ' is not a file');
-                       $status->setMessage(
-                               'The target ' . $this->getRelativePathBelowSiteRoot() . ' should be a file,' .
-                               ' but is of type ' . filetype($this->getAbsolutePath()) . '. I can not fix this. Please investigate.'
-                       );
+                       $fileType = @filetype($this->getAbsolutePath());
+                       if ($fileType) {
+                               $status->setMessage(
+                                       'The target ' . $this->getRelativePathBelowSiteRoot() . ' should be a file,' .
+                                       ' but is of type ' . $fileType . '. I can not fix this. Please investigate.'
+                               );
+                       } else {
+                               $status->setMessage(
+                                       'The target ' . $this->getRelativePathBelowSiteRoot() . ' should be a file,' .
+                                       ' but is of unknown type, probably because some upper level directory does not exist. Please investigate.'
+                               );
+                       }
                        $result[] = $status;
                } elseif (!$this->isPermissionCorrect()) {
                        $result[] = $this->fixPermission();