[BUGFIX] Ignore configurable symlinks in structure check 07/42107/3
authorHelmut Hummel <helmut.hummel@typo3.org>
Wed, 29 Jul 2015 16:58:27 +0000 (18:58 +0200)
committerFrans Saris <franssaris@gmail.com>
Wed, 29 Jul 2015 20:42:24 +0000 (22:42 +0200)
In composer mode the symlinks to index.php and typo3 are configurable
as well as the typo3_src folder is.

Ignore these links in the structure check in composer mode.

Releases: master
Resolves: #68615
Change-Id: Icd2ab595b7d0261e1903d8adfb68b420ef19d4d4
Reviewed-on: http://review.typo3.org/42107
Reviewed-by: Daniel Goerz <ervaude@gmail.com>
Tested-by: Daniel Goerz <ervaude@gmail.com>
Reviewed-by: Frans Saris <franssaris@gmail.com>
Reviewed-by: Benjamin Mack <benni@typo3.org>
Tested-by: Frans Saris <franssaris@gmail.com>
typo3/sysext/extensionmanager/Classes/Controller/ListController.php
typo3/sysext/install/Classes/Controller/Action/Tool/ImportantActions.php
typo3/sysext/install/Classes/FolderStructure/DefaultFactory.php
typo3/sysext/install/Classes/Service/CoreUpdateService.php

index 89d1664..9d372bc 100644 (file)
@@ -71,7 +71,7 @@ class ListController extends AbstractController {
         * Adds an information about composer mode
         */
        protected function addComposerModeNotification() {
-               if (Bootstrap::getInstance()->usesComposerClassLoading()) {
+               if (Bootstrap::usesComposerClassLoading()) {
                        $this->addFlashMessage(
                                LocalizationUtility::translate(
                                        'composerMode.message',
index 5f041a4..520f9a7 100644 (file)
@@ -74,7 +74,7 @@ class ImportantActions extends Action\AbstractAction {
                $coreUpdateService = $this->objectManager->get(\TYPO3\CMS\Install\Service\CoreUpdateService::class);
                $this->view
                        ->assign('enableCoreUpdate', $coreUpdateService->isCoreUpdateEnabled())
-                       ->assign('composerMode', Bootstrap::getInstance()->usesComposerClassLoading())
+                       ->assign('composerMode', Bootstrap::usesComposerClassLoading())
                        ->assign('operatingSystem', $operatingSystem)
                        ->assign('cgiDetected', GeneralUtility::isRunningOnCgiServerApi())
                        ->assign('databaseName', $GLOBALS['TYPO3_CONF_VARS']['DB']['database'])
index 2f99420..03bb686 100644 (file)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Install\FolderStructure;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Core\Bootstrap;
+
 /**
  * Factory returns default folder structure object hierarchy
  */
@@ -54,11 +56,12 @@ class DefaultFactory {
                $filePermission = $GLOBALS['TYPO3_CONF_VARS']['BE']['fileCreateMask'];
                $directoryPermission = $GLOBALS['TYPO3_CONF_VARS']['BE']['folderCreateMask'];
 
-               return array(
-                       // Cut off trailing forward / from PATH_site, so root node has no trailing slash like all others
-                       'name' => substr(PATH_site, 0, -1),
-                       'targetPermission' => $directoryPermission,
-                       'children' => array(
+               if (Bootstrap::usesComposerClassLoading()) {
+                       // In composer mode the links are configurable and might even be actual files
+                       // Ignore this structure in this case
+                       $structureAdditional = array();
+               } else {
+                       $structureAdditional = array(
                                array(
                                        'name' => 'index.php',
                                        'type' => LinkNode::class,
@@ -73,203 +76,212 @@ class DefaultFactory {
                                        'name' => 'typo3_src',
                                        'type' => LinkNode::class,
                                ),
-                               array(
-                                       'name' => 'typo3temp',
-                                       'type' => DirectoryNode::class,
-                                       'targetPermission' => $directoryPermission,
-                                       'children' => array(
-                                               array(
-                                                       'name' => 'index.html',
-                                                       'type' => FileNode::class,
-                                                       'targetPermission' => $filePermission,
-                                                       'targetContent' => '',
-                                               ),
-                                               array(
-                                                       'name' => 'compressor',
-                                                       'type' => DirectoryNode::class,
-                                                       'targetPermission' => $directoryPermission,
-                                               ),
-                                               array(
-                                                       'name' => 'cs',
-                                                       'type' => DirectoryNode::class,
-                                                       'targetPermission' => $directoryPermission,
-                                               ),
-                                               array(
-                                                       'name' => 'Cache',
-                                                       'type' => DirectoryNode::class,
-                                                       'targetPermission' => $directoryPermission,
-                                               ),
-                                               array(
-                                                       'name' => 'GB',
-                                                       'type' => DirectoryNode::class,
-                                                       'targetPermission' => $directoryPermission,
-                                               ),
-                                               array(
-                                                       'name' => 'llxml',
-                                                       'type' => DirectoryNode::class,
-                                                       'targetPermission' => $directoryPermission,
-                                               ),
-                                               array(
-                                                       'name' => 'locks',
-                                                       'type' => DirectoryNode::class,
-                                                       'targetPermission' => $directoryPermission,
-                                               ),
-                                               array(
-                                                       'name' => 'pics',
-                                                       'type' => DirectoryNode::class,
-                                                       'targetPermission' => $directoryPermission,
-                                               ),
-                                               array(
-                                                       'name' => 'sprites',
-                                                       'type' => DirectoryNode::class,
-                                                       'targetPermission' => $directoryPermission,
-                                               ),
-                                               array(
-                                                       'name' => 'temp',
-                                                       'type' => DirectoryNode::class,
-                                                       'targetPermission' => $directoryPermission,
-                                               ),
-                                               array(
-                                                       'name' => '_processed_',
-                                                       'type' => DirectoryNode::class,
-                                                       'targetPermission' => $directoryPermission,
-                                               ),
+                       );
+               }
+               $structureBase = array(
+                       array(
+                               'name' => 'typo3temp',
+                               'type' => DirectoryNode::class,
+                               'targetPermission' => $directoryPermission,
+                               'children' => array(
+                                       array(
+                                               'name' => 'index.html',
+                                               'type' => FileNode::class,
+                                               'targetPermission' => $filePermission,
+                                               'targetContent' => '',
+                                       ),
+                                       array(
+                                               'name' => 'compressor',
+                                               'type' => DirectoryNode::class,
+                                               'targetPermission' => $directoryPermission,
+                                       ),
+                                       array(
+                                               'name' => 'cs',
+                                               'type' => DirectoryNode::class,
+                                               'targetPermission' => $directoryPermission,
+                                       ),
+                                       array(
+                                               'name' => 'Cache',
+                                               'type' => DirectoryNode::class,
+                                               'targetPermission' => $directoryPermission,
+                                       ),
+                                       array(
+                                               'name' => 'GB',
+                                               'type' => DirectoryNode::class,
+                                               'targetPermission' => $directoryPermission,
+                                       ),
+                                       array(
+                                               'name' => 'llxml',
+                                               'type' => DirectoryNode::class,
+                                               'targetPermission' => $directoryPermission,
+                                       ),
+                                       array(
+                                               'name' => 'locks',
+                                               'type' => DirectoryNode::class,
+                                               'targetPermission' => $directoryPermission,
+                                       ),
+                                       array(
+                                               'name' => 'pics',
+                                               'type' => DirectoryNode::class,
+                                               'targetPermission' => $directoryPermission,
+                                       ),
+                                       array(
+                                               'name' => 'sprites',
+                                               'type' => DirectoryNode::class,
+                                               'targetPermission' => $directoryPermission,
+                                       ),
+                                       array(
+                                               'name' => 'temp',
+                                               'type' => DirectoryNode::class,
+                                               'targetPermission' => $directoryPermission,
+                                       ),
+                                       array(
+                                               'name' => '_processed_',
+                                               'type' => DirectoryNode::class,
+                                               'targetPermission' => $directoryPermission,
                                        ),
                                ),
-                               array(
-                                       'name' => 'typo3conf',
-                                       'type' => DirectoryNode::class,
-                                       'targetPermission' => $directoryPermission,
-                                       'children' => array(
-                                               array(
-                                                       'name' => 'ext',
-                                                       'type' => DirectoryNode::class,
-                                                       'targetPermission' => $directoryPermission,
-                                               ),
-                                               array(
-                                                       'name' => 'l10n',
-                                                       'type' => DirectoryNode::class,
-                                                       'targetPermission' => $directoryPermission,
-                                               ),
+                       ),
+                       array(
+                               'name' => 'typo3conf',
+                               'type' => DirectoryNode::class,
+                               'targetPermission' => $directoryPermission,
+                               'children' => array(
+                                       array(
+                                               'name' => 'ext',
+                                               'type' => DirectoryNode::class,
+                                               'targetPermission' => $directoryPermission,
+                                       ),
+                                       array(
+                                               'name' => 'l10n',
+                                               'type' => DirectoryNode::class,
+                                               'targetPermission' => $directoryPermission,
                                        ),
                                ),
-                               array(
-                                       'name' => 'uploads',
-                                       'type' => DirectoryNode::class,
-                                       'targetPermission' => $directoryPermission,
-                                       'children' => array(
-                                               array(
-                                                       'name' => 'index.html',
-                                                       'type' => FileNode::class,
-                                                       'targetPermission' => $filePermission,
-                                                       'targetContentFile' => PATH_site . 'typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/uploads-index.html',
-                                               ),
-                                               array(
-                                                       'name' => 'media',
-                                                       'type' => DirectoryNode::class,
-                                                       'targetPermission' => $directoryPermission,
-                                                       'children' => array(
-                                                               array(
-                                                                       'name' => 'index.html',
-                                                                       'type' => FileNode::class,
-                                                                       'targetPermission' => $filePermission,
-                                                                       'targetContent' => '',
-                                                               ),
+                       ),
+                       array(
+                               'name' => 'uploads',
+                               'type' => DirectoryNode::class,
+                               'targetPermission' => $directoryPermission,
+                               'children' => array(
+                                       array(
+                                               'name' => 'index.html',
+                                               'type' => FileNode::class,
+                                               'targetPermission' => $filePermission,
+                                               'targetContentFile' => PATH_site . 'typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/uploads-index.html',
+                                       ),
+                                       array(
+                                               'name' => 'media',
+                                               'type' => DirectoryNode::class,
+                                               'targetPermission' => $directoryPermission,
+                                               'children' => array(
+                                                       array(
+                                                               'name' => 'index.html',
+                                                               'type' => FileNode::class,
+                                                               'targetPermission' => $filePermission,
+                                                               'targetContent' => '',
                                                        ),
                                                ),
-                                               array(
-                                                       'name' => 'pics',
-                                                       'type' => DirectoryNode::class,
-                                                       'targetPermission' => $directoryPermission,
-                                                       'children' => array(
-                                                               array(
-                                                                       'name' => 'index.html',
-                                                                       'type' => FileNode::class,
-                                                                       'targetPermission' => $filePermission,
-                                                                       'targetContent' => '',
-                                                               ),
+                                       ),
+                                       array(
+                                               'name' => 'pics',
+                                               'type' => DirectoryNode::class,
+                                               'targetPermission' => $directoryPermission,
+                                               'children' => array(
+                                                       array(
+                                                               'name' => 'index.html',
+                                                               'type' => FileNode::class,
+                                                               'targetPermission' => $filePermission,
+                                                               'targetContent' => '',
                                                        ),
                                                ),
-                                               array(
-                                                       'name' => 'tx_felogin',
-                                                       'type' => DirectoryNode::class,
-                                                       'targetPermission' => $directoryPermission,
-                                               ),
+                                       ),
+                                       array(
+                                               'name' => 'tx_felogin',
+                                               'type' => DirectoryNode::class,
+                                               'targetPermission' => $directoryPermission,
                                        ),
                                ),
-                               array(
-                                       'name' => !empty($GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir']) ? rtrim($GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'], '/') : 'fileadmin',
-                                       'type' => DirectoryNode::class,
-                                       'targetPermission' => $directoryPermission,
-                                       'children' => array(
-                                               array(
-                                                       'name' => '_temp_',
-                                                       'type' => DirectoryNode::class,
-                                                       'targetPermission' => $directoryPermission,
-                                                       'children' => array(
-                                                               array(
-                                                                       'name' => '.htaccess',
-                                                                       'type' => FileNode::class,
-                                                                       'targetPermission' => $filePermission,
-                                                                       'targetContentFile' => PATH_site . 'typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/fileadmin-temp-htaccess',
-                                                               ),
-                                                               array(
-                                                                       'name' => 'index.html',
-                                                                       'type' => FileNode::class,
-                                                                       'targetPermission' => $filePermission,
-                                                                       'targetContentFile' => PATH_site . 'typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/fileadmin-temp-index.html',
-                                                               ),
+                       ),
+                       array(
+                               'name' => !empty($GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir']) ? rtrim($GLOBALS['TYPO3_CONF_VARS']['BE']['fileadminDir'], '/') : 'fileadmin',
+                               'type' => DirectoryNode::class,
+                               'targetPermission' => $directoryPermission,
+                               'children' => array(
+                                       array(
+                                               'name' => '_temp_',
+                                               'type' => DirectoryNode::class,
+                                               'targetPermission' => $directoryPermission,
+                                               'children' => array(
+                                                       array(
+                                                               'name' => '.htaccess',
+                                                               'type' => FileNode::class,
+                                                               'targetPermission' => $filePermission,
+                                                               'targetContentFile' => PATH_site . 'typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/fileadmin-temp-htaccess',
+                                                       ),
+                                                       array(
+                                                               'name' => 'index.html',
+                                                               'type' => FileNode::class,
+                                                               'targetPermission' => $filePermission,
+                                                               'targetContentFile' => PATH_site . 'typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/fileadmin-temp-index.html',
                                                        ),
                                                ),
-                                               array(
-                                                       'name' => 'user_upload',
-                                                       'type' => DirectoryNode::class,
-                                                       'targetPermission' => $directoryPermission,
-                                                       'children' => array(
-                                                               array(
-                                                                       'name' => '_temp_',
-                                                                       'type' => DirectoryNode::class,
-                                                                       'targetPermission' => $directoryPermission,
-                                                                       'children' => array(
-                                                                               array(
-                                                                                       'name' => 'index.html',
-                                                                                       'type' => FileNode::class,
-                                                                                       'targetPermission' => $filePermission,
-                                                                                       'targetContent' => '',
-                                                                               ),
-                                                                               array(
-                                                                                       'name' => 'importexport',
-                                                                                       'type' => DirectoryNode::class,
-                                                                                       'targetPermission' => $directoryPermission,
-                                                                                       'children' => array(
-                                                                                               array(
-                                                                                                       'name' => '.htaccess',
-                                                                                                       'type' => FileNode::class,
-                                                                                                       'targetPermission' => $filePermission,
-                                                                                                       'targetContentFile' => PATH_site . 'typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/fileadmin-user_upload-temp-importexport-htaccess',
-                                                                                               ),
-                                                                                               array(
-                                                                                                       'name' => 'index.html',
-                                                                                                       'type' => FileNode::class,
-                                                                                                       'targetPermission' => $filePermission,
-                                                                                                       'targetContentFile' => PATH_site . 'typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/fileadmin-temp-index.html',
-                                                                                               ),
+                                       ),
+                                       array(
+                                               'name' => 'user_upload',
+                                               'type' => DirectoryNode::class,
+                                               'targetPermission' => $directoryPermission,
+                                               'children' => array(
+                                                       array(
+                                                               'name' => '_temp_',
+                                                               'type' => DirectoryNode::class,
+                                                               'targetPermission' => $directoryPermission,
+                                                               'children' => array(
+                                                                       array(
+                                                                               'name' => 'index.html',
+                                                                               'type' => FileNode::class,
+                                                                               'targetPermission' => $filePermission,
+                                                                               'targetContent' => '',
+                                                                       ),
+                                                                       array(
+                                                                               'name' => 'importexport',
+                                                                               'type' => DirectoryNode::class,
+                                                                               'targetPermission' => $directoryPermission,
+                                                                               'children' => array(
+                                                                                       array(
+                                                                                               'name' => '.htaccess',
+                                                                                               'type' => FileNode::class,
+                                                                                               'targetPermission' => $filePermission,
+                                                                                               'targetContentFile' => PATH_site . 'typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/fileadmin-user_upload-temp-importexport-htaccess',
+                                                                                       ),
+                                                                                       array(
+                                                                                               'name' => 'index.html',
+                                                                                               'type' => FileNode::class,
+                                                                                               'targetPermission' => $filePermission,
+                                                                                               'targetContentFile' => PATH_site . 'typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/fileadmin-temp-index.html',
                                                                                        ),
                                                                                ),
                                                                        ),
                                                                ),
-                                                               array(
-                                                                       'name' => 'index.html',
-                                                                       'type' => FileNode::class,
-                                                                       'targetPermission' => $filePermission,
-                                                                       'targetContent' => '',
-                                                               ),
+                                                       ),
+                                                       array(
+                                                               'name' => 'index.html',
+                                                               'type' => FileNode::class,
+                                                               'targetPermission' => $filePermission,
+                                                               'targetContent' => '',
                                                        ),
                                                ),
                                        ),
                                ),
                        ),
                );
+
+               return array(
+                       // Cut off trailing forward / from PATH_site, so root node has no trailing slash like all others
+                       'name' => substr(PATH_site, 0, -1),
+                       'targetPermission' => $directoryPermission,
+                       'children' => array_merge($structureAdditional, $structureBase)
+               );
        }
 
 }
index 0369512..2af182d 100644 (file)
@@ -93,7 +93,7 @@ class CoreUpdateService {
         */
        public function isCoreUpdateEnabled() {
                $coreUpdateDisabled = getenv('TYPO3_DISABLE_CORE_UPDATER') ?: (getenv('REDIRECT_TYPO3_DISABLE_CORE_UPDATER') ?: FALSE);
-               return !Bootstrap::getInstance()->usesComposerClassLoading() && !$coreUpdateDisabled;
+               return !Bootstrap::usesComposerClassLoading() && !$coreUpdateDisabled;
        }
 
        /**