[BUGFIX] Clean up and fix class loading 61/40961/4
authorHelmut Hummel <helmut.hummel@typo3.org>
Tue, 7 Jul 2015 14:52:14 +0000 (16:52 +0200)
committerHelmut Hummel <helmut.hummel@typo3.org>
Tue, 7 Jul 2015 16:57:09 +0000 (18:57 +0200)
With class loading information added, we must also add class alias information.
Besides that, we need to distinguish between extensions that should be
loadable and are part of the framework and those which should only be
loaded optionally and are subject to be removed from the core in the near future.

These extensions (namely compatibilty6 and mediace) are now made "regular"
TYPO3 extensions and class loading information is removed from the main composer.json

We now also add the class alias map information to the sub-packages delivered
by the core to have a clean state once they are extracted by a subtree split.

Having all this in place, we can unify the check for framework extensions
in the dependency resolver as well.

Releases: 7.3, master
Resolves: #67933
Change-Id: I08b576c96921058afcf5e03a7c5c3aa6e25d2d55
Reviewed-on: http://review.typo3.org/40961
Reviewed-by: Benjamin Mack <benni@typo3.org>
Tested-by: Benjamin Mack <benni@typo3.org>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Helmut Hummel <helmut.hummel@typo3.org>
Tested-by: Helmut Hummel <helmut.hummel@typo3.org>
composer.json
typo3/sysext/backend/composer.json
typo3/sysext/compatibility6/composer.json [new file with mode: 0644]
typo3/sysext/core/Classes/Core/ClassLoadingInformationGenerator.php
typo3/sysext/core/Classes/Package/DependencyResolver.php
typo3/sysext/core/composer.json
typo3/sysext/form/composer.json
typo3/sysext/mediace/composer.json
typo3/sysext/rtehtmlarea/composer.json

index 6d47b3a..464c604 100644 (file)
@@ -60,7 +60,9 @@
                },
                "class-alias-maps": [
                        "typo3/sysext/core/Migrations/Code/ClassAliasMap.php",
-                       "typo3/sysext/form/Migrations/Code/ClassAliasMap.php"
+                       "typo3/sysext/backend/Migrations/Code/ClassAliasMap.php",
+                       "typo3/sysext/form/Migrations/Code/ClassAliasMap.php",
+                       "typo3/sysext/rtehtmlarea/Migrations/Code/ClassAliasMap.php"
                ]
        },
        "replace": {
                        "TYPO3\\CMS\\Lang\\": "typo3/sysext/lang/Classes/",
                        "TYPO3\\CMS\\Linkvalidator\\": "typo3/sysext/linkvalidator/Classes/",
                        "TYPO3\\CMS\\Lowlevel\\": "typo3/sysext/lowlevel/Classes/",
-                       "TYPO3\\CMS\\Mediace\\": "typo3/sysext/mediace/Classes/",
                        "TYPO3\\CMS\\Opendocs\\": "typo3/sysext/opendocs/Classes/",
                        "TYPO3\\CMS\\Openid\\": "typo3/sysext/openid/Classes/",
                        "TYPO3\\CMS\\Recordlist\\": "typo3/sysext/recordlist/Classes/",
index 2acd0a6..be79ea8 100644 (file)
                                "partOfFactoryDefault": true,
                                "partOfMinimalUsableSystem": true
                        }
-               }
+               },
+               "class-alias-maps": [
+                       "Migrations/Code/ClassAliasMap.php"
+               ]
        },
        "autoload": {
                "psr-4": {
diff --git a/typo3/sysext/compatibility6/composer.json b/typo3/sysext/compatibility6/composer.json
new file mode 100644 (file)
index 0000000..974f736
--- /dev/null
@@ -0,0 +1,25 @@
+{
+       "name": "typo3/cms-compatibility6",
+       "type": "typo3-cms-extension",
+       "description": "TYPO3 Core",
+       "homepage": "http://typo3.org",
+       "license": ["GPL-2.0+"],
+       "version": "7.4.0",
+
+       "require": {
+               "typo3/cms-core": "*"
+       },
+       "replace": {
+               "compatibility6": "*"
+       },
+       "extra": {
+               "class-alias-maps": [
+                       "Migrations/Code/ClassAliasMap.php"
+               ]
+       },
+       "autoload": {
+               "psr-4": {
+                       "TYPO3\\CMS\\Compatibility6\\": "Classes/"
+               }
+       }
+}
index 94a1f2c..903dd73 100644 (file)
@@ -16,7 +16,7 @@ namespace TYPO3\CMS\Core\Core;
 
 use Composer\Autoload\ClassMapGenerator;
 use TYPO3\CMS\Core\Package\Exception\MissingPackageManifestException;
-use TYPO3\CMS\Core\Package\PackageInterface;
+use TYPO3\CMS\Core\Package\Package;
 use TYPO3\CMS\Core\Package\PackageManager;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\PathUtility;
@@ -28,23 +28,18 @@ use TYPO3\CMS\Core\Utility\PathUtility;
 class ClassLoadingInformationGenerator {
 
        /**
-        * Folder with framework extensions
-        */
-       const SYSEXT_FOLDER = 'typo3/sysext';
-
-       /**
-        * @var PackageInterface[]
+        * @var Package[]
         */
        static protected $activeExtensionPackages;
 
        /**
         * Returns class loading information for a single package
         *
-        * @param PackageInterface $package The package to generate the class loading info for
+        * @param Package $package The package to generate the class loading info for
         * @param bool $useRelativePaths If set to TRUE, make the path relative to the current TYPO3 instance (PATH_site)
         * @return array
         */
-       static public function buildClassLoadingInformationForPackage(PackageInterface $package, $useRelativePaths = FALSE) {
+       static public function buildClassLoadingInformationForPackage(Package $package, $useRelativePaths = FALSE) {
                $classMap = array();
                $psr4 = array();
                $packagePath = $package->getPackagePath();
@@ -82,11 +77,11 @@ class ClassLoadingInformationGenerator {
        /**
         * Returns class alias map for given package
         *
-        * @param PackageInterface $package The package to generate the class alias info for
+        * @param Package $package The package to generate the class alias info for
         * @throws \TYPO3\CMS\Core\Error\Exception
         * @return array
         */
-       static public function buildClassAliasMapForPackage(PackageInterface $package) {
+       static public function buildClassAliasMapForPackage(Package $package) {
                $aliasToClassNameMapping = array();
                $classNameToAliasMapping = array();
                $possibleClassAliasFile = $package->getPackagePath() . 'Migrations/Code/ClassAliasMap.php';
@@ -201,7 +196,7 @@ EOF;
        /**
         * Get all packages except the protected ones, as they are covered already
         *
-        * @return \TYPO3\CMS\Core\Package\PackageInterface[]
+        * @return Package[]
         */
        static protected function getActiveExtensionPackages() {
                if (self::$activeExtensionPackages === NULL) {
@@ -221,11 +216,11 @@ EOF;
        /**
         * Check if the package is a framework package (located in typo3/sysext)
         *
-        * @param PackageInterface $package
+        * @param Package $package
         * @return bool
         */
-       static protected function isFrameworkPackage(PackageInterface $package) {
-               return strpos($package->getPackagePath(), self::SYSEXT_FOLDER) !== FALSE;
+       static protected function isFrameworkPackage(Package $package) {
+               return $package->getValueFromComposerManifest('type') === 'typo3-cms-framework';
        }
 
        /**
index 635110c..7f176cb 100644 (file)
@@ -175,14 +175,7 @@ class DependencyResolver {
                foreach ($packageStateConfiguration as $packageKey => $packageConfiguration) {
                        /** @var Package $package */
                        $package = $packageManager->getPackage($packageKey);
-                       if (
-                               $package instanceof Package
-                               && (
-                                       $package->isPartOfFactoryDefault()
-                                       || $package->isPartOfMinimalUsableSystem()
-                                       || strpos($packageConfiguration['packagePath'], self::SYSEXT_FOLDER) === 0
-                               )
-                       ) {
+                       if ($package->getValueFromComposerManifest('type') === 'typo3-cms-framework') {
                                $frameworkPackageKeys[] = $packageKey;
                        }
                }
index 91bde47..353759b 100644 (file)
                                "partOfFactoryDefault": true,
                                "partOfMinimalUsableSystem": true
                        }
-               }
+               },
+               "class-alias-maps": [
+                       "Migrations/Code/ClassAliasMap.php"
+               ]
        },
        "autoload": {
                "psr-4": {
index 9582e64..17796c5 100644 (file)
                        "Package": {
                                "partOfFactoryDefault": true
                        }
-               }
+               },
+               "class-alias-maps": [
+                       "Migrations/Code/ClassAliasMap.php"
+               ]
        },
        "autoload": {
                "psr-4": {
index 8587289..8b28a89 100644 (file)
@@ -1,6 +1,6 @@
 {
        "name": "typo3/cms-mediace",
-       "type": "typo3-cms-framework",
+       "type": "typo3-cms-extension",
        "description": "TYPO3 Core",
        "homepage": "http://typo3.org",
        "license": ["GPL-2.0+"],
        "replace": {
                "mediace": "*"
        },
+       "extra": {
+               "class-alias-maps": [
+                       "Migrations/Code/ClassAliasMap.php"
+               ]
+       },
        "autoload": {
                "psr-4": {
                        "TYPO3\\CMS\\Mediace\\": "Classes/"
index 1dbec58..5fb1347 100644 (file)
                        "Package": {
                                "partOfFactoryDefault": true
                        }
-               }
+               },
+               "class-alias-maps": [
+                       "Migrations/Code/ClassAliasMap.php"
+               ]
        },
        "autoload": {
                "psr-4": {