[BUGFIX] Framework Packages aren't sorted properly 00/27300/2
authorThomas Maroschik <tmaroschik@dfau.de>
Mon, 3 Feb 2014 13:26:46 +0000 (14:26 +0100)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Mon, 3 Feb 2014 13:48:23 +0000 (14:48 +0100)
In the package dependency resolver, the method
buildDependencyGraph builds the dependency graph
first for the framework packages and afterwards
for all left packages.

The filtering if a package is a framework package
happens by comparing the package path with PATH_typo3
and a sysext folder contant. But as PATH_typo3 is
absolute and the package path from the package states
configuration is relative to PATH_site, this filter
does not work.

The patch changes the path to a relativ one.

Fixes: #55623
Releases: 6.2
Change-Id: I2f57dee433054463ebfd17aab5f76b19986c2747
Reviewed-on: https://review.typo3.org/27300
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Stefan Froemken
Tested-by: Stefan Froemken
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
typo3/sysext/core/Classes/Package/DependencyResolver.php
typo3/sysext/core/Tests/Unit/Package/DependencyResolverTest.php

index c72cc50..2419e49 100644 (file)
@@ -36,7 +36,7 @@ class DependencyResolver {
        /**
         * Folder with framework extensions
         */
-       const SYSEXT_FOLDER = 'sysext';
+       const SYSEXT_FOLDER = 'typo3/sysext';
 
        /**
         * @param array $packageStatesConfiguration
@@ -171,8 +171,8 @@ class DependencyResolver {
                                $rootPackageKeys[] = $packageKey;
                        }
                }
-               $extensionPackageKeys = $this->getPackageKeysInBasePath($packageStateConfiguration, '', array(PATH_typo3 . self::SYSEXT_FOLDER));
-               $frameworkPackageKeys = $this->getPackageKeysInBasePath($packageStateConfiguration, PATH_typo3 . self::SYSEXT_FOLDER);
+               $extensionPackageKeys = $this->getPackageKeysInBasePath($packageStateConfiguration, '', array(self::SYSEXT_FOLDER));
+               $frameworkPackageKeys = $this->getPackageKeysInBasePath($packageStateConfiguration, self::SYSEXT_FOLDER);
                foreach ($extensionPackageKeys as $packageKey) {
                        // Remove framework packages from list
                        $packageKeysWithoutFramework = array_diff(
@@ -198,7 +198,7 @@ class DependencyResolver {
         * @return array
         */
        protected function buildDependencyGraph(array $packageStateConfiguration) {
-               $frameworkPackageKeys = $this->getPackageKeysInBasePath($packageStateConfiguration, PATH_typo3 . self::SYSEXT_FOLDER);
+               $frameworkPackageKeys = $this->getPackageKeysInBasePath($packageStateConfiguration, self::SYSEXT_FOLDER);
                $dependencyGraph = $this->buildDependencyGraphForPackages($packageStateConfiguration, $frameworkPackageKeys);
                $packageStateConfiguration = $this->addDependencyToFrameworkToAllExtensions($packageStateConfiguration, $dependencyGraph);
 
index 2d86435..6b69e00 100644 (file)
@@ -44,8 +44,8 @@ class DependencyResolverTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $packageKeys = array_keys($unsortedPackageStatesConfiguration);
 
                $basePathAssignment = array(
-                       array($unsortedPackageStatesConfiguration, '', array(PATH_typo3 . DependencyResolver::SYSEXT_FOLDER), array_diff($packageKeys, $frameworkPackageKeys)),
-                       array($unsortedPackageStatesConfiguration, PATH_typo3 . DependencyResolver::SYSEXT_FOLDER, array(), $frameworkPackageKeys),
+                       array($unsortedPackageStatesConfiguration, '', array(DependencyResolver::SYSEXT_FOLDER), array_diff($packageKeys, $frameworkPackageKeys)),
+                       array($unsortedPackageStatesConfiguration, DependencyResolver::SYSEXT_FOLDER, array(), $frameworkPackageKeys),
                );
 
                $dependencyResolver = $this->getAccessibleMock('\TYPO3\CMS\Core\Package\DependencyResolver', array('getPackageKeysInBasePath'));
@@ -63,8 +63,8 @@ class DependencyResolverTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $packageKeys = array_keys($unsortedPackageStatesConfiguration);
 
                $basePathAssignment = array(
-                       array($unsortedPackageStatesConfiguration, '', array(PATH_typo3 . DependencyResolver::SYSEXT_FOLDER), array_diff($packageKeys, $frameworkPackageKeys)),
-                       array($unsortedPackageStatesConfiguration, PATH_typo3 . DependencyResolver::SYSEXT_FOLDER, array(), $frameworkPackageKeys),
+                       array($unsortedPackageStatesConfiguration, '', array(DependencyResolver::SYSEXT_FOLDER), array_diff($packageKeys, $frameworkPackageKeys)),
+                       array($unsortedPackageStatesConfiguration, DependencyResolver::SYSEXT_FOLDER, array(), $frameworkPackageKeys),
                );
 
                $dependencyResolver = $this->getAccessibleMock('\TYPO3\CMS\Core\Package\DependencyResolver', array('getPackageKeysInBasePath'));
@@ -104,8 +104,8 @@ class DependencyResolverTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
                $packageKeys = array_keys($unsortedPackageStatesConfiguration);
 
                $basePathAssignment = array(
-                       array($unsortedPackageStatesConfiguration, '', array(PATH_typo3 . DependencyResolver::SYSEXT_FOLDER), $packageKeys),
-                       array($unsortedPackageStatesConfiguration, PATH_typo3 . DependencyResolver::SYSEXT_FOLDER, array(), array()),
+                       array($unsortedPackageStatesConfiguration, '', array(DependencyResolver::SYSEXT_FOLDER), $packageKeys),
+                       array($unsortedPackageStatesConfiguration, DependencyResolver::SYSEXT_FOLDER, array(), array()),
                );
 
                $dependencyResolver = $this->getAccessibleMock('\TYPO3\CMS\Core\Package\DependencyResolver', array('getActivePackageKeysOfType'));