[!!!][TASK] Simplify PackageManagement / Remove Flow 18/39518/11
authorBenjamin Mack <benni@typo3.org>
Wed, 13 May 2015 06:47:31 +0000 (14:47 +0800)
committerBenjamin Mack <benni@typo3.org>
Tue, 19 May 2015 15:43:35 +0000 (17:43 +0200)
The PackageManager was originally backported from Flow
but includes too many classes and options that the Core does not
use or cannot use at all.

The Package code is thus merged with only the parts needed
for the TYPO3 Core, and adapted accordingly. All Flow classes
are either removed or merged into the needed Package classes
of the TYPO3 Core.

In order to speed up the bootstrap and prepare for tight composer
integration, this task needs to be sorted out first.

Next step is to further cleanup code within the Package*
classes themselves - things that are not called at all in
the TYPO3 Core.

Resolves: #67027
Releases: master
Change-Id: Ia6823374afa515902e3d5237cef596a440747e3b
Reviewed-on: http://review.typo3.org/39518
Reviewed-by: Nicole Cordes <typo3@cordes.co>
Tested-by: Nicole Cordes <typo3@cordes.co>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Benjamin Mack <benni@typo3.org>
Tested-by: Benjamin Mack <benni@typo3.org>
69 files changed:
composer.json
typo3/sysext/core/Classes/Compatibility/LoadedExtensionArrayElement.php
typo3/sysext/core/Classes/Core/Bootstrap.php
typo3/sysext/core/Classes/Core/ClassAliasMap.php
typo3/sysext/core/Classes/Core/ClassLoader.php
typo3/sysext/core/Classes/Package/DependencyResolver.php
typo3/sysext/core/Classes/Package/Exception/CorruptPackageException.php [new file with mode: 0644]
typo3/sysext/core/Classes/Package/Exception/InvalidPackageKeyException.php [new file with mode: 0644]
typo3/sysext/core/Classes/Package/Exception/InvalidPackageManifestException.php [new file with mode: 0644]
typo3/sysext/core/Classes/Package/Exception/InvalidPackagePathException.php [new file with mode: 0644]
typo3/sysext/core/Classes/Package/Exception/InvalidPackageStateException.php [new file with mode: 0644]
typo3/sysext/core/Classes/Package/Exception/MissingPackageManifestException.php [new file with mode: 0644]
typo3/sysext/core/Classes/Package/Exception/PackageStatesFileNotWritableException.php [new file with mode: 0644]
typo3/sysext/core/Classes/Package/Exception/ProtectedPackageKeyException.php [new file with mode: 0644]
typo3/sysext/core/Classes/Package/Exception/UnknownPackageException.php [new file with mode: 0644]
typo3/sysext/core/Classes/Package/FailsafePackageManager.php
typo3/sysext/core/Classes/Package/MetaData.php [new file with mode: 0644]
typo3/sysext/core/Classes/Package/MetaData/PackageConstraint.php [new file with mode: 0644]
typo3/sysext/core/Classes/Package/Package.php
typo3/sysext/core/Classes/Package/PackageFactory.php [deleted file]
typo3/sysext/core/Classes/Package/PackageInterface.php
typo3/sysext/core/Classes/Package/PackageManager.php
typo3/sysext/core/Classes/Package/UnitTestPackageManager.php
typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php
typo3/sysext/core/Documentation/Changelog/master/Breaking-67027-RemovedFlowCompatibilityFromPackageManager.rst [new file with mode: 0644]
typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Core/ClassLoader.php [deleted file]
typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Exception.php [deleted file]
typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Log/LoggerInterface.php [deleted file]
typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Log/SystemLoggerInterface.php [deleted file]
typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Documentation.php [deleted file]
typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Documentation/Format.php [deleted file]
typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Exception.php [deleted file]
typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Exception/CorruptPackageException.php [deleted file]
typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Exception/DuplicatePackageException.php [deleted file]
typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Exception/InvalidPackageKeyException.php [deleted file]
typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Exception/InvalidPackageManifestException.php [deleted file]
typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Exception/InvalidPackagePathException.php [deleted file]
typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Exception/InvalidPackageStateException.php [deleted file]
typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Exception/MissingPackageManifestException.php [deleted file]
typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Exception/PackageKeyAlreadyExistsException.php [deleted file]
typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Exception/PackageRepositoryException.php [deleted file]
typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Exception/PackageStatesFileNotWritableException.php [deleted file]
typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Exception/ProtectedPackageKeyException.php [deleted file]
typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Exception/UnknownPackageException.php [deleted file]
typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/MetaData.php [deleted file]
typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/MetaData/AbstractConstraint.php [deleted file]
typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/MetaData/AbstractParty.php [deleted file]
typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/MetaData/Company.php [deleted file]
typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/MetaData/PackageConstraint.php [deleted file]
typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/MetaData/Person.php [deleted file]
typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/MetaData/SystemConstraint.php [deleted file]
typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/MetaDataInterface.php [deleted file]
typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Package.php [deleted file]
typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/PackageFactory.php [deleted file]
typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/PackageInterface.php [deleted file]
typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/PackageManager.php [deleted file]
typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/PackageManagerInterface.php [deleted file]
typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Utility/Exception.php [deleted file]
typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Utility/Files.php [deleted file]
typo3/sysext/core/Resources/PHP/TYPO3.Flow/README [deleted file]
typo3/sysext/core/Tests/Unit/Core/ClassLoaderTest.php
typo3/sysext/core/Tests/Unit/Package/PackageManagerTest.php
typo3/sysext/core/Tests/Unit/Package/PackageTest.php
typo3/sysext/core/Tests/Unit/Utility/ExtensionManagementUtilityTest.php
typo3/sysext/core/composer.json
typo3/sysext/extensionmanager/Classes/Controller/ActionController.php
typo3/sysext/extensionmanager/Classes/Utility/ListUtility.php
typo3/sysext/install/Classes/Controller/Action/Step/EnvironmentAndFolders.php
typo3/sysext/install/Classes/Controller/StepController.php

index e53c4c1..ab6caba 100644 (file)
                "typo3/cms-workspaces": "self.version"
        },
        "autoload": {
-               "psr-0": {
-                       "TYPO3\\Flow\\": "typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/"
-               },
                "psr-4": {
                        "TYPO3\\CMS\\Backend\\": "typo3/sysext/backend/Classes/",
                        "TYPO3\\CMS\\Core\\": "typo3/sysext/core/Classes/",
index 8cab007..2bc556c 100644 (file)
@@ -14,6 +14,8 @@ namespace TYPO3\CMS\Core\Compatibility;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Package\PackageInterface;
+
 /**
  * Class to simulate the "old" extension information array element
  *
@@ -22,7 +24,7 @@ namespace TYPO3\CMS\Core\Compatibility;
 class LoadedExtensionArrayElement implements \IteratorAggregate, \ArrayAccess, \Serializable, \Countable {
 
        /**
-        * @var \TYPO3\Flow\Package\PackageInterface Instance of package manager
+        * @var PackageInterface Instance of package manager
         */
        protected $package;
 
@@ -46,9 +48,9 @@ class LoadedExtensionArrayElement implements \IteratorAggregate, \ArrayAccess, \
        /**
         * Constructor builds compatibility API
         *
-        * @param \TYPO3\Flow\Package\PackageInterface $package
+        * @param PackageInterface $package
         */
-       public function __construct(\TYPO3\Flow\Package\PackageInterface $package) {
+       public function __construct(PackageInterface $package) {
                $this->package = $package;
                $this->initializeBasicExtensionInformation();
                $this->initializeExtensionFiles();
index 0dd0083..24297f9 100644 (file)
@@ -117,8 +117,6 @@ class Bootstrap {
                        $composerClassLoader = self::initializeComposerClassLoader();
                        $applicationContext = getenv('TYPO3_CONTEXT') ?: (getenv('REDIRECT_TYPO3_CONTEXT') ?: 'Production');
                        self::$instance = new static($applicationContext);
-                       // Establish an alias for Flow/Package interoperability
-                       class_alias(get_class(static::$instance), \TYPO3\Flow\Core\Bootstrap::class);
                        self::$instance->setEarlyInstance(\Composer\Autoload\ClassLoader::class, $composerClassLoader);
                }
                return static::$instance;
@@ -460,7 +458,7 @@ class Bootstrap {
        public function initializePackageManagement($packageManagerClassName) {
                /** @var \TYPO3\CMS\Core\Package\PackageManager $packageManager */
                $packageManager = new $packageManagerClassName();
-               $this->setEarlyInstance(\TYPO3\Flow\Package\PackageManager::class, $packageManager);
+               $this->setEarlyInstance(\TYPO3\CMS\Core\Package\PackageManager::class, $packageManager);
                Utility\ExtensionManagementUtility::setPackageManager($packageManager);
                $packageManager->injectClassLoader($this->getEarlyInstance(\TYPO3\CMS\Core\Core\ClassLoader::class));
                $packageManager->injectCoreCache($this->getEarlyInstance(\TYPO3\CMS\Core\Cache\CacheManager::class)->getCache('cache_core'));
@@ -479,7 +477,7 @@ class Bootstrap {
        protected function initializeRuntimeActivatedPackagesFromConfiguration() {
                if (!empty($GLOBALS['TYPO3_CONF_VARS']['EXT']['runtimeActivatedPackages']) && is_array($GLOBALS['TYPO3_CONF_VARS']['EXT']['runtimeActivatedPackages'])) {
                        /** @var \TYPO3\CMS\Core\Package\PackageManager $packageManager */
-                       $packageManager = $this->getEarlyInstance(\TYPO3\Flow\Package\PackageManager::class);
+                       $packageManager = $this->getEarlyInstance(\TYPO3\CMS\Core\Package\PackageManager::class);
                        foreach ($GLOBALS['TYPO3_CONF_VARS']['EXT']['runtimeActivatedPackages'] as $runtimeAddedPackageKey) {
                                $packageManager->activatePackageDuringRuntime($runtimeAddedPackageKey);
                        }
index ef07da3..9490d03 100644 (file)
@@ -56,7 +56,7 @@ class ClassAliasMap implements \TYPO3\CMS\Core\SingletonInterface {
        protected $composerClassLoader;
 
        /**
-        * @var \TYPO3\Flow\Package\Package[]
+        * @var \TYPO3\CMS\Core\Package\Package[]
         */
        protected $packages = array();
 
index 1a4f4eb..6b39821 100644 (file)
@@ -60,7 +60,7 @@ class ClassLoader {
        protected $cacheIdentifier;
 
        /**
-        * @var \TYPO3\Flow\Package\Package[]
+        * @var \TYPO3\CMS\Core\Package\Package[]
         */
        protected $packages = array();
 
@@ -352,21 +352,9 @@ class ClassLoader {
        protected function buildClassLoadingInformationForClassFromRegisteredPackages($className) {;
                foreach ($this->packageNamespaces as $packageNamespace => $packageData) {
                        if (substr(str_replace('_', '\\', $className), 0, $packageData['namespaceLength']) === $packageNamespace) {
-                               if ($packageData['substituteNamespaceInPath']) {
-                                       // If it's a TYPO3 package, classes don't comply to PSR-0.
-                                       // The namespace part is substituted.
-                                       $classPathAndFilename = '/' . str_replace('\\', '/', ltrim(substr($className, $packageData['namespaceLength']), '\\')) . '.php';
-                               } else {
-                                       // Make the classname PSR-0 compliant by replacing underscores only in the classname not in the namespace
-                                       $classPathAndFilename  = '';
-                                       $lastNamespacePosition = strrpos($className, '\\');
-                                       if ($lastNamespacePosition !== FALSE) {
-                                               $namespace = substr($className, 0, $lastNamespacePosition);
-                                               $className = substr($className, $lastNamespacePosition + 1);
-                                               $classPathAndFilename  = str_replace('\\', '/', $namespace) . '/';
-                                       }
-                                       $classPathAndFilename .= str_replace('_', '/', $className) . '.php';
-                               }
+                               // If it's a TYPO3 package, classes don't comply to PSR-0.
+                               // The namespace part is substituted.
+                               $classPathAndFilename = '/' . str_replace('\\', '/', ltrim(substr($className, $packageData['namespaceLength']), '\\')) . '.php';
                                if (strtolower(substr($className, $packageData['namespaceLength'], 5)) === 'tests') {
                                        $classPathAndFilename = $packageData['packagePath'] . $classPathAndFilename;
                                } else {
@@ -459,7 +447,7 @@ class ClassLoader {
        /**
         * Sets the available packages
         *
-        * @param array $packages An array of \TYPO3\Flow\Package\Package objects
+        * @param array $packages An array of \TYPO3\CMS\Core\Package\Package objects
         * @return ClassLoader
         */
        public function setPackages(array $packages) {
@@ -478,10 +466,10 @@ class ClassLoader {
        /**
         * Add a package to class loader just during runtime, so classes can be loaded without the need for a new request
         *
-        * @param \TYPO3\Flow\Package\PackageInterface $package
+        * @param PackageInterface $package
         * @return ClassLoader
         */
-       public function addActivePackage(\TYPO3\Flow\Package\PackageInterface $package) {
+       public function addActivePackage(PackageInterface $package) {
                $packageKey = $package->getPackageKey();
                if (!isset($this->packages[$packageKey])) {
                        $this->packages[$packageKey] = $package;
@@ -530,14 +518,12 @@ class ClassLoader {
        /**
         * Builds the namespace and class paths for a single package
         *
-        * @param \TYPO3\Flow\Package\PackageInterface $package
+        * @param PackageInterface $package
         * @return void
         */
-       protected function buildPackageNamespaceAndClassesPath(\TYPO3\Flow\Package\PackageInterface $package) {
-               if ($package instanceof \TYPO3\Flow\Package\PackageInterface) {
-                       $this->buildPackageNamespace($package);
-               }
+       protected function buildPackageNamespaceAndClassesPath(PackageInterface $package) {
                if ($package instanceof PackageInterface) {
+                       $this->buildPackageNamespace($package);
                        $this->buildPackageClassPathsForLegacyExtension($package);
                }
        }
@@ -567,10 +553,10 @@ class ClassLoader {
        /**
         * Extracts the namespace from a package
         *
-        * @param \TYPO3\Flow\Package\PackageInterface $package
+        * @param PackageInterface $package
         * @return void
         */
-       protected function buildPackageNamespace(\TYPO3\Flow\Package\PackageInterface $package) {
+       protected function buildPackageNamespace(PackageInterface $package) {
                $packageNamespace = $package->getNamespace();
                // Ignore legacy extensions with unknown vendor name
                if ($packageNamespace[0] !== '*') {
@@ -578,7 +564,6 @@ class ClassLoader {
                                'namespaceLength' => strlen($packageNamespace),
                                'classesPath' => $package->getClassesPath(),
                                'packagePath' => $package->getPackagePath(),
-                               'substituteNamespaceInPath' => ($package instanceof PackageInterface)
                        );
                }
        }
index b36f2dd..d3a961c 100644 (file)
@@ -249,7 +249,7 @@ class DependencyResolver {
        protected function findFrameworkPackages(array $packageStateConfiguration) {
                $frameworkPackageKeys = array();
                /** @var PackageManager $packageManager */
-               $packageManager = Bootstrap::getInstance()->getEarlyInstance(\TYPO3\Flow\Package\PackageManager::class);
+               $packageManager = Bootstrap::getInstance()->getEarlyInstance(\TYPO3\CMS\Core\Package\PackageManager::class);
                foreach ($packageStateConfiguration as $packageKey => $packageConfiguration) {
                        /** @var Package $package */
                        $package = $packageManager->getPackage($packageKey);
diff --git a/typo3/sysext/core/Classes/Package/Exception/CorruptPackageException.php b/typo3/sysext/core/Classes/Package/Exception/CorruptPackageException.php
new file mode 100644 (file)
index 0000000..f93ed14
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+namespace TYPO3\CMS\Core\Package\Exception;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+/**
+ * "Corrupt Package" Exception
+ * Adapted from FLOW for TYPO3 CMS
+ */
+class CorruptPackageException extends \TYPO3\CMS\Core\Package\Exception {
+
+}
diff --git a/typo3/sysext/core/Classes/Package/Exception/InvalidPackageKeyException.php b/typo3/sysext/core/Classes/Package/Exception/InvalidPackageKeyException.php
new file mode 100644 (file)
index 0000000..d9e11b7
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+namespace TYPO3\CMS\Core\Package\Exception;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+/**
+ * An "Invalid Package Key" exception
+ * Adapted from FLOW for TYPO3 CMS
+ */
+class InvalidPackageKeyException extends \TYPO3\CMS\Core\Package\Exception {
+
+}
diff --git a/typo3/sysext/core/Classes/Package/Exception/InvalidPackageManifestException.php b/typo3/sysext/core/Classes/Package/Exception/InvalidPackageManifestException.php
new file mode 100644 (file)
index 0000000..bd492fa
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+namespace TYPO3\CMS\Core\Package\Exception;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+/**
+ * An "Invalid Package Key" exception
+ * Adapted from FLOW for TYPO3 CMS
+ */
+class InvalidPackageManifestException extends \TYPO3\CMS\Core\Package\Exception {
+
+}
diff --git a/typo3/sysext/core/Classes/Package/Exception/InvalidPackagePathException.php b/typo3/sysext/core/Classes/Package/Exception/InvalidPackagePathException.php
new file mode 100644 (file)
index 0000000..364d2ec
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+namespace TYPO3\CMS\Core\Package\Exception;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+/**
+ * "Invalid Package Path" Exception
+ * Adapted from FLOW for TYPO3 CMS
+ */
+class InvalidPackagePathException extends \TYPO3\CMS\Core\Package\Exception {
+
+}
diff --git a/typo3/sysext/core/Classes/Package/Exception/InvalidPackageStateException.php b/typo3/sysext/core/Classes/Package/Exception/InvalidPackageStateException.php
new file mode 100644 (file)
index 0000000..5c16d47
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+namespace TYPO3\CMS\Core\Package\Exception;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+/**
+ * An "Invalid Package State" exception
+ * Adapted from FLOW for TYPO3 CMS
+ */
+class InvalidPackageStateException extends \TYPO3\CMS\Core\Package\Exception {
+
+}
diff --git a/typo3/sysext/core/Classes/Package/Exception/MissingPackageManifestException.php b/typo3/sysext/core/Classes/Package/Exception/MissingPackageManifestException.php
new file mode 100644 (file)
index 0000000..72d8b27
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+namespace TYPO3\CMS\Core\Package\Exception;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+/**
+ * An "Invalid Package Key" exception
+ * Adapted from FLOW for TYPO3 CMS
+ */
+class MissingPackageManifestException extends \TYPO3\CMS\Core\Package\Exception {
+
+}
diff --git a/typo3/sysext/core/Classes/Package/Exception/PackageStatesFileNotWritableException.php b/typo3/sysext/core/Classes/Package/Exception/PackageStatesFileNotWritableException.php
new file mode 100644 (file)
index 0000000..2616d9a
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+namespace TYPO3\CMS\Core\Package\Exception;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+/**
+ * "Package states file not writable" Exception
+ * Adapted from FLOW for TYPO3 CMS
+ */
+class PackageStatesFileNotWritableException extends \TYPO3\CMS\Core\Package\Exception {
+
+}
diff --git a/typo3/sysext/core/Classes/Package/Exception/ProtectedPackageKeyException.php b/typo3/sysext/core/Classes/Package/Exception/ProtectedPackageKeyException.php
new file mode 100644 (file)
index 0000000..7aa4244
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+namespace TYPO3\CMS\Core\Package\Exception;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+/**
+ * A "Protected Package Key" exception
+ * Adapted from FLOW for TYPO3 CMS
+ */
+class ProtectedPackageKeyException extends \TYPO3\CMS\Core\Package\Exception {
+
+}
diff --git a/typo3/sysext/core/Classes/Package/Exception/UnknownPackageException.php b/typo3/sysext/core/Classes/Package/Exception/UnknownPackageException.php
new file mode 100644 (file)
index 0000000..559761f
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+namespace TYPO3\CMS\Core\Package\Exception;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+/**
+ * "Unknown Package" Exception
+ * Adapted from FLOW for TYPO3 CMS
+ */
+class UnknownPackageException extends \TYPO3\CMS\Core\Package\Exception {
+
+}
index 18f94ef..6b3efef 100644 (file)
@@ -19,7 +19,7 @@ namespace TYPO3\CMS\Core\Package;
  * the required extensions for the install in case the package
  * states are unavailable.
  */
-class FailsafePackageManager extends \TYPO3\CMS\Core\Package\PackageManager {
+class FailsafePackageManager extends PackageManager {
 
        /**
         * @var \TYPO3\CMS\Core\Configuration\ConfigurationManager
@@ -48,7 +48,7 @@ class FailsafePackageManager extends \TYPO3\CMS\Core\Package\PackageManager {
        protected function loadPackageStates() {
                try {
                        parent::loadPackageStates();
-               } catch (\TYPO3\CMS\Core\Package\Exception\PackageStatesUnavailableException $exception) {
+               } catch (Exception\PackageStatesUnavailableException $exception) {
                        $this->inFailsafeMode = TRUE;
                        $this->packageStatesConfiguration = array();
                        $this->scanAvailablePackages();
@@ -59,7 +59,7 @@ class FailsafePackageManager extends \TYPO3\CMS\Core\Package\PackageManager {
         * Requires and registers all packages which were defined in packageStatesConfiguration
         *
         * @return void
-        * @throws \TYPO3\Flow\Package\Exception\CorruptPackageException
+        * @throws \TYPO3\CMS\Core\Package\Exception\CorruptPackageException
         */
        protected function registerPackagesFromConfiguration() {
                $this->packageStatesConfiguration['packages']['install']['state'] = 'active';
@@ -85,5 +85,4 @@ class FailsafePackageManager extends \TYPO3\CMS\Core\Package\PackageManager {
        public function forceSortAndSavePackageStates() {
                parent::sortAndSavePackageStates();
        }
-
-}
\ No newline at end of file
+}
diff --git a/typo3/sysext/core/Classes/Package/MetaData.php b/typo3/sysext/core/Classes/Package/MetaData.php
new file mode 100644 (file)
index 0000000..a433bbe
--- /dev/null
@@ -0,0 +1,172 @@
+<?php
+namespace TYPO3\CMS\Core\Package;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+/**
+ * The default TYPO3 Package MetaData implementation
+ * Adapted from FLOW for TYPO3 CMS
+ */
+class MetaData {
+
+       const CONSTRAINT_TYPE_DEPENDS = 'depends';
+       const CONSTRAINT_TYPE_CONFLICTS = 'conflicts';
+       const CONSTRAINT_TYPE_SUGGESTS = 'suggests';
+
+       /**
+        * @var array
+        */
+       protected static $CONSTRAINT_TYPES = array(self::CONSTRAINT_TYPE_DEPENDS, self::CONSTRAINT_TYPE_CONFLICTS, self::CONSTRAINT_TYPE_SUGGESTS);
+
+       /**
+        * @var string
+        */
+       protected $packageKey;
+
+       /**
+        * Package type
+        *
+        * @var string
+        */
+       protected $packageType;
+
+       /**
+        * The version number
+        * @var string
+        */
+       protected $version;
+
+       /**
+        * Package title
+        * @var string
+        */
+       protected $title;
+
+       /**
+        * Package description
+        * @var string
+        */
+       protected $description;
+
+       /**
+        * constraints by constraint type (depends, conflicts, suggests)
+        * @var array
+        */
+       protected $constraints = array();
+
+       /**
+        * Get all available constraint types
+        *
+        * @return array All constraint types
+        */
+       public function getConstraintTypes() {
+               return self::$CONSTRAINT_TYPES;
+       }
+
+       /**
+        * Package metadata constructor
+        *
+        * @param string $packageKey The package key
+        */
+       public function __construct($packageKey) {
+               $this->packageKey = $packageKey;
+       }
+
+       /**
+        * @return string The package key
+        */
+       public function getPackageKey() {
+               return $this->packageKey;
+       }
+
+       /**
+        * Get package type
+        *
+        * @return string
+        */
+       public function getPackageType() {
+               return $this->packageType;
+       }
+
+       /**
+        * Set package type
+        *
+        * @param string $packageType
+        */
+       public function setPackageType($packageType) {
+               $this->packageType = $packageType;
+       }
+
+       /**
+        * @return string The package version
+        */
+       public function getVersion() {
+               return $this->version;
+       }
+
+       /**
+        * @param string $version The package version to set
+        * @return void
+        */
+       public function setVersion($version) {
+               $this->version = $version;
+       }
+
+       /**
+        * @return string The package description
+        */
+       public function getDescription() {
+               return $this->description;
+       }
+
+       /**
+        * @param string $description The package description to set
+        * @return void
+        */
+       public function setDescription($description) {
+               $this->description = $description;
+       }
+
+       /**
+        * Get all constraints
+        *
+        * @return array Package constraints
+        */
+       public function getConstraints() {
+               return $this->constraints;
+       }
+
+       /**
+        * Get the constraints by type
+        *
+        * @param string $constraintType Type of the constraints to get: CONSTRAINT_TYPE_*
+        * @return array Package constraints
+        */
+       public function getConstraintsByType($constraintType) {
+               if (!isset($this->constraints[$constraintType])) {
+                       return array();
+               }
+               return $this->constraints[$constraintType];
+       }
+
+       /**
+        * Add a constraint
+        *
+        * @param MetaData\PackageConstraint $constraint The constraint to add
+        * @return void
+        */
+       public function addConstraint(MetaData\PackageConstraint $constraint) {
+               $this->constraints[$constraint->getConstraintType()][] = $constraint;
+       }
+}
diff --git a/typo3/sysext/core/Classes/Package/MetaData/PackageConstraint.php b/typo3/sysext/core/Classes/Package/MetaData/PackageConstraint.php
new file mode 100644 (file)
index 0000000..346b4ab
--- /dev/null
@@ -0,0 +1,63 @@
+<?php
+namespace TYPO3\CMS\Core\Package\MetaData;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+/**
+ * Package constraint meta model
+ * Adapted from FLOW for TYPO3 CMS
+ */
+class PackageConstraint {
+
+       /**
+        * One of depends, conflicts or suggests
+        * @var string
+        */
+       protected $constraintType;
+
+       /**
+        * The constraint name or value
+        * @var string
+        */
+       protected $value;
+
+       /**
+        * Meta data constraint constructor
+        *
+        * @param string $constraintType
+        * @param string $value
+        * @param string $minVersion
+        * @param string $maxVersion
+        */
+       public function __construct($constraintType, $value, $minVersion = NULL, $maxVersion = NULL) {
+               $this->constraintType = $constraintType;
+               $this->value = $value;
+               $this->minVersion = $minVersion;
+               $this->maxVersion = $maxVersion;
+       }
+
+       /**
+        * @return string The constraint name or value
+        */
+       public function getValue() {
+               return $this->value;
+       }
+
+       /**
+        * @return string The constraint type (depends, conflicts, suggests)
+        */
+       public function getConstraintType() {
+               return $this->constraintType;
+       }
+}
index 5715f27..a524d5b 100644 (file)
@@ -1,25 +1,26 @@
 <?php
 namespace TYPO3\CMS\Core\Package;
 
-/*                                                                        *
- * This script belongs to the TYPO3 Flow framework.                       *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License, either version 3   *
- * of the License, or (at your option) any later version.                 *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use TYPO3\CMS\Core\Utility\PathUtility;
 
 /**
- * A Package
+ * A Package representing the details of an extension and/or a composer package
  * Adapted from FLOW for TYPO3 CMS
- *
- * @api
  */
-class Package extends \TYPO3\Flow\Package\Package implements PackageInterface {
-
-       const PATTERN_MATCH_EXTENSIONKEY = '/^[0-9a-z_-]+$/i';
+class Package implements PackageInterface {
 
        /**
         * @var array
@@ -32,11 +33,6 @@ class Package extends \TYPO3\Flow\Package\Package implements PackageInterface {
        protected $classAliases;
 
        /**
-        * @var bool
-        */
-       protected $objectManagementEnabled = NULL;
-
-       /**
         * @var array
         */
        protected $ignoredClassNames = array();
@@ -58,47 +54,90 @@ class Package extends \TYPO3\Flow\Package\Package implements PackageInterface {
        protected $partOfMinimalUsableSystem = FALSE;
 
        /**
+        * Unique key of this package.
+        * @var string
+        */
+       protected $packageKey;
+
+       /**
+        * @var string
+        */
+       protected $manifestPath = '';
+
+       /**
+        * Full path to this package's main directory
+        * @var string
+        */
+       protected $packagePath;
+
+       /**
+        * Full path to this package's PSR-0 class loader entry point
+        * @var string
+        */
+       protected $classesPath;
+
+       /**
+        * If this package is protected and therefore cannot be deactivated or deleted
+        * @var bool
+        * @api
+        */
+       protected $protected = FALSE;
+
+       /**
+        * @var \stdClass
+        */
+       protected $composerManifest;
+
+       /**
+        * Meta information about this package
+        * @var MetaData
+        */
+       protected $packageMetaData;
+
+       /**
+        * The namespace of the classes contained in this package
+        * @var string
+        */
+       protected $namespace;
+
+       /**
+        * @var PackageManager
+        */
+       protected $packageManager;
+
+       /**
         * Constructor
         *
-        * @param \TYPO3\Flow\Package\PackageManager $packageManager the package manager which knows this package
+        * @param PackageManager $packageManager the package manager which knows this package
         * @param string $packageKey Key of this package
         * @param string $packagePath Absolute path to the location of the package's composer manifest
-        * @param string $classesPath Path the classes of the package are in, relative to $packagePath. Optional, read from Composer manifest if not set.
-        * @param string $manifestPath Path the composer manifest of the package, relative to $packagePath. Optional, defaults to ''.
-        * @throws \TYPO3\Flow\Package\Exception\InvalidPackageKeyException if an invalid package key was passed
-        * @throws \TYPO3\Flow\Package\Exception\InvalidPackagePathException if an invalid package path was passed
-        * @throws \TYPO3\Flow\Package\Exception\InvalidPackageManifestException if no composer manifest file could be found
+        * @throws Exception\InvalidPackageKeyException if an invalid package key was passed
+        * @throws Exception\InvalidPackagePathException if an invalid package path was passed
+        * @throws Exception\InvalidPackageManifestException if no composer manifest file could be found
         */
-       public function __construct(\TYPO3\Flow\Package\PackageManager $packageManager, $packageKey, $packagePath, $classesPath = NULL, $manifestPath = '') {
+       public function __construct(PackageManager $packageManager, $packageKey, $packagePath) {
                if (!$packageManager->isPackageKeyValid($packageKey)) {
-                       throw new \TYPO3\Flow\Package\Exception\InvalidPackageKeyException('"' . $packageKey . '" is not a valid package key.', 1217959511);
+                       throw new Exception\InvalidPackageKeyException('"' . $packageKey . '" is not a valid package key.', 1217959511);
                }
-               if (!(@is_dir($packagePath) || (\TYPO3\Flow\Utility\Files::is_link($packagePath) && is_dir(\TYPO3\Flow\Utility\Files::getNormalizedPath($packagePath))))) {
-                       throw new \TYPO3\Flow\Package\Exception\InvalidPackagePathException(sprintf('Tried to instantiate a package object for package "%s" with a non-existing package path "%s". Either the package does not exist anymore, or the code creating this object contains an error.', $packageKey, $packagePath), 1166631890);
+               if (!(@is_dir($packagePath) || (is_link($packagePath) && is_dir($packagePath)))) {
+                       throw new Exception\InvalidPackagePathException(sprintf('Tried to instantiate a package object for package "%s" with a non-existing package path "%s". Either the package does not exist anymore, or the code creating this object contains an error.', $packageKey, $packagePath), 1166631890);
                }
                if (substr($packagePath, -1, 1) !== '/') {
-                       throw new \TYPO3\Flow\Package\Exception\InvalidPackagePathException(sprintf('The package path "%s" provided for package "%s" has no trailing forward slash.', $packagePath, $packageKey), 1166633722);
-               }
-               if ($classesPath[1] === '/') {
-                       throw new \TYPO3\Flow\Package\Exception\InvalidPackagePathException(sprintf('The package classes path provided for package "%s" has a leading forward slash.', $packageKey), 1334841321);
+                       throw new Exception\InvalidPackagePathException(sprintf('The package path "%s" provided for package "%s" has no trailing forward slash.', $packagePath, $packageKey), 1166633722);
                }
-               if (!@file_exists($packagePath . $manifestPath . 'ext_emconf.php')) {
-                       throw new \TYPO3\Flow\Package\Exception\InvalidPackageManifestException(sprintf('No ext_emconf file found for package "%s". Please create one at "%sext_emconf.php".', $packageKey, $manifestPath), 1360403545);
+               if (!@file_exists($packagePath . 'ext_emconf.php')) {
+                       throw new Exception\InvalidPackageManifestException(sprintf('No ext_emconf.php file found for package "%s".".', $packageKey), 1360403545);
                }
                $this->packageManager = $packageManager;
-               $this->manifestPath = $manifestPath;
                $this->packageKey = $packageKey;
-               $this->packagePath = \TYPO3\Flow\Utility\Files::getNormalizedPath($packagePath);
-               $this->classesPath = \TYPO3\Flow\Utility\Files::getNormalizedPath(\TYPO3\Flow\Utility\Files::concatenatePaths(array($this->packagePath, self::DIRECTORY_CLASSES)));
+               $this->packagePath = PathUtility::sanitizeTrailingSeparator($packagePath);
+               $this->classesPath = PathUtility::sanitizeTrailingSeparator($this->packagePath . self::DIRECTORY_CLASSES);
                try {
                        $this->getComposerManifest();
-               } catch (\TYPO3\Flow\Package\Exception\MissingPackageManifestException $exception) {
-                       $this->getExtensionEmconf($packageKey, $this->packagePath);
+               } catch (Exception\MissingPackageManifestException $exception) {
+                       $this->getExtensionEmconf();
                }
                $this->loadFlagsFromComposerManifest();
-               if ($this->objectManagementEnabled === NULL) {
-                       $this->objectManagementEnabled = FALSE;
-               }
        }
 
        /**
@@ -133,6 +172,95 @@ class Package extends \TYPO3\Flow\Package\Package implements PackageInterface {
        }
 
        /**
+        * Invokes custom PHP code directly after the package manager has been initialized.
+        *
+        * @param \TYPO3\CMS\Core\Core\Bootstrap $bootstrap The current bootstrap
+        * @return void
+        */
+       public function boot(\TYPO3\CMS\Core\Core\Bootstrap $bootstrap) {
+       }
+
+       /**
+        * Returns the package key of this package.
+        *
+        * @return string
+        * @api
+        */
+       public function getPackageKey() {
+               return $this->packageKey;
+       }
+
+       /**
+        * Tells if this package is protected and therefore cannot be deactivated or deleted
+        *
+        * @return bool
+        * @api
+        */
+       public function isProtected() {
+               return $this->protected;
+       }
+
+       /**
+        * Sets the protection flag of the package
+        *
+        * @param bool $protected TRUE if the package should be protected, otherwise FALSE
+        * @return void
+        * @api
+        */
+       public function setProtected($protected) {
+               $this->protected = (bool)$protected;
+       }
+
+       /**
+        * Returns the full path to this package's main directory
+        *
+        * @return string Path to this package's main directory
+        * @api
+        */
+       public function getPackagePath() {
+               return $this->packagePath;
+       }
+
+       /**
+        * Returns the full path to the packages Composer manifest
+        *
+        * @return string
+        */
+       public function getManifestPath() {
+               return $this->packagePath . $this->manifestPath;
+       }
+
+       /**
+        * Returns the full path to this package's Classes directory
+        *
+        * @return string Path to this package's Classes directory
+        * @api
+        */
+       public function getClassesPath() {
+               return $this->classesPath;
+       }
+
+       /**
+        * Returns the full path to this package's Resources directory
+        *
+        * @return string Path to this package's Resources directory
+        * @api
+        */
+       public function getResourcesPath() {
+               return $this->packagePath . self::DIRECTORY_RESOURCES;
+       }
+
+       /**
+        * Returns the full path to this package's Configuration directory
+        *
+        * @return string Path to this package's Configuration directory
+        * @api
+        */
+       public function getConfigurationPath() {
+               return $this->packagePath . self::DIRECTORY_CONFIGURATION;
+       }
+
+       /**
         * @return bool
         */
        protected function getExtensionEmconf() {
@@ -196,11 +324,25 @@ class Package extends \TYPO3\Flow\Package\Package implements PackageInterface {
        /**
         * Returns the package meta data object of this package.
         *
-        * @return \TYPO3\Flow\Package\MetaData
+        * @return MetaData
         */
        public function getPackageMetaData() {
                if ($this->packageMetaData === NULL) {
-                       parent::getPackageMetaData();
+                       $this->packageMetaData = new MetaData($this->getPackageKey());
+                       $this->packageMetaData->setDescription($this->getComposerManifest('description'));
+                       $this->packageMetaData->setVersion($this->getComposerManifest('version'));
+                       $requirements = $this->getComposerManifest('require');
+                       if ($requirements !== NULL) {
+                               foreach ($requirements as $requirement => $version) {
+                                       if ($this->packageRequirementIsComposerPackage($requirement) === FALSE) {
+                                               // Skip non-package requirements
+                                               continue;
+                                       }
+                                       $packageKey = $this->packageManager->getPackageKeyFromComposerName($requirement);
+                                       $constraint = new MetaData\PackageConstraint(MetaData::CONSTRAINT_TYPE_DEPENDS, $packageKey);
+                                       $this->packageMetaData->addConstraint($constraint);
+                               }
+                       }
                        $suggestions = $this->getComposerManifest('suggest');
                        if ($suggestions !== NULL) {
                                foreach ($suggestions as $suggestion => $version) {
@@ -209,7 +351,7 @@ class Package extends \TYPO3\Flow\Package\Package implements PackageInterface {
                                                continue;
                                        }
                                        $packageKey = $this->packageManager->getPackageKeyFromComposerName($suggestion);
-                                       $constraint = new \TYPO3\Flow\Package\MetaData\PackageConstraint(\TYPO3\Flow\Package\MetaDataInterface::CONSTRAINT_TYPE_SUGGESTS, $packageKey);
+                                       $constraint = new MetaData\PackageConstraint(MetaData::CONSTRAINT_TYPE_SUGGESTS, $packageKey);
                                        $this->packageMetaData->addConstraint($constraint);
                                }
                        }
@@ -229,42 +371,22 @@ class Package extends \TYPO3\Flow\Package\Package implements PackageInterface {
         * Returns the PHP namespace of classes in this package.
         *
         * @return string
-        * @api
+        * @throws Exception\InvalidPackageStateException
         */
        public function getNamespace() {
                if(!$this->namespace) {
-                       $manifest = $this->getComposerManifest();
-                       if (isset($manifest->autoload->{'psr-0'})) {
-                               $namespaces = $manifest->autoload->{'psr-0'};
-                               if (count($namespaces) === 1) {
-                                       $this->namespace = key($namespaces);
-                               } else {
-                                       throw new \TYPO3\Flow\Package\Exception\InvalidPackageStateException(sprintf('The Composer manifest of package "%s" contains multiple namespace definitions in its autoload section but Flow does only support one namespace per package.', $this->packageKey), 1348053246);
-                               }
+                       $packageKey = $this->getPackageKey();
+                       if (strpos($packageKey, '.') === FALSE) {
+                               // Old school with unknown vendor name
+                               $this->namespace =  '*\\' . \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($packageKey);
                        } else {
-                               $packageKey = $this->getPackageKey();
-                               if (strpos($packageKey, '.') === FALSE) {
-                                       // Old school with unknown vendor name
-                                       $this->namespace =  '*\\' . \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($packageKey);
-                               } else {
-                                       $this->namespace = str_replace('.', '\\', $packageKey);
-                               }
+                               $this->namespace = str_replace('.', '\\', $packageKey);
                        }
                }
                return $this->namespace;
        }
 
        /**
-        * @return array
-        */
-       public function getClassFiles() {
-               if (!is_array($this->classFiles)) {
-                       $this->classFiles = $this->filterClassFiles($this->buildArrayOfClassFiles($this->classesPath . '/', $this->namespace . '\\'));
-               }
-               return $this->classFiles;
-       }
-
-       /**
         * @param array $classFiles
         * @return array
         */
@@ -300,10 +422,7 @@ class Package extends \TYPO3\Flow\Package\Package implements PackageInterface {
        public function getClassAliases() {
                if (!is_array($this->classAliases)) {
                        try {
-                               $extensionClassAliasMapPathAndFilename = \TYPO3\Flow\Utility\Files::concatenatePaths(array(
-                                       $this->getPackagePath(),
-                                       'Migrations/Code/ClassAliasMap.php'
-                               ));
+                               $extensionClassAliasMapPathAndFilename = $this->getPackagePath() . 'Migrations/Code/ClassAliasMap.php';
                                if (@file_exists($extensionClassAliasMapPathAndFilename)) {
                                        $this->classAliases = require $extensionClassAliasMapPathAndFilename;
                                }
@@ -330,5 +449,99 @@ class Package extends \TYPO3\Flow\Package\Package implements PackageInterface {
                return preg_match('/^(php(-64bit)?|ext-[^\/]+|lib-(curl|iconv|libxml|openssl|pcre|uuid|xsl)|typo3|composer\/installers)$/', $requirement) !== 1;
        }
 
+       /**
+        * Returns contents of Composer manifest - or part there of.
+        *
+        * @param string $key Optional. Only return the part of the manifest indexed by 'key'
+        * @return mixed|NULL
+        * @see json_decode for return values
+        */
+       public function getComposerManifest($key = NULL) {
+               if (!isset($this->composerManifest)) {
+                       $this->composerManifest = PackageManager::getComposerManifest($this->getManifestPath());
+               }
+
+               return PackageManager::getComposerManifest($this->getManifestPath(), $key, $this->composerManifest);
+       }
+
+       /**
+        * Builds and returns an array of class names => file names of all
+        * *.php files in the package's Classes directory and its sub-
+        * directories.
+        *
+        * @param string $classesPath Base path acting as the parent directory for potential class files
+        * @param string $extraNamespaceSegment A PHP class namespace segment which should be inserted like so: \TYPO3\PackageKey\{namespacePrefix\}PathSegment\PathSegment\Filename
+        * @param string $subDirectory Used internally
+        * @param int $recursionLevel Used internally
+        * @return array
+        * @throws Exception if recursion into directories was too deep or another error occurred
+        */
+       protected function buildArrayOfClassFiles($classesPath, $extraNamespaceSegment = '', $subDirectory = '', $recursionLevel = 0) {
+               $classFiles = array();
+               $currentPath = $classesPath . $subDirectory;
+               $currentRelativePath = substr($currentPath, strlen($this->packagePath));
+
+               if (!is_dir($currentPath)) {
+                       return array();
+               }
+               if ($recursionLevel > 100) {
+                       throw new Exception('Recursion too deep.', 1166635495);
+               }
+
+               try {
+                       $classesDirectoryIterator = new \DirectoryIterator($currentPath);
+                       while ($classesDirectoryIterator->valid()) {
+                               $filename = $classesDirectoryIterator->getFilename();
+                               if ($filename[0] !== '.') {
+                                       if (is_dir($currentPath . $filename)) {
+                                               $classFiles = array_merge($classFiles, $this->buildArrayOfClassFiles($classesPath, $extraNamespaceSegment, $subDirectory . $filename . '/', ($recursionLevel + 1)));
+                                       } else {
+                                               if (substr($filename, -4, 4) === '.php') {
+                                                       $className = (str_replace('/', '\\', ($extraNamespaceSegment . substr($currentPath, strlen($classesPath)) . substr($filename, 0, -4))));
+                                                       $classFiles[$className] = $currentRelativePath . $filename;
+                                               }
+                                       }
+                               }
+                               $classesDirectoryIterator->next();
+                       }
+
+               } catch (\Exception $exception) {
+                       throw new Exception($exception->getMessage(), 1166633721);
+               }
+               return $classFiles;
+       }
 
+       /**
+        * Added by TYPO3 CMS
+        *
+        * The package caching serializes package objects.
+        * The package manager instance may not be serialized
+        * as a fresh instance is created upon every request.
+        *
+        * This method will be removed once the package is
+        * released of the package manager dependency.
+        *
+        * @return array
+        */
+       public function __sleep() {
+               $properties = get_class_vars(get_class($this));
+               unset($properties['packageManager']);
+               return array_keys($properties);
+       }
+
+       /**
+        * Added by TYPO3 CMS
+        *
+        * The package caching deserializes package objects.
+        * A fresh package manager instance has to be set
+        * during bootstrapping.
+        *
+        * This method will be removed once the package is
+        * released of the package manager dependency.
+        */
+       public function __wakeup() {
+               if (isset($GLOBALS['TYPO3_currentPackageManager'])) {
+                       $this->packageManager = $GLOBALS['TYPO3_currentPackageManager'];
+               }
+       }
 }
diff --git a/typo3/sysext/core/Classes/Package/PackageFactory.php b/typo3/sysext/core/Classes/Package/PackageFactory.php
deleted file mode 100644 (file)
index 5a68e6b..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-<?php
-namespace TYPO3\CMS\Core\Package;
-
-/*                                                                        *
- * This script belongs to the TYPO3 Flow framework.                       *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License, either version 3   *
- * of the License, or (at your option) any later version.                 *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-
-use TYPO3\Flow\Utility\Files;
-
-/**
- * Class for building Packages
- * Adapted from FLOW for TYPO3 CMS
- */
-class PackageFactory extends \TYPO3\Flow\Package\PackageFactory {
-
-       /**
-        * @var PackageManager
-        */
-       protected $packageManager;
-
-       /**
-        * Constructor
-        *
-        * @param \TYPO3\Flow\Package\PackageManager $packageManager
-        */
-       public function __construct(PackageManager $packageManager) {
-               $this->packageManager = $packageManager;
-       }
-
-       /**
-        * Returns a package instance.
-        *
-        * @param string $packagesBasePath the base install path of packages,
-        * @param string $packagePath path to package, relative to base path
-        * @param string $packageKey key / name of the package
-        * @param string $classesPath path to the classes directory, relative to the package path
-        * @param string $manifestPath path to the package's Composer manifest, relative to package path, defaults to same path
-        * @return \TYPO3\Flow\Package\PackageInterface
-        * @throws \TYPO3\Flow\Package\Exception\CorruptPackageException
-        */
-       public function create($packagesBasePath, $packagePath, $packageKey, $classesPath, $manifestPath = '') {
-               $packagePath = Files::getNormalizedPath(Files::concatenatePaths(array($packagesBasePath, $packagePath)));
-               $packageClassPathAndFilename = Files::concatenatePaths(array($packagePath, 'Classes/' . str_replace('.', '/', $packageKey) . '/Package.php'));
-               $alternativeClassPathAndFilename = Files::concatenatePaths(array($packagePath, 'Classes/Package.php'));
-               $packageClassPathAndFilename = @file_exists($alternativeClassPathAndFilename) ? $alternativeClassPathAndFilename : $packageClassPathAndFilename;
-               if (@file_exists($packageClassPathAndFilename)) {
-                       require_once($packageClassPathAndFilename);
-                       if (substr($packagePath, 0, strlen(PATH_typo3)) === PATH_typo3 && strpos($packageKey, '.') === FALSE) {
-                               // @todo Remove this exception once the systextension are renamed to proper Flow naming scheme packages
-                               $packageClassName = 'TYPO3\\CMS\\' . \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($packageKey) . '\Package';
-                       } else {
-                               $packageClassName = str_replace('.', '\\', $packageKey) . '\Package';
-                       }
-                       if (!class_exists($packageClassName, FALSE)) {
-                               throw new \TYPO3\Flow\Package\Exception\CorruptPackageException(sprintf('The package "%s" does not contain a valid package class. Check if the file "%s" really contains a class called "%s".', $packageKey, $packageClassPathAndFilename, $packageClassName), 1327587092);
-                       }
-               } else {
-                       $emConfPath = Files::concatenatePaths(array($packagePath, 'ext_emconf.php'));
-                       $packageClassName = @file_exists($emConfPath) ? \TYPO3\CMS\Core\Package\Package::class : \TYPO3\Flow\Package\Package::class;
-               }
-
-               /** @var $package \TYPO3\Flow\Package\PackageInterface */
-               $package = new $packageClassName($this->packageManager, $packageKey, $packagePath, $classesPath, $manifestPath);
-
-               return $package;
-       }
-
-       /**
-        * Resolves package key from Composer manifest
-        *
-        * If it is a Flow package the name of the containing directory will be used.
-        *
-        * Else if the composer name of the package matches the first part of the lowercased namespace of the package, the mixed
-        * case version of the composer name / namespace will be used, with backslashes replaced by dots.
-        *
-        * Else the composer name will be used with the slash replaced by a dot
-        *
-        * @param object $manifest
-        * @param string $packagePath
-        * @param string $packagesBasePath
-        * @throws \TYPO3\Flow\Package\Exception\InvalidPackageManifestException
-        * @return string
-        */
-       public static function getPackageKeyFromManifest($manifest, $packagePath, $packagesBasePath) {
-               if (!is_object($manifest)) {
-                       throw new  \TYPO3\Flow\Package\Exception\InvalidPackageManifestException('Invalid composer manifest in package path: ' . $packagePath, 1348146451);
-               }
-               if (isset($manifest->type) && substr($manifest->type, 0, 10) === 'typo3-cms-') {
-                       $relativePackagePath = substr($packagePath, strlen($packagesBasePath));
-                       $packageKey = substr($relativePackagePath, strpos($relativePackagePath, '/') + 1, -1);
-                       /**
-                        * @todo check that manifest name and directory follows convention
-                        */
-                       $packageKey = preg_replace('/[^A-Za-z0-9._-]/', '', $packageKey);
-                       return $packageKey;
-               } else {
-                       return parent::getPackageKeyFromManifest($manifest, $packagePath, $packagesBasePath);
-               }
-       }
-
-}
index f1992c2..b9e4229 100644 (file)
@@ -1,22 +1,32 @@
 <?php
 namespace TYPO3\CMS\Core\Package;
 
-/*                                                                        *
- * This script belongs to the TYPO3 Flow framework.                       *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License, either version 3   *
- * of the License, or (at your option) any later version.                 *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
 
 /**
- * Interface for a Flow Package class
- *
- * @api
+ * Interface for a TYPO3 Package class
+ * Adapted from FLOW for TYPO3 CMS
  */
-interface PackageInterface extends \TYPO3\Flow\Package\PackageInterface {
+interface PackageInterface {
+
+       const PATTERN_MATCH_PACKAGEKEY = '/^[a-z0-9]+\.(?:[a-z0-9][\.a-z0-9]*)+$/i';
+
+       const PATTERN_MATCH_EXTENSIONKEY = '/^[0-9a-z_-]+$/i';
+
+       const DIRECTORY_CLASSES = 'Classes/';
+       const DIRECTORY_CONFIGURATION = 'Configuration/';
+       const DIRECTORY_RESOURCES = 'Resources/';
 
        /**
         * @return array
@@ -44,4 +54,84 @@ interface PackageInterface extends \TYPO3\Flow\Package\PackageInterface {
         * @return bool
         */
        public function isPartOfMinimalUsableSystem();
+
+       /**
+        * Invokes custom PHP code directly after the package manager has been initialized.
+        *
+        * @param \TYPO3\CMS\Core\Core\Bootstrap $bootstrap The current bootstrap
+        * @return void
+        */
+       public function boot(\TYPO3\CMS\Core\Core\Bootstrap $bootstrap);
+
+       /**
+        * Returns the package meta object of this package.
+        *
+        * @return MetaData
+        */
+       public function getPackageMetaData();
+
+       /**
+        * Returns the package key of this package.
+        *
+        * @return string
+        * @api
+        */
+       public function getPackageKey();
+
+       /**
+        * Returns the PHP namespace of classes in this package.
+        *
+        * @return string
+        * @api
+        */
+       public function getNamespace();
+
+       /**
+        * Tells if this package is protected and therefore cannot be deactivated or deleted
+        *
+        * @return bool
+        * @api
+        */
+       public function isProtected();
+
+       /**
+        * Sets the protection flag of the package
+        *
+        * @param bool $protected TRUE if the package should be protected, otherwise FALSE
+        * @return void
+        * @api
+        */
+       public function setProtected($protected);
+
+       /**
+        * Returns the full path to this package's main directory
+        *
+        * @return string Path to this package's main directory
+        * @api
+        */
+       public function getPackagePath();
+
+       /**
+        * Returns the full path to this package's Classes directory
+        *
+        * @return string Path to this package's Classes directory
+        * @api
+        */
+       public function getClassesPath();
+
+       /**
+        * Returns the full path to this package's Resources directory
+        *
+        * @return string Path to this package's Resources directory
+        * @api
+        */
+       public function getResourcesPath();
+
+       /**
+        * Returns the full path to this package's Configuration directory
+        *
+        * @return string Path to this package's Configuration directory
+        * @api
+        */
+       public function getConfigurationPath();
 }
index e570cdb..420a6fe 100644 (file)
@@ -1,26 +1,27 @@
 <?php
 namespace TYPO3\CMS\Core\Package;
 
-/*                                                                        *
- * This script belongs to the TYPO3 Flow framework.                       *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License, either version 3   *
- * of the License, or (at your option) any later version.                 *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-
-use TYPO3\Flow\Annotations as Flow;
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\PathUtility;
 
 /**
  * The default TYPO3 Package Manager
  * Adapted from FLOW for TYPO3 CMS
- *
- * @api
- * @Flow\Scope("singleton")
  */
-class PackageManager extends \TYPO3\Flow\Package\PackageManager implements \TYPO3\CMS\Core\SingletonInterface {
+class PackageManager implements \TYPO3\CMS\Core\SingletonInterface {
 
        /**
         * @var \TYPO3\CMS\Core\Core\ClassLoader
@@ -79,6 +80,41 @@ class PackageManager extends \TYPO3\Flow\Package\PackageManager implements \TYPO
        protected $packagesBasePath = PATH_site;
 
        /**
+        * Array of available packages, indexed by package key
+        * @var array
+        */
+       protected $packages = array();
+
+       /**
+        * A translation table between lower cased and upper camel cased package keys
+        * @var array
+        */
+       protected $packageKeys = array();
+
+       /**
+        * A map between ComposerName and PackageKey, only available when scanAvailablePackages is run
+        * @var array
+        */
+       protected $composerNameToPackageKeyMap = array();
+
+       /**
+        * List of active packages as package key => package object
+        * @var array
+        */
+       protected $activePackages = array();
+
+       /**
+        * @var string
+        */
+       protected $packageStatesPathAndFilename;
+
+       /**
+        * Package states configuration as stored in the PackageStates.php file
+        * @var array
+        */
+       protected $packageStatesConfiguration = array();
+
+       /**
         * Constructor
         */
        public function __construct() {
@@ -91,7 +127,6 @@ class PackageManager extends \TYPO3\Flow\Package\PackageManager implements \TYPO
                        'composer'  => PATH_site . 'Packages',
                );
                $this->packageStatesPathAndFilename = PATH_typo3conf . 'PackageStates.php';
-               $this->packageFactory = new PackageFactory($this);
        }
 
        /**
@@ -118,10 +153,10 @@ class PackageManager extends \TYPO3\Flow\Package\PackageManager implements \TYPO
        /**
         * Initializes the package manager
         *
-        * @param \TYPO3\CMS\Core\Core\Bootstrap|\TYPO3\Flow\Core\Bootstrap $bootstrap The current bootstrap; Flow Bootstrap is here by intention to keep the PackageManager valid to the interface
+        * @param \TYPO3\CMS\Core\Core\Bootstrap $bootstrap The current bootstrap
         * @return void
         */
-       public function initialize(\TYPO3\Flow\Core\Bootstrap $bootstrap) {
+       public function initialize(\TYPO3\CMS\Core\Core\Bootstrap $bootstrap) {
                $this->bootstrap = $bootstrap;
 
                $loadedFromCache = FALSE;
@@ -153,16 +188,6 @@ class PackageManager extends \TYPO3\Flow\Package\PackageManager implements \TYPO
        }
 
        /**
-        * @return PackageFactory
-        */
-       protected function getPackageFactory() {
-               if (!isset($this->packageFactory)) {
-                       $this->packageFactory = new PackageFactory($this);
-               }
-               return $this->packageFactory;
-       }
-
-       /**
         * @return string
         */
        protected function getCacheIdentifier() {
@@ -203,22 +228,16 @@ class PackageManager extends \TYPO3\Flow\Package\PackageManager implements \TYPO
                                'loadedExtArray' => $GLOBALS['TYPO3_LOADED_EXT'],
                                'packageObjectsCacheEntryIdentifier' => $packageObjectsCacheEntryIdentifier
                        );
-                       $packageClassSources = array(
-                               'typo3\\flow\\package\\package' => NULL,
-                               'typo3\\cms\\core\\package\\package' => NULL,
-                       );
-                       foreach ($this->packages as $package) {
-                               $packageClassName = strtolower(get_class($package));
-                               if (!isset($packageClassSources[$packageClassName]) || $packageClassSources[$packageClassName] === NULL) {
-                                       $reflectionPackageClass = new \ReflectionClass($packageClassName);
-                                       $packageClassSource = file_get_contents($reflectionPackageClass->getFileName());
-                                       $packageClassSources[$packageClassName] = preg_replace('/<\?php|\?>/i', '', $packageClassSource);
-                               }
-                       }
+                       // add the reflection of the package class
+                       $packageClassName = strtolower(Package::class);
+                       $reflectionPackageClass = new \ReflectionClass($packageClassName);
+                       $packageClassSource = file_get_contents($reflectionPackageClass->getFileName());
+                       $packageClassSource = preg_replace('/<\?php|\?>/i', '', $packageClassSource);
+
                        $this->coreCache->set($packageObjectsCacheEntryIdentifier, serialize($this->packages));
                        $this->coreCache->set(
                                $cacheEntryIdentifier,
-                               implode(PHP_EOL, $packageClassSources) . PHP_EOL .
+                               $packageClassSource . PHP_EOL .
                                        'return ' . PHP_EOL . var_export($packageCache, TRUE) . ';'
                        );
                }
@@ -314,7 +333,6 @@ class PackageManager extends \TYPO3\Flow\Package\PackageManager implements \TYPO
         * For each package a Package object is created and stored in $this->packages.
         *
         * @return void
-        * @throws \TYPO3\Flow\Package\Exception\DuplicatePackageException
         */
        public function scanAvailablePackages() {
                $previousPackageStatesConfiguration = $this->packageStatesConfiguration;
@@ -351,17 +369,16 @@ class PackageManager extends \TYPO3\Flow\Package\PackageManager implements \TYPO
                        }
                        try {
                                $composerManifest = self::getComposerManifest($composerManifestPath);
-                               $packageKey = PackageFactory::getPackageKeyFromManifest($composerManifest, $packagePath, $packagesBasePath);
+                               $packageKey = $this->getPackageKeyFromManifest($composerManifest, $packagePath, $packagesBasePath);
                                $this->composerNameToPackageKeyMap[strtolower($composerManifest->name)] = $packageKey;
-                               $this->packageStatesConfiguration['packages'][$packageKey]['manifestPath'] = substr($composerManifestPath, strlen($packagePath)) ? : '';
                                $this->packageStatesConfiguration['packages'][$packageKey]['composerName'] = $composerManifest->name;
-                       } catch (\TYPO3\Flow\Package\Exception\MissingPackageManifestException $exception) {
+                       } catch (Exception\MissingPackageManifestException $exception) {
                                $relativePackagePath = substr($packagePath, strlen($packagesBasePath));
                                $packageKey = substr($relativePackagePath, strpos($relativePackagePath, '/') + 1, -1);
                                if (!$this->isPackageKeyValid($packageKey)) {
                                        continue;
                                }
-                       } catch (\TYPO3\Flow\Package\Exception\InvalidPackageKeyException $exception) {
+                       } catch (Exception\InvalidPackageKeyException $exception) {
                                continue;
                        }
                        if (!isset($this->packageStatesConfiguration['packages'][$packageKey]['state'])) {
@@ -369,9 +386,6 @@ class PackageManager extends \TYPO3\Flow\Package\PackageManager implements \TYPO
                        }
 
                        $this->packageStatesConfiguration['packages'][$packageKey]['packagePath'] = str_replace($this->packagesBasePath, '', $packagePath);
-
-                       // Change this to read the target from Composer or any other source
-                       $this->packageStatesConfiguration['packages'][$packageKey]['classesPath'] = Package::DIRECTORY_CLASSES;
                }
 
                $registerOnlyNewPackages = !empty($this->packages);
@@ -388,7 +402,7 @@ class PackageManager extends \TYPO3\Flow\Package\PackageManager implements \TYPO
        protected function scanLegacyExtensions(&$collectedExtensionPaths = array()) {
                $legacyCmsPackageBasePathTypes = array('sysext', 'global', 'local');
                foreach ($this->packagesBasePaths as $type => $packageBasePath) {
-                       if (!in_array($type, $legacyCmsPackageBasePathTypes)) {
+                       if (!in_array($type, $legacyCmsPackageBasePathTypes, TRUE)) {
                                continue;
                        }
                        /** @var $fileInfo \SplFileInfo */
@@ -398,7 +412,9 @@ class PackageManager extends \TYPO3\Flow\Package\PackageManager implements \TYPO
                                }
                                $filename = $fileInfo->getFilename();
                                if ($filename[0] !== '.') {
-                                       $currentPath = \TYPO3\Flow\Utility\Files::getUnixStylePath($fileInfo->getPathName()) . '/';
+                                       // Fix Windows backslashes
+                                       // we can't use GeneralUtility::fixWindowsFilePath as we have to keep double slashes for Unit Tests (vfs://)
+                                       $currentPath = str_replace('\\', '/', $fileInfo->getPathName()) . '/';
                                        // Only add the extension if we have an EMCONF and the extension is not yet registered.
                                        // This is crucial in order to allow overriding of system extension by local extensions
                                        // and strongly depends on the order of paths defined in $this->packagesBasePaths.
@@ -412,17 +428,21 @@ class PackageManager extends \TYPO3\Flow\Package\PackageManager implements \TYPO
        }
 
        /**
-        * Looks for composer.json in the given path and returns a path or NULL.
+        * Looks for composer.json in the given path and returns TRUE or FALSE if a ext_emconf.php exists
+        * or no composer.json is found.
         *
         * @param string $packagePath
-        * @return array
+        * @return bool TRUE if a composer.json exists or FALSE if none exists
         */
-       protected function findComposerManifestPaths($packagePath) {
+       protected function hasComposerManifestFile($packagePath) {
                // If an ext_emconf.php file is found, we don't need to look deeper
                if (file_exists($packagePath . '/ext_emconf.php')) {
-                       return array();
+                       return FALSE;
                }
-               return parent::findComposerManifestPaths($packagePath);
+               if (file_exists($packagePath . '/composer.json')) {
+                       return TRUE;
+               }
+               return FALSE;
        }
 
        /**
@@ -430,7 +450,7 @@ class PackageManager extends \TYPO3\Flow\Package\PackageManager implements \TYPO
         *
         * @param bool $registerOnlyNewPackages
         * @return void
-        * @throws \TYPO3\Flow\Package\Exception\CorruptPackageException
+        * @throws Exception\CorruptPackageException
         */
        protected function registerPackagesFromConfiguration($registerOnlyNewPackages = FALSE) {
                $packageStatesHasChanged = FALSE;
@@ -441,16 +461,14 @@ class PackageManager extends \TYPO3\Flow\Package\PackageManager implements \TYPO
                        }
 
                        $packagePath = isset($stateConfiguration['packagePath']) ? $stateConfiguration['packagePath'] : NULL;
-                       $classesPath = isset($stateConfiguration['classesPath']) ? $stateConfiguration['classesPath'] : NULL;
-                       $manifestPath = isset($stateConfiguration['manifestPath']) ? $stateConfiguration['manifestPath'] : NULL;
-
                        try {
-                               $package = $this->getPackageFactory()->create($this->packagesBasePath, $packagePath, $packageKey, $classesPath, $manifestPath);
-                       } catch (\TYPO3\Flow\Package\Exception\InvalidPackagePathException $exception) {
+                               $packagePath = PathUtility::sanitizeTrailingSeparator($this->packagesBasePath . $packagePath);
+                               $package = new Package($this, $packageKey, $packagePath);
+                       } catch (Exception\InvalidPackagePathException $exception) {
                                $this->unregisterPackageByPackageKey($packageKey);
                                $packageStatesHasChanged = TRUE;
                                continue;
-                       } catch (\TYPO3\Flow\Package\Exception\InvalidPackageKeyException $exception) {
+                       } catch (Exception\InvalidPackageKeyException $exception) {
                                $this->unregisterPackageByPackageKey($packageKey);
                                $packageStatesHasChanged = TRUE;
                                continue;
@@ -458,8 +476,8 @@ class PackageManager extends \TYPO3\Flow\Package\PackageManager implements \TYPO
 
                        $this->registerPackage($package, FALSE);
 
-                       if (!$this->packages[$packageKey] instanceof \TYPO3\Flow\Package\PackageInterface) {
-                               throw new \TYPO3\Flow\Package\Exception\CorruptPackageException(sprintf('The package class in package "%s" does not implement PackageInterface.', $packageKey), 1300782488);
+                       if (!$this->packages[$packageKey] instanceof PackageInterface) {
+                               throw new Exception\CorruptPackageException(sprintf('The package class in package "%s" does not implement PackageInterface.', $packageKey), 1300782488);
                        }
 
                        $this->packageKeys[strtolower($packageKey)] = $packageKey;
@@ -473,15 +491,26 @@ class PackageManager extends \TYPO3\Flow\Package\PackageManager implements \TYPO
        }
 
        /**
-        * Register a native Flow package
+        * Register a native TYPO3 package
         *
-        * @param \TYPO3\Flow\Package\PackageInterface $package The Package to be registered
+        * @param PackageInterface $package The Package to be registered
         * @param bool $sortAndSave allows for not saving packagestates when used in loops etc.
-        * @return \TYPO3\Flow\Package\PackageInterface
-        * @throws \TYPO3\Flow\Package\Exception\CorruptPackageException
+        * @return PackageInterface
+        * @throws Exception\CorruptPackageException
         */
-       public function registerPackage(\TYPO3\Flow\Package\PackageInterface $package, $sortAndSave = TRUE) {
-               $package = parent::registerPackage($package, $sortAndSave);
+       public function registerPackage(PackageInterface $package, $sortAndSave = TRUE) {
+               $packageKey = $package->getPackageKey();
+               if ($this->isPackageAvailable($packageKey)) {
+                       throw new Exception\InvalidPackageStateException('Package "' . $packageKey . '" is already registered.', 1338996122);
+               }
+
+               $this->packages[$packageKey] = $package;
+               $this->packageStatesConfiguration['packages'][$packageKey]['packagePath'] = str_replace($this->packagesBasePath, '', $package->getPackagePath());
+
+               if ($sortAndSave === TRUE) {
+                       $this->sortAndSavePackageStates();
+               }
+
                if ($package instanceof PackageInterface) {
                        foreach ($package->getPackageReplacementKeys() as $packageToReplace => $versionConstraint) {
                                $this->packageAliasMap[strtolower($packageToReplace)] = $package->getPackageKey();
@@ -505,7 +534,7 @@ class PackageManager extends \TYPO3\Flow\Package\PackageManager implements \TYPO
                                }
                                $packageKey = $package->getPackageKey();
                        }
-               } catch (\TYPO3\Flow\Package\Exception\UnknownPackageException $e) {
+               } catch (Exception\UnknownPackageException $e) {
                }
                unset($this->packages[$packageKey]);
                unset($this->packageKeys[strtolower($packageKey)]);
@@ -513,21 +542,25 @@ class PackageManager extends \TYPO3\Flow\Package\PackageManager implements \TYPO
        }
 
        /**
-        * Resolves a Flow package key from a composer package name.
+        * Resolves a TYPO3 package key from a composer package name.
         *
         * @param string $composerName
         * @return string
-        * @throws \TYPO3\Flow\Package\Exception\InvalidPackageStateException
         */
        public function getPackageKeyFromComposerName($composerName) {
                if (isset($this->packageAliasMap[$composerName])) {
                        return $this->packageAliasMap[$composerName];
                }
-               try {
-                       return parent::getPackageKeyFromComposerName($composerName);
-               } catch (\TYPO3\Flow\Package\Exception\InvalidPackageStateException $exception) {
+               if (empty($this->composerNameToPackageKeyMap)) {
+                       foreach ($this->packageStatesConfiguration['packages'] as $packageKey => $packageStateConfiguration) {
+                               $this->composerNameToPackageKeyMap[strtolower($packageStateConfiguration['composerName'])] = $packageKey;
+                       }
+               }
+               $lowercasedComposerName = strtolower($composerName);
+               if (!isset($this->composerNameToPackageKeyMap[$lowercasedComposerName])) {
                        return $composerName;
                }
+               return $this->composerNameToPackageKeyMap[$lowercasedComposerName];
        }
 
        /**
@@ -555,15 +588,18 @@ class PackageManager extends \TYPO3\Flow\Package\PackageManager implements \TYPO
         * A package is available, if the package directory contains valid MetaData information.
         *
         * @param string $packageKey
-        * @return \TYPO3\Flow\Package\PackageInterface The requested package object
-        * @throws \TYPO3\Flow\Package\Exception\UnknownPackageException if the specified package is not known
+        * @return PackageInterface The requested package object
+        * @throws Exception\UnknownPackageException if the specified package is not known
         * @api
         */
        public function getPackage($packageKey) {
                if (isset($this->packageAliasMap[$lowercasedPackageKey = strtolower($packageKey)])) {
                        $packageKey = $this->packageAliasMap[$lowercasedPackageKey];
                }
-               return parent::getPackage($packageKey);
+               if (!$this->isPackageAvailable($packageKey)) {
+                       throw new Exception\UnknownPackageException('Package "' . $packageKey . '" is not available. Please check if the package exists and that the package key is correct (package keys are case sensitive).', 1166546734);
+               }
+               return $this->packages[$packageKey];
        }
 
        /**
@@ -578,7 +614,7 @@ class PackageManager extends \TYPO3\Flow\Package\PackageManager implements \TYPO
                if (isset($this->packageAliasMap[$lowercasedPackageKey = strtolower($packageKey)])) {
                        $packageKey = $this->packageAliasMap[$lowercasedPackageKey];
                }
-               return parent::isPackageAvailable($packageKey);
+               return isset($this->packages[$packageKey]);
        }
 
        /**
@@ -589,10 +625,7 @@ class PackageManager extends \TYPO3\Flow\Package\PackageManager implements \TYPO
         * @api
         */
        public function isPackageActive($packageKey) {
-               if (isset($this->packageAliasMap[$lowercasedPackageKey = strtolower($packageKey)])) {
-                       $packageKey = $this->packageAliasMap[$lowercasedPackageKey];
-               }
-               return isset($this->runtimeActivatedPackages[$packageKey]) || parent::isPackageActive($packageKey);
+               return isset($this->runtimeActivatedPackages[$packageKey]) || isset($this->activePackages[$packageKey]);
        }
 
        /**
@@ -605,13 +638,23 @@ class PackageManager extends \TYPO3\Flow\Package\PackageManager implements \TYPO
                        if ($packageKey === $packageStateKey || empty($packageStateConfiguration['dependencies']) || $packageStateConfiguration['state'] !== 'active') {
                                continue;
                        }
-                       if (in_array($packageKey, $packageStateConfiguration['dependencies'])) {
+                       if (in_array($packageKey, $packageStateConfiguration['dependencies'], TRUE)) {
                                $this->deactivatePackage($packageStateKey);
                        }
                }
 
+               if (!$this->isPackageActive($packageKey)) {
+                       return;
+               }
+
                $package = $this->getPackage($packageKey);
-               parent::deactivatePackage($package->getPackageKey());
+               if ($package->isProtected()) {
+                       throw new Exception\ProtectedPackageKeyException('The package "' . $packageKey . '" is protected and cannot be deactivated.', 1308662891);
+               }
+
+               unset($this->activePackages[$packageKey]);
+               $this->packageStatesConfiguration['packages'][$packageKey]['state'] = 'inactive';
+               $this->sortAndSavePackageStates();
                $this->classLoader->setPackages($this->activePackages);
        }
 
@@ -619,8 +662,17 @@ class PackageManager extends \TYPO3\Flow\Package\PackageManager implements \TYPO
         * @param string $packageKey
         */
        public function activatePackage($packageKey) {
+               if ($this->isPackageActive($packageKey)) {
+                       return;
+               }
+
                $package = $this->getPackage($packageKey);
-               parent::activatePackage($package->getPackageKey());
+               $this->activePackages[$packageKey] = $package;
+               $this->packageStatesConfiguration['packages'][$packageKey]['state'] = 'active';
+               if (!isset($this->packageStatesConfiguration['packages'][$packageKey]['packagePath'])) {
+                       $this->packageStatesConfiguration['packages'][$packageKey]['packagePath'] = str_replace($this->packagesBasePath, '', $package->getPackagePath());
+               }
+               $this->sortAndSavePackageStates();
                $this->classLoader->addActivePackage($package);
        }
 
@@ -640,59 +692,49 @@ class PackageManager extends \TYPO3\Flow\Package\PackageManager implements \TYPO
                }
        }
 
-
        /**
+        * removes a package from the file system.
+        *
         * @param string $packageKey
+        * @throws Exception
+        * @throws Exception\InvalidPackageStateException
+        * @throws Exception\ProtectedPackageKeyException
+        * @throws Exception\UnknownPackageException
         */
        public function deletePackage($packageKey) {
-               $package = $this->getPackage($packageKey);
-               parent::deletePackage($package->getPackageKey());
-       }
-
+               if (!$this->isPackageAvailable($packageKey)) {
+                       throw new Exception\UnknownPackageException('Package "' . $packageKey . '" is not available and cannot be removed.', 1166543253);
+               }
 
-       /**
-        * @param string $packageKey
-        */
-       public function freezePackage($packageKey) {
                $package = $this->getPackage($packageKey);
-               parent::freezePackage($package->getPackageKey());
-       }
+               if ($package->isProtected()) {
+                       throw new Exception\ProtectedPackageKeyException('The package "' . $packageKey . '" is protected and cannot be removed.', 1220722120);
+               }
 
-       /**
-        * @param string $packageKey
-        * @return bool
-        */
-       public function isPackageFrozen($packageKey) {
-               $package = $this->getPackage($packageKey);
-               return parent::isPackageFrozen($package->getPackageKey());
-       }
+               if ($this->isPackageActive($packageKey)) {
+                       $this->deactivatePackage($packageKey);
+               }
 
-       /**
-        * @param string $packageKey
-        */
-       public function unfreezePackage($packageKey) {
-               $package = $this->getPackage($packageKey);
-               parent::unfreezePackage($package->getPackageKey());
-       }
+               $this->unregisterPackage($package);
 
-       /**
-        * @param string $packageKey
-        */
-       public function refreezePackage($packageKey) {
-               $package = $this->getPackage($packageKey);
-               parent::refreezePackage($package->getPackageKey());
+               $packagePath = $package->getPackagePath();
+               $deletion = GeneralUtility::rmdir($packagePath, TRUE);
+               if ($deletion === FALSE) {
+                       throw new Exception('Please check file permissions. The directory "' . $packagePath . '" for package "' . $packageKey . '" could not be removed.', 1301491089, $exception);
+               }
        }
 
+
        /**
-        * Returns an array of \TYPO3\Flow\Package objects of all active packages.
+        * Returns an array of \TYPO3\CMS\Core\Package objects of all active packages.
         * A package is active, if it is available and has been activated in the package
         * manager settings. This method returns runtime activated packages too
         *
-        * @return \TYPO3\Flow\Package\PackageInterface[]
+        * @return PackageInterface[]
         * @api
         */
        public function getActivePackages() {
-               return array_merge(parent::getActivePackages(), $this->runtimeActivatedPackages);
+               return array_merge($this->activePackages, $this->runtimeActivatedPackages);
        }
 
        /**
@@ -723,7 +765,9 @@ class PackageManager extends \TYPO3\Flow\Package\PackageManager implements \TYPO
         * @return void
         */
        protected function resolvePackageDependencies() {
-               parent::resolvePackageDependencies();
+               foreach ($this->packages as $packageKey => $package) {
+                       $this->packageStatesConfiguration['packages'][$packageKey]['dependencies'] = $this->getDependencyArrayForPackage($packageKey);
+               }
                foreach ($this->packages as $packageKey => $package) {
                        $this->packageStatesConfiguration['packages'][$packageKey]['suggestions'] = $this->getSuggestionArrayForPackage($packageKey);
                }
@@ -740,9 +784,9 @@ class PackageManager extends \TYPO3\Flow\Package\PackageManager implements \TYPO
                        return NULL;
                }
                $suggestedPackageKeys = array();
-               $suggestedPackageConstraints = $this->packages[$packageKey]->getPackageMetaData()->getConstraintsByType(\TYPO3\Flow\Package\MetaDataInterface::CONSTRAINT_TYPE_SUGGESTS);
+               $suggestedPackageConstraints = $this->packages[$packageKey]->getPackageMetaData()->getConstraintsByType(MetaData::CONSTRAINT_TYPE_SUGGESTS);
                foreach ($suggestedPackageConstraints as $constraint) {
-                       if ($constraint instanceof \TYPO3\Flow\Package\MetaData\PackageConstraint) {
+                       if ($constraint instanceof MetaData\PackageConstraint) {
                                $suggestedPackageKey = $constraint->getValue();
                                if (isset($this->packages[$suggestedPackageKey])) {
                                        $suggestedPackageKeys[] = $suggestedPackageKey;
@@ -759,8 +803,35 @@ class PackageManager extends \TYPO3\Flow\Package\PackageManager implements \TYPO
         * @return void
         */
        protected function sortAndSavePackageStates() {
-               parent::sortAndSavePackageStates();
-               \TYPO3\CMS\Core\Utility\GeneralUtility::fixPermissions($this->packageStatesPathAndFilename);
+               $this->sortAvailablePackagesByDependencies();
+
+               $this->packageStatesConfiguration['version'] = 4;
+
+               $fileDescription = "# PackageStates.php\n\n";
+               $fileDescription .= "# This file is maintained by TYPO3's package management. Although you can edit it\n";
+               $fileDescription .= "# manually, you should rather use the extension manager for maintaining packages.\n";
+               $fileDescription .= "# This file will be regenerated automatically if it doesn't exist. Deleting this file\n";
+               $fileDescription .= "# should, however, never become necessary if you use the package commands.\n";
+
+                       // we do not need the dependencies on disk...
+               foreach ($this->packageStatesConfiguration['packages'] as &$packageConfiguration) {
+                       if (isset($packageConfiguration['dependencies'])) {
+                               unset($packageConfiguration['dependencies']);
+                       }
+               }
+               if (!@is_writable($this->packageStatesPathAndFilename)) {
+                       // If file does not exists try to create it
+                       $fileHandle = @fopen($this->packageStatesPathAndFilename, 'x');
+                       if (!$fileHandle) {
+                               throw new Exception\PackageStatesFileNotWritableException(
+                                       sprintf('We could not update the list of installed packages because the file %s is not writable. Please, check the file system permissions for this file and make sure that the web server can update it.', $this->packageStatesPathAndFilename),
+                                       1382449759
+                               );
+                       }
+                       fclose($fileHandle);
+               }
+               $packageStatesCode = "<?php\n$fileDescription\nreturn " . var_export($this->packageStatesConfiguration, TRUE) . "\n ?>";
+               GeneralUtility::writeFile($this->packageStatesPathAndFilename, $packageStatesCode, TRUE);
 
                $this->initializeCompatibilityLoadedExtArray();
                \TYPO3\CMS\Core\Utility\OpcodeCacheUtility::clearAllActive($this->packageStatesPathAndFilename);
@@ -774,7 +845,151 @@ class PackageManager extends \TYPO3\Flow\Package\PackageManager implements \TYPO
         * @api
         */
        public function isPackageKeyValid($packageKey) {
-               return parent::isPackageKeyValid($packageKey) || preg_match(\TYPO3\CMS\Core\Package\Package::PATTERN_MATCH_EXTENSIONKEY, $packageKey) === 1;
+               return preg_match(PackageInterface::PATTERN_MATCH_PACKAGEKEY, $packageKey) === 1 || preg_match(PackageInterface::PATTERN_MATCH_EXTENSIONKEY, $packageKey) === 1;
        }
 
+       /**
+        * Returns an array of \TYPO3\CMS\Core\Package objects of all available packages.
+        * A package is available, if the package directory contains valid meta information.
+        *
+        * @return array Array of PackageInterface
+        * @api
+        */
+       public function getAvailablePackages() {
+               return $this->packages;
+       }
+
+       /**
+        * Unregisters a package from the list of available packages
+        *
+        * @param PackageInterface $package The package to be unregistered
+        * @return void
+        * @throws Exception\InvalidPackageStateException
+        */
+       public function unregisterPackage(PackageInterface $package) {
+               $packageKey = $package->getPackageKey();
+               if (!$this->isPackageAvailable($packageKey)) {
+                       throw new Exception\InvalidPackageStateException('Package "' . $packageKey . '" is not registered.', 1338996142);
+               }
+               $this->unregisterPackageByPackageKey($packageKey);
+       }
+
+       /**
+        * Scans all sub directories of the specified directory and collects the package keys of packages it finds.
+        *
+        * The return of the array is to make this method usable in array_merge.
+        *
+        * @param string $startPath
+        * @param array $collectedPackagePaths
+        * @return array
+        */
+       protected function scanPackagesInPath($startPath, array &$collectedPackagePaths = array()) {
+               foreach (new \DirectoryIterator($startPath) as $fileInfo) {
+                       if (!$fileInfo->isDir()) {
+                               continue;
+                       }
+                       $filename = $fileInfo->getFilename();
+                       if ($filename[0] !== '.') {
+                               $currentPath = $fileInfo->getPathName();
+                               if ($this->hasComposerManifestFile($currentPath)) {
+                                       $collectedPackagePaths[$currentPath . '/'] = $currentPath . '/';
+                               }
+                       }
+               }
+               return $collectedPackagePaths;
+       }
+
+       /**
+        * Returns contents of Composer manifest - or part there of.
+        *
+        * @param string $manifestPath
+        * @param string $key Optional. Only return the part of the manifest indexed by 'key'
+        * @param object $composerManifest Optional. Manifest to use instead of reading it from file
+        * @return mixed
+        * @throws Exception\MissingPackageManifestException
+        * @see json_decode for return values
+        */
+       static public function getComposerManifest($manifestPath, $key = NULL, $composerManifest = NULL) {
+               if ($composerManifest === NULL) {
+                       if (!file_exists($manifestPath . 'composer.json')) {
+                               throw new Exception\MissingPackageManifestException('No composer manifest file found at "' . $manifestPath . '/composer.json".', 1349868540);
+                       }
+                       $json = file_get_contents($manifestPath . 'composer.json');
+                       $composerManifest = json_decode($json);
+               }
+
+               if ($key !== NULL) {
+                       if (isset($composerManifest->{$key})) {
+                               $value = $composerManifest->{$key};
+                       } else {
+                               $value = NULL;
+                       }
+               } else {
+                       $value = $composerManifest;
+               }
+               return $value;
+       }
+
+       /**
+        * Returns an array of dependent package keys for the given package. It will
+        * do this recursively, so dependencies of dependant packages will also be
+        * in the result.
+        *
+        * @param string $packageKey The package key to fetch the dependencies for
+        * @param array $dependentPackageKeys
+        * @param array $trace An array of already visited package keys, to detect circular dependencies
+        * @return array|NULL An array of direct or indirect dependant packages
+        * @throws Exception\InvalidPackageKeyException
+        */
+       protected function getDependencyArrayForPackage($packageKey, array &$dependentPackageKeys = array(), array $trace = array()) {
+               if (!isset($this->packages[$packageKey])) {
+                       return NULL;
+               }
+               if (in_array($packageKey, $trace, TRUE) !== FALSE) {
+                       return $dependentPackageKeys;
+               }
+               $trace[] = $packageKey;
+               $dependentPackageConstraints = $this->packages[$packageKey]->getPackageMetaData()->getConstraintsByType(MetaData::CONSTRAINT_TYPE_DEPENDS);
+               foreach ($dependentPackageConstraints as $constraint) {
+                       if ($constraint instanceof MetaData\PackageConstraint) {
+                               $dependentPackageKey = $constraint->getValue();
+                               if (in_array($dependentPackageKey, $dependentPackageKeys, TRUE) === FALSE && in_array($dependentPackageKey, $trace, TRUE) === FALSE) {
+                                       $dependentPackageKeys[] = $dependentPackageKey;
+                               }
+                               $this->getDependencyArrayForPackage($dependentPackageKey, $dependentPackageKeys, $trace);
+                       }
+               }
+               return array_reverse($dependentPackageKeys);
+       }
+
+
+       /**
+        * Resolves package key from Composer manifest
+        *
+        * If it is a TYPO3 package the name of the containing directory will be used.
+        *
+        * Else if the composer name of the package matches the first part of the lowercased namespace of the package, the mixed
+        * case version of the composer name / namespace will be used, with backslashes replaced by dots.
+        *
+        * Else the composer name will be used with the slash replaced by a dot
+        *
+        * @param object $manifest
+        * @param string $packagePath
+        * @param string $packagesBasePath
+        * @throws Exception\InvalidPackageManifestException
+        * @return string
+        */
+       protected function getPackageKeyFromManifest($manifest, $packagePath, $packagesBasePath) {
+               if (!is_object($manifest)) {
+                       throw new Exception\InvalidPackageManifestException('Invalid composer manifest in package path: ' . $packagePath, 1348146451);
+               }
+               if (isset($manifest->type) && substr($manifest->type, 0, 10) === 'typo3-cms-') {
+                       $relativePackagePath = substr($packagePath, strlen($packagesBasePath));
+                       $packageKey = substr($relativePackagePath, strpos($relativePackagePath, '/') + 1, -1);
+                       return preg_replace('/[^A-Za-z0-9._-]/', '', $packageKey);
+               } else {
+                       $packageKey = str_replace('/', '.', $manifest->name);
+                       return preg_replace('/[^A-Za-z0-9.]/', '', $packageKey);
+               }
+       }
 }
index 0f55644..86cec72 100644 (file)
@@ -20,15 +20,15 @@ namespace TYPO3\CMS\Core\Package;
  * so that the class loader can find the classes of all tests,
  * whether the according extension is active in the installation itself or not.
  */
-class UnitTestPackageManager extends \TYPO3\CMS\Core\Package\PackageManager {
+class UnitTestPackageManager extends PackageManager {
 
        /**
         * Initializes the package manager
         *
-        * @param \TYPO3\CMS\Core\Core\Bootstrap|\TYPO3\Flow\Core\Bootstrap $bootstrap The current bootstrap; Flow Bootstrap is here by intention to keep the PackageManager valid to the interface
+        * @param \TYPO3\CMS\Core\Core\Bootstrap $bootstrap The current bootstrap
         * @return void
         */
-       public function initialize(\TYPO3\Flow\Core\Bootstrap $bootstrap) {
+       public function initialize(\TYPO3\CMS\Core\Core\Bootstrap $bootstrap) {
                $this->bootstrap = $bootstrap;
 
                $this->scanAvailablePackages();
@@ -48,4 +48,4 @@ class UnitTestPackageManager extends \TYPO3\CMS\Core\Package\PackageManager {
                // Deliberately empty!
        }
 
-}
\ No newline at end of file
+}
index ba21643..755d55f 100644 (file)
@@ -45,7 +45,7 @@ class ExtensionManagementUtility {
        static protected $extTablesWasReadFromCacheOnce = FALSE;
 
        /**
-        * @var \TYPO3\CMS\Core\Package\PackageManager
+        * @var PackageManager
         */
        static protected $packageManager;
 
@@ -53,7 +53,7 @@ class ExtensionManagementUtility {
         * Sets the package manager for all that backwards compatibility stuff,
         * so it doesn't have to be fetched through the bootstap.
         *
-        * @param \TYPO3\CMS\Core\Package\PackageManager $packageManager
+        * @param PackageManager $packageManager
         * @internal
         */
        static public function setPackageManager(PackageManager $packageManager) {
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-67027-RemovedFlowCompatibilityFromPackageManager.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-67027-RemovedFlowCompatibilityFromPackageManager.rst
new file mode 100644 (file)
index 0000000..f058330
--- /dev/null
@@ -0,0 +1,27 @@
+=================================================================
+Breaking: #67027 - Removed FLOW-compatibility from PackageManager
+=================================================================
+
+Description
+===========
+
+The Package Manager has been simplified and trimmed down to fit the needs of the TYPO3 extensions and typical Composer packages. All shipped code backported from Flow was removed or refactored to be included in the TYPO3 Core natively. Loading classes are done with the Composer class loader or by the conventions of extension namings. All default Composer packages can still be included as usual, however the custom Flow-logic has been removed.
+
+
+Impact
+======
+
+It is not possible to add custom Package.php loaders into TYPO3 extensions anymore to be called during runtime. It is not possible to configure extensions with custom Classes/ directories and custom composer.json locations anymore.
+There is no special handling for "typo3-flow" packages anymore. The typo3conf/PackageStates.php file now only contains the parts that are necessary for the TYPO3 system.
+
+
+Affected Installations
+======================
+
+All installations using custom functionality of the PackageManager not in use with the TYPO3 Core, or installations trying to use Flow packages natively in the TYPO3 Core.
+
+
+Migration
+=========
+
+Use Composer packages natively for class loading, or use ext_localconf.php to additionally configure a package.
diff --git a/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Core/ClassLoader.php b/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Core/ClassLoader.php
deleted file mode 100644 (file)
index fc6d430..0000000
+++ /dev/null
@@ -1,175 +0,0 @@
-<?php
-namespace TYPO3\Flow\Core;
-
-/*                                                                        *
- * This script belongs to the TYPO3 Flow framework.                       *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License, either version 3   *
- * of the License, or (at your option) any later version.                 *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-
-use TYPO3\Flow\Annotations as Flow;
-
-/**
- * Class Loader implementation which loads .php files found in the classes
- * directory of an object.
- *
- * @Flow\Proxy(false)
- * @Flow\Scope("singleton")
- */
-class ClassLoader {
-
-       /**
-        * @var \TYPO3\Flow\Cache\Frontend\PhpFrontend
-        */
-       protected $classesCache;
-
-       /**
-        * An array of \TYPO3\Flow\Package\Package objects
-        * @var array
-        */
-       protected $packages = array();
-
-       /**
-        * @var string
-        */
-       protected $packagesPath = FLOW_PATH_PACKAGES;
-
-       /**
-        * A list of namespaces this class loader is definitely responsible for
-        * @var array
-        */
-       protected $packageNamespaces = array(
-               'TYPO3\Flow' => 10
-       );
-
-       /**
-        * @var boolean
-        */
-       protected $considerTestsNamespace = FALSE;
-
-       /**
-        * @var array
-        */
-       protected $ignoredClassNames = array(
-               'integer' => TRUE,
-               'string' => TRUE,
-               'param' => TRUE,
-               'return' => TRUE,
-               'var' => TRUE,
-               'throws' => TRUE,
-               'api' => TRUE,
-               'todo' => TRUE,
-               'fixme' => TRUE,
-               'see' => TRUE,
-               'license' => TRUE,
-               'author' => TRUE,
-               'test' => TRUE,
-       );
-
-       /**
-        * Injects the cache for storing the renamed original classes
-        *
-        * @param \TYPO3\Flow\Cache\Frontend\PhpFrontend $classesCache
-        * @return void
-        */
-       public function injectClassesCache(\TYPO3\Flow\Cache\Frontend\PhpFrontend $classesCache) {
-               $this->classesCache = $classesCache;
-       }
-
-       /**
-        * Loads php files containing classes or interfaces found in the classes directory of
-        * a package and specifically registered classes.
-        *
-        * @param string $className Name of the class/interface to load
-        * @return boolean
-        */
-       public function loadClass($className) {
-               if ($className[0] === '\\') {
-                       $className = substr($className, 1);
-               }
-
-               // Loads any known proxied class:
-               if ($this->classesCache !== NULL && $this->classesCache->requireOnce(str_replace('\\', '_', $className)) !== FALSE) {
-                       return TRUE;
-               }
-
-               // Workaround for Doctrine's annotation parser which does a class_exists() for annotations like "@param" and so on:
-               if (isset($this->ignoredClassNames[$className]) || isset($this->ignoredClassNames[substr($className, strrpos($className, '\\') + 1)])) {
-                       return FALSE;
-               }
-
-               // Load classes from the Flow package at a very early stage where
-               // no packages have been registered yet:
-               if ($this->packages === array() && substr($className, 0, 10) === 'TYPO3\Flow') {
-                       require(FLOW_PATH_FLOW . 'Classes/TYPO3/Flow/' . str_replace('\\', '/', substr($className, 11)) . '.php');
-                       return TRUE;
-               }
-
-               // Loads any non-proxied class of registered packages:
-               foreach ($this->packageNamespaces as $packageNamespace => $packageData) {
-                       // replace underscores in classname with \ to match for packagenamespace
-                       if (substr(str_replace('_', '\\', $className), 0, $packageData['namespaceLength']) === $packageNamespace) {
-                               if ($this->considerTestsNamespace === TRUE && substr($className, $packageData['namespaceLength'] + 1, 16) === 'Tests\Functional') {
-                                       $classPathAndFilename = $this->packages[str_replace('\\', '.', $packageNamespace)]->getPackagePath() . str_replace('\\', '/', substr($className, $packageData['namespaceLength'] + 1)) . '.php';
-                               } else {
-                                       // make the classname PSR-0 compliant by replacing underscores only in the classname not in the namespace
-                                       $fileName  = '';
-                                       $lastNamespacePosition = strrpos($className, '\\');
-                                       if ($lastNamespacePosition !== FALSE) {
-                                               $namespace = substr($className, 0, $lastNamespacePosition);
-                                               $className = substr($className, $lastNamespacePosition + 1);
-                                               $fileName  = str_replace('\\', '/', $namespace) . '/';
-                                       }
-                                       $fileName .= str_replace('_', '/', $className) . '.php';
-
-                                       $classPathAndFilename = $packageData['classesPath'] . $fileName;
-                               }
-                               try {
-                                       $result = include($classPathAndFilename);
-                                       if ($result !== FALSE) {
-                                               return TRUE;
-                                       }
-                               } catch (\Exception $e) {
-                               }
-                       }
-               }
-               return FALSE;
-       }
-
-       /**
-        * Sets the available packages
-        *
-        * @param array $packages An array of \TYPO3\Flow\Package\Package objects
-        * @return void
-        */
-       public function setPackages(array $packages) {
-               $this->packages = $packages;
-               foreach ($packages as $package) {
-                       $this->packageNamespaces[$package->getNamespace()] = array('namespaceLength' => strlen($package->getNamespace()), 'classesPath' => $package->getClassesPath());
-               }
-
-               // sort longer package namespaces first, to find specific matches before generic ones
-               uksort($this->packageNamespaces, function($a, $b) {
-                       if (strlen($a) === strlen($b)) {
-                               return strcmp($a, $b);
-                       }
-                       return (strlen($a) > strlen($b)) ? -1 : 1;
-               });
-       }
-
-       /**
-        * Sets the flag which enables or disables autoloading support for functional
-        * test files.
-        *
-        * @param boolean $flag
-        * @return void
-        */
-       public function setConsiderTestsNamespace($flag) {
-               $this->considerTestsNamespace = $flag;
-       }
-
-}
diff --git a/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Exception.php b/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Exception.php
deleted file mode 100644 (file)
index b37ce58..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-<?php
-namespace TYPO3\Flow;
-
-/*                                                                        *
- * This script belongs to the TYPO3 Flow framework.                       *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License, either version 3   *
- * of the License, or (at your option) any later version.                 *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-
-/**
- * A generic Flow Exception
- *
- * @api
- */
-class Exception extends \TYPO3\CMS\Core\Exception {
-
-       /**
-        * @var string
-        */
-       protected $referenceCode;
-
-       /**
-        * @var integer
-        */
-       protected $statusCode = 500;
-
-       /**
-        * Returns a code which can be communicated publicly so that whoever experiences the exception can refer
-        * to it and a developer can find more information about it in the system log.
-        *
-        * @return string
-        * @api
-        */
-       public function getReferenceCode() {
-               if (!isset($this->referenceCode)) {
-                       $this->referenceCode = date('YmdHis', $_SERVER['REQUEST_TIME']) . substr(md5(rand()), 0, 6);
-               }
-               return $this->referenceCode;
-       }
-
-       /**
-        * Returns the HTTP status code this exception corresponds to (defaults to 500).
-        *
-        * @return integer
-        * @api
-        */
-       public function getStatusCode() {
-               return $this->statusCode;
-       }
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Log/LoggerInterface.php b/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Log/LoggerInterface.php
deleted file mode 100644 (file)
index d56c7c2..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-<?php
-namespace TYPO3\Flow\Log;
-
-/*                                                                        *
- * This script belongs to the TYPO3 Flow framework.                       *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License, either version 3   *
- * of the License, or (at your option) any later version.                 *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-
-/**
- * Contract for a basic logger interface
- *
- * The severities are (according to RFC3164) the PHP constants:
- *   LOG_EMERG   # Emergency: system is unusable
- *   LOG_ALERT   # Alert: action must be taken immediately
- *   LOG_CRIT    # Critical: critical conditions
- *   LOG_ERR     # Error: error conditions
- *   LOG_WARNING # Warning: warning conditions
- *   LOG_NOTICE  # Notice: normal but significant condition
- *   LOG_INFO    # Informational: informational messages
- *   LOG_DEBUG   # Debug: debug-level messages
- *
- * @api
- */
-interface LoggerInterface {
-
-       /**
-        * Adds a backend to which the logger sends the logging data
-        *
-        * @param \TYPO3\Flow\Log\Backend\BackendInterface $backend A backend implementation
-        * @return void
-        * @api
-        */
-       public function addBackend(\TYPO3\Flow\Log\Backend\BackendInterface $backend);
-
-       /**
-        * Runs the close() method of a backend and removes the backend
-        * from the logger.
-        *
-        * @param \TYPO3\Flow\Log\Backend\BackendInterface $backend The backend to remove
-        * @return void
-        * @throws \TYPO3\Flow\Log\Exception\NoSuchBackendException if the given backend is unknown to this logger
-        * @api
-        */
-       public function removeBackend(\TYPO3\Flow\Log\Backend\BackendInterface $backend);
-
-       /**
-        * Writes the given message along with the additional information into the log.
-        *
-        * @param string $message The message to log
-        * @param integer $severity An integer value, one of the LOG_* constants
-        * @param mixed $additionalData A variable containing more information about the event to be logged
-        * @param string $packageKey Key of the package triggering the log (determined automatically if not specified)
-        * @param string $className Name of the class triggering the log (determined automatically if not specified)
-        * @param string $methodName Name of the method triggering the log (determined automatically if not specified)
-        * @return void
-        * @api
-        */
-       public function log($message, $severity = LOG_INFO, $additionalData = NULL, $packageKey = NULL, $className = NULL, $methodName = NULL);
-
-       /**
-        * Writes information about the given exception into the log.
-        *
-        * @param \Exception $exception The exception to log
-        * @param array $additionalData Additional data to log
-        * @return void
-        * @api
-        */
-       public function logException(\Exception $exception, array $additionalData = array());
-
-}
diff --git a/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Log/SystemLoggerInterface.php b/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Log/SystemLoggerInterface.php
deleted file mode 100644 (file)
index 562901e..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-<?php
-namespace TYPO3\Flow\Log;
-
-/*                                                                        *
- * This script belongs to the TYPO3 Flow framework.                       *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License, either version 3   *
- * of the License, or (at your option) any later version.                 *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-
-/**
- * Marker interface for the system logger.
- *
- */
-interface SystemLoggerInterface extends \TYPO3\Flow\Log\LoggerInterface {
-}
diff --git a/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Documentation.php b/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Documentation.php
deleted file mode 100644 (file)
index 5971b90..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-<?php
-namespace TYPO3\Flow\Package;
-
-/*                                                                        *
- * This script belongs to the TYPO3 Flow framework.                       *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License, either version 3   *
- * of the License, or (at your option) any later version.                 *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-
-/**
- * Documentation for a package
- *
- * @api
- */
-class Documentation {
-
-       /**
-        * Reference to the package of this documentation
-        * @var \TYPO3\Flow\Package\PackageInterface
-        */
-       protected $package;
-
-       /**
-        * @var string
-        */
-       protected $documentationName;
-
-       /**
-        * Absolute path to the documentation
-        * @var string
-        */
-       protected $documentationPath;
-
-       /**
-        * Constructor
-        *
-        * @param \TYPO3\Flow\Package\PackageInterface $package Reference to the package of this documentation
-        * @param string $documentationName Name of the documentation
-        * @param string $documentationPath Absolute path to the documentation directory
-        */
-       public function __construct($package, $documentationName, $documentationPath) {
-               $this->package = $package;
-               $this->documentationName = $documentationName;
-               $this->documentationPath = $documentationPath;
-       }
-
-       /**
-        * Get the package of this documentation
-        *
-        * @return \TYPO3\Flow\Package\PackageInterface The package of this documentation
-        * @api
-        */
-       public function getPackage() {
-               return $this->package;
-       }
-
-       /**
-        * Get the name of this documentation
-        *
-        * @return string The name of this documentation
-        * @api
-        */
-       public function getDocumentationName() {
-               return $this->documentationName;
-       }
-
-       /**
-        * Get the full path to the directory of this documentation
-        *
-        * @return string Path to the directory of this documentation
-        * @api
-        */
-       public function getDocumentationPath() {
-               return $this->documentationPath;
-       }
-
-       /**
-        * Returns the available documentation formats for this documentation
-        *
-        * @return array Array of \TYPO3\Flow\Package\DocumentationFormat
-        * @api
-        */
-       public function getDocumentationFormats() {
-               $documentationFormats = array();
-
-               $documentationFormatsDirectoryIterator = new \DirectoryIterator($this->documentationPath);
-               $documentationFormatsDirectoryIterator->rewind();
-               while ($documentationFormatsDirectoryIterator->valid()) {
-                       $filename = $documentationFormatsDirectoryIterator->getFilename();
-                       if ($filename[0] != '.' && $documentationFormatsDirectoryIterator->isDir()) {
-                               $documentationFormat = new \TYPO3\Flow\Package\Documentation\Format($filename, $this->documentationPath . $filename . '/');
-                               $documentationFormats[$filename] = $documentationFormat;
-                       }
-                       $documentationFormatsDirectoryIterator->next();
-               }
-
-               return $documentationFormats;
-       }
-}
-?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Documentation/Format.php b/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Documentation/Format.php
deleted file mode 100644 (file)
index f57fd71..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-<?php
-namespace TYPO3\Flow\Package\Documentation;
-
-/*                                                                        *
- * This script belongs to the TYPO3 Flow framework.                       *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License, either version 3   *
- * of the License, or (at your option) any later version.                 *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-
-use TYPO3\Flow\Annotations as Flow;
-
-/**
- * Documentation format of a documentation
- *
- * @Flow\Scope("singleton")
- * @api
- */
-class Format {
-
-       /**
-        * @var string
-        */
-       protected $formatName;
-
-       /**
-        * Absolute path to the documentation format
-        * @var string
-        */
-       protected $formatPath;
-
-       /**
-        * Constructor
-        *
-        * @param string $formatName Name of the documentation format
-        * @param string $formatPath Absolute path to the documentation format
-        */
-       public function __construct($formatName, $formatPath) {
-               $this->formatName = $formatName;
-               $this->formatPath = $formatPath;
-       }
-
-       /**
-        * Get the name of this documentation format
-        *
-        * @return string The name of this documentation format
-        * @api
-        */
-       public function getFormatName() {
-               return $this->formatName;
-       }
-
-       /**
-        * Get the full path to the directory of this documentation format
-        *
-        * @return string Path to the directory of this documentation format
-        * @api
-        */
-       public function getFormatPath() {
-               return $this->formatPath;
-       }
-
-       /**
-        * Returns the available languages for this documentation format
-        *
-        * @return array Array of string language codes
-        * @api
-        */
-       public function getAvailableLanguages() {
-               $languages = array();
-
-               $languagesDirectoryIterator = new \DirectoryIterator($this->formatPath);
-               $languagesDirectoryIterator->rewind();
-               while ($languagesDirectoryIterator->valid()) {
-                       $filename = $languagesDirectoryIterator->getFilename();
-                       if ($filename[0] != '.' && $languagesDirectoryIterator->isDir()) {
-                               $language = $filename;
-                               $languages[] = $language;
-                       }
-                       $languagesDirectoryIterator->next();
-               }
-
-               return $languages;
-       }
-}
-?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Exception.php b/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Exception.php
deleted file mode 100644 (file)
index 59d88cf..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-namespace TYPO3\Flow\Package;
-
-/*                                                                        *
- * This script belongs to the TYPO3 Flow framework.                       *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License, either version 3   *
- * of the License, or (at your option) any later version.                 *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-
-/**
- * A generic Package Exception
- *
- * @api
- */
-class Exception extends \TYPO3\CMS\Core\Exception {
-
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Exception/CorruptPackageException.php b/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Exception/CorruptPackageException.php
deleted file mode 100644 (file)
index 7301a48..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-<?php
-namespace TYPO3\Flow\Package\Exception;
-
-/*                                                                        *
- * This script belongs to the TYPO3 Flow framework.                       *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License, either version 3   *
- * of the License, or (at your option) any later version.                 *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-
-/**
- * "Corrupt Package" Exception
- *
- */
-class CorruptPackageException extends \TYPO3\Flow\Package\Exception {
-
-}
-?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Exception/DuplicatePackageException.php b/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Exception/DuplicatePackageException.php
deleted file mode 100644 (file)
index f5b45a5..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-namespace TYPO3\Flow\Package\Exception;
-
-/*                                                                        *
- * This script belongs to the TYPO3 Flow framework.                       *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License, either version 3   *
- * of the License, or (at your option) any later version.                 *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-
-/**
- * "Duplicate Package" Exception
- *
- * @api
- */
-class DuplicatePackageException extends \TYPO3\Flow\Package\Exception {
-
-}
-?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Exception/InvalidPackageKeyException.php b/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Exception/InvalidPackageKeyException.php
deleted file mode 100644 (file)
index 0924879..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-namespace TYPO3\Flow\Package\Exception;
-
-/*                                                                        *
- * This script belongs to the TYPO3 Flow framework.                       *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License, either version 3   *
- * of the License, or (at your option) any later version.                 *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-
-/**
- * An "Invalid Package Key" exception
- *
- * @api
- */
-class InvalidPackageKeyException extends \TYPO3\Flow\Package\Exception {
-
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Exception/InvalidPackageManifestException.php b/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Exception/InvalidPackageManifestException.php
deleted file mode 100644 (file)
index 128bab9..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-namespace TYPO3\Flow\Package\Exception;
-
-/*                                                                        *
- * This script belongs to the TYPO3 Flow framework.                       *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License, either version 3   *
- * of the License, or (at your option) any later version.                 *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-
-/**
- * An "Invalid Package Key" exception
- *
- * @api
- */
-class InvalidPackageManifestException extends \TYPO3\Flow\Package\Exception {
-
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Exception/InvalidPackagePathException.php b/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Exception/InvalidPackagePathException.php
deleted file mode 100644 (file)
index 685d220..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-namespace TYPO3\Flow\Package\Exception;
-
-/*                                                                        *
- * This script belongs to the TYPO3 Flow framework.                       *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License, either version 3   *
- * of the License, or (at your option) any later version.                 *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-
-/**
- * "Invalid Package Path" Exception
- *
- * @api
- */
-class InvalidPackagePathException extends \TYPO3\Flow\Package\Exception {
-
-}
-?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Exception/InvalidPackageStateException.php b/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Exception/InvalidPackageStateException.php
deleted file mode 100644 (file)
index fb1862c..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-namespace TYPO3\Flow\Package\Exception;
-
-/*                                                                        *
- * This script belongs to the TYPO3 Flow framework.                       *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License, either version 3   *
- * of the License, or (at your option) any later version.                 *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-
-/**
- * An "Invalid Package State" exception
- *
- * @api
- */
-class InvalidPackageStateException extends \TYPO3\Flow\Package\Exception {
-
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Exception/MissingPackageManifestException.php b/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Exception/MissingPackageManifestException.php
deleted file mode 100644 (file)
index 4e4106e..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-namespace TYPO3\Flow\Package\Exception;
-
-/*                                                                        *
- * This script belongs to the TYPO3 Flow framework.                       *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License, either version 3   *
- * of the License, or (at your option) any later version.                 *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-
-/**
- * An "Invalid Package Key" exception
- *
- * @api
- */
-class MissingPackageManifestException extends \TYPO3\Flow\Package\Exception {
-
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Exception/PackageKeyAlreadyExistsException.php b/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Exception/PackageKeyAlreadyExistsException.php
deleted file mode 100644 (file)
index 9e125db..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-namespace TYPO3\Flow\Package\Exception;
-
-/*                                                                        *
- * This script belongs to the TYPO3 Flow framework.                       *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License, either version 3   *
- * of the License, or (at your option) any later version.                 *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-
-/**
- * A "Package Key Already Exists" exception
- *
- * @api
- */
-class PackageKeyAlreadyExistsException extends \TYPO3\Flow\Package\Exception {
-
-}
-?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Exception/PackageRepositoryException.php b/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Exception/PackageRepositoryException.php
deleted file mode 100644 (file)
index fabf9a4..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-<?php
-namespace TYPO3\Flow\Package\Exception;
-
-/*                                                                        *
- * This script belongs to the TYPO3 Flow framework.                       *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License, either version 3   *
- * of the License, or (at your option) any later version.                 *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-
-/**
- * A "Package Repository" exception
- *
- */
-class PackageRepositoryException extends \TYPO3\Flow\Package\Exception {
-
-}
-?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Exception/PackageStatesFileNotWritableException.php b/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Exception/PackageStatesFileNotWritableException.php
deleted file mode 100644 (file)
index f00355e..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-<?php
-namespace TYPO3\Flow\Package\Exception;
-
-/*                                                                        *
- * This script belongs to the TYPO3 Flow framework.                       *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License, either version 3   *
- * of the License, or (at your option) any later version.                 *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-
-/**
- * "Package states file not writable" Exception
- *
- */
-class PackageStatesFileNotWritableException extends \TYPO3\Flow\Package\Exception {
-
-}
-?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Exception/ProtectedPackageKeyException.php b/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Exception/ProtectedPackageKeyException.php
deleted file mode 100644 (file)
index fa9674b..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-namespace TYPO3\Flow\Package\Exception;
-
-/*                                                                        *
- * This script belongs to the TYPO3 Flow framework.                       *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License, either version 3   *
- * of the License, or (at your option) any later version.                 *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-
-/**
- * A "Protected Package Key" exception
- *
- * @api
- */
-class ProtectedPackageKeyException extends \TYPO3\Flow\Package\Exception {
-
-}
-?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Exception/UnknownPackageException.php b/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Exception/UnknownPackageException.php
deleted file mode 100644 (file)
index 68da4a2..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-namespace TYPO3\Flow\Package\Exception;
-
-/*                                                                        *
- * This script belongs to the TYPO3 Flow framework.                       *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License, either version 3   *
- * of the License, or (at your option) any later version.                 *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-
-/**
- * "Unknown Package" Exception
- *
- * @api
- */
-class UnknownPackageException extends \TYPO3\Flow\Package\Exception {
-
-}
-?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/MetaData.php b/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/MetaData.php
deleted file mode 100644 (file)
index f850cec..0000000
+++ /dev/null
@@ -1,212 +0,0 @@
-<?php
-namespace TYPO3\Flow\Package;
-
-/*                                                                        *
- * This script belongs to the TYPO3 Flow framework.                       *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License, either version 3   *
- * of the License, or (at your option) any later version.                 *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-
-/**
- * The default TYPO3 Package MetaData implementation
- *
- */
-class MetaData implements \TYPO3\Flow\Package\MetaDataInterface {
-
-       /**
-        * @var array
-        */
-       protected static $CONSTRAINT_TYPES = array(self::CONSTRAINT_TYPE_DEPENDS, self::CONSTRAINT_TYPE_CONFLICTS, self::CONSTRAINT_TYPE_SUGGESTS);
-
-       /**
-        * @var string
-        */
-       protected $packageKey;
-
-       /**
-        * Package type
-        *
-        * @var string
-        */
-       protected $packageType;
-
-       /**
-        * The version number
-        * @var string
-        */
-       protected $version;
-
-       /**
-        * Package title
-        * @var string
-        */
-       protected $title;
-
-       /**
-        * Package description
-        * @var string
-        */
-       protected $description;
-
-       /**
-        * Package categories as string
-        * @var array
-        */
-       protected $categories = array();
-
-       /**
-        * Package parties (person, company)
-        * @var array
-        */
-       protected $parties = array();
-
-       /**
-        * constraints by constraint type (depends, conflicts, suggests)
-        * @var array
-        */
-       protected $constraints = array();
-
-       /**
-        * Get all available constraint types
-        *
-        * @return array All constraint types
-        */
-       public function getConstraintTypes() {
-               return self::$CONSTRAINT_TYPES;
-       }
-
-       /**
-        * Package metadata constructor
-        *
-        * @param string $packageKey The package key
-        */
-       public function __construct($packageKey) {
-               $this->packageKey = $packageKey;
-       }
-
-       /**
-        * @return string The package key
-        */
-       public function getPackageKey() {
-               return $this->packageKey;
-       }
-
-       /**
-        * Get package type
-        *
-        * @return string
-        */
-       public function getPackageType() {
-               return $this->packageType;
-       }
-
-       /**
-        * Set package type
-        *
-        * @param string $packageType
-        */
-       public function setPackageType($packageType) {
-               $this->packageType = $packageType;
-       }
-
-       /**
-        * @return string The package version
-        */
-       public function getVersion() {
-               return $this->version;
-       }
-
-       /**
-        * @param string $version The package version to set
-        * @return void
-        */
-       public function setVersion($version) {
-               $this->version = $version;
-       }
-
-       /**
-        * @return string The package description
-        */
-       public function getDescription() {
-               return $this->description;
-       }
-
-       /**
-        * @param string $description The package description to set
-        * @return void
-        */
-       public function setDescription($description) {
-               $this->description = $description;
-       }
-
-       /**
-        * @return Array of string The package categories
-        */
-       public function getCategories() {
-               return $this->categories;
-       }
-
-       /**
-        * Adds a package category
-        *
-        * @param string $category
-        * @return void
-        */
-       public function addCategory($category) {
-               $this->categories[] = $category;
-       }
-
-       /**
-        * @return Array of TYPO3\Flow\Package\MetaData\AbstractParty The package parties
-        */
-       public function getParties() {
-               return $this->parties;
-       }
-
-       /**
-        * Add a party
-        *
-        * @param \TYPO3\Flow\Package\MetaData\AbstractParty $party
-        * @return void
-        */
-       public function addParty(\TYPO3\Flow\Package\MetaData\AbstractParty $party) {
-               $this->parties[] = $party;
-       }
-
-       /**
-        * Get all constraints
-        *
-        * @return array Package constraints
-        */
-       public function getConstraints() {
-               return $this->constraints;
-       }
-
-       /**
-        * Get the constraints by type
-        *
-        * @param string $constraintType Type of the constraints to get: CONSTRAINT_TYPE_*
-        * @return array Package constraints
-        */
-       public function getConstraintsByType($constraintType) {
-               if (!isset($this->constraints[$constraintType])) {
-                       return array();
-               }
-               return $this->constraints[$constraintType];
-       }
-
-       /**
-        * Add a constraint
-        *
-        * @param \TYPO3\Flow\Package\MetaData\AbstractConstraint $constraint The constraint to add
-        * @return void
-        */
-       public function addConstraint(\TYPO3\Flow\Package\MetaData\AbstractConstraint $constraint) {
-               $this->constraints[$constraint->getConstraintType()][] = $constraint;
-       }
-}
-?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/MetaData/AbstractConstraint.php b/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/MetaData/AbstractConstraint.php
deleted file mode 100644 (file)
index 68ce3c4..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-<?php
-namespace TYPO3\Flow\Package\MetaData;
-
-/*                                                                        *
- * This script belongs to the TYPO3 Flow framework.                       *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License, either version 3   *
- * of the License, or (at your option) any later version.                 *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-
-/**
- * Constraint meta data model
- *
- */
-abstract class AbstractConstraint {
-
-       /**
-        * One of depends, conflicts or suggests
-        * @var string
-        */
-       protected $constraintType;
-
-       /**
-        * The constraint name or value
-        * @var string
-        */
-       protected $value;
-
-       /**
-        * Meta data constraint constructor
-        *
-        * @param string $constraintType
-        * @param string $value
-        * @param string $minVersion
-        * @param string $maxVersion
-        */
-       public function __construct($constraintType, $value, $minVersion = NULL, $maxVersion = NULL) {
-               $this->constraintType = $constraintType;
-               $this->value = $value;
-               $this->minVersion = $minVersion;
-               $this->maxVersion = $maxVersion;
-       }
-
-       /**
-        * @return string The constraint name or value
-        */
-       public function getValue() {
-               return $this->value;
-       }
-
-       /**
-        * @return string The constraint type (depends, conflicts, suggests)
-        */
-       public function getConstraintType() {
-               return $this->constraintType;
-       }
-
-       /**
-        * @return string The constraint scope (package, system)
-        */
-       abstract public function getConstraintScope();
-}
-?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/MetaData/AbstractParty.php b/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/MetaData/AbstractParty.php
deleted file mode 100644 (file)
index 3aff466..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-<?php
-namespace TYPO3\Flow\Package\MetaData;
-
-/*                                                                        *
- * This script belongs to the TYPO3 Flow framework.                       *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License, either version 3   *
- * of the License, or (at your option) any later version.                 *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-
-/**
- * Party meta model for persons and companies
- *
- */
-abstract class AbstractParty {
-
-       /**
-        * The party role
-        *
-        * @var string
-        */
-       protected $role;
-
-       /**
-        * Name of the party
-        *
-        * @var string
-        */
-       protected $name;
-
-       /**
-        * Email of the party
-        *
-        * @var string
-        */
-       protected $email;
-
-       /**
-        * Website of the party
-        *
-        * @var string
-        */
-       protected $website;
-
-       /**
-        * Meta data party model constructor
-        *
-        * @param string $role
-        * @param string $name
-        * @param string $email
-        * @param string $website
-        */
-       public function __construct($role, $name, $email = NULL, $website = NULL) {
-               $this->role = $role;
-               $this->name = $name;
-               $this->email = $email;
-               $this->website = $website;
-       }
-
-       /**
-        * @return string The role of the party
-        */
-       public function getRole() {
-               return $this->role;
-       }
-
-       /**
-        * @return string The name of the party
-        */
-       public function getName() {
-               return $this->name;
-       }
-
-       /**
-        * @return string The email of the party
-        */
-       public function getEmail() {
-               return $this->email;
-       }
-
-       /**
-        * @return string The website of the party
-        */
-       public function getWebsite() {
-               return $this->website;
-       }
-
-       /**
-        * Get the party type (MetaData\PARTY_TYPE_PERSON, MetaData\PARTY_TYPE_COMPANY)
-        *
-        * @return string The type of the party (person, company)
-        */
-       abstract public function getPartyType();
-}
-?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/MetaData/Company.php b/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/MetaData/Company.php
deleted file mode 100644 (file)
index 85b7433..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-<?php
-namespace TYPO3\Flow\Package\MetaData;
-
-/*                                                                        *
- * This script belongs to the TYPO3 Flow framework.                       *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License, either version 3   *
- * of the License, or (at your option) any later version.                 *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-
-
-/**
- * Package company party meta model
- *
- */
-class Company extends \TYPO3\Flow\Package\MetaData\AbstractParty {
-
-       /**
-        * Get the party type
-        *
-        * @return string Party type "company"
-        */
-       public function getPartyType() {
-               return \TYPO3\Flow\Package\MetaDataInterface::PARTY_TYPE_COMPANY;
-       }
-}
-?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/MetaData/PackageConstraint.php b/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/MetaData/PackageConstraint.php
deleted file mode 100644 (file)
index 7dbc4d7..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-namespace TYPO3\Flow\Package\MetaData;
-
-/*                                                                        *
- * This script belongs to the TYPO3 Flow framework.                       *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License, either version 3   *
- * of the License, or (at your option) any later version.                 *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-
-
-/**
- * Package constraint meta model
- *
- */
-class PackageConstraint extends \TYPO3\Flow\Package\MetaData\AbstractConstraint {
-
-       /**
-        * @return string The constraint scope
-        * @see \TYPO3\Flow\Package\MetaData\Constraint::getConstraintScope()
-        */
-       public function getConstraintScope() {
-               return \TYPO3\Flow\Package\MetaDataInterface::CONSTRAINT_SCOPE_PACKAGE;
-       }
-}
-?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/MetaData/Person.php b/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/MetaData/Person.php
deleted file mode 100644 (file)
index 6603b92..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-<?php
-namespace TYPO3\Flow\Package\MetaData;
-
-/*                                                                        *
- * This script belongs to the TYPO3 Flow framework.                       *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License, either version 3   *
- * of the License, or (at your option) any later version.                 *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-
-
-/**
- * Package person party meta model
- *
- */
-class Person extends \TYPO3\Flow\Package\MetaData\AbstractParty {
-
-       /**
-        * Company of the person
-        *
-        * @var string
-        */
-       protected $company;
-
-       /**
-        * Repository user name of the person
-        *
-        * @var string
-        */
-       protected $repositoryUserName;
-
-       /**
-        * Meta data person model constructor
-        *
-        * @param string $role
-        * @param string $name
-        * @param string $email
-        * @param string $website
-        * @param string $company
-        * @param string $repositoryUserName
-        */
-       public function __construct($role, $name, $email = NULL, $website = NULL, $company = NULL, $repositoryUserName = NULL) {
-               parent::__construct($role, $name, $email, $website);
-
-               $this->company = $company;
-               $this->repositoryUserName = $repositoryUserName;
-       }
-
-       /**
-        * @return string The company of the person
-        */
-       public function getCompany() {
-               return $this->company;
-       }
-
-       /**
-        * @return string The repository username
-        */
-       public function getRepositoryUserName() {
-               return $this->repositoryUserName;
-       }
-
-       /**
-        * @return string Party type "person"
-        */
-       public function getPartyType() {
-               return \TYPO3\Flow\Package\MetaDataInterface::PARTY_TYPE_PERSON;
-       }
-}
-?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/MetaData/SystemConstraint.php b/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/MetaData/SystemConstraint.php
deleted file mode 100644 (file)
index 9496a9f..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-<?php
-namespace TYPO3\Flow\Package\MetaData;
-
-/*                                                                        *
- * This script belongs to the TYPO3 Flow framework.                       *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License, either version 3   *
- * of the License, or (at your option) any later version.                 *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-
-
-/**
- * System constraint meta model
- *
- */
-class SystemConstraint extends \TYPO3\Flow\Package\MetaData\AbstractConstraint {
-
-       /**
-        * The type for a system scope constraint (e.g. "Memory")
-        *
-        * @var string
-        */
-       protected $type;
-
-       /**
-        * Meta data system constraint constructor
-        *
-        * @param string $constraintType
-        * @param string $type
-        * @param string $value
-        * @param string $minVersion
-        * @param string $maxVersion
-        */
-       public function __construct($constraintType, $type, $value = NULL, $minVersion = NULL, $maxVersion = NULL) {
-               if ($value === '') {
-                       $value = NULL;
-               }
-               parent::__construct($constraintType, $value, $minVersion, $maxVersion);
-               $this->type = $type;
-       }
-
-       /**
-        * @return string The system constraint type
-        */
-       public function getType() {
-               return $this->type;
-       }
-
-       /**
-        * @return string The constraint scope
-        * @see \TYPO3\Flow\Package\MetaData\Constraint\getConstraintScope()
-        */
-       public function getConstraintScope() {
-               return \TYPO3\Flow\Package\MetaDataInterface::CONSTRAINT_SCOPE_SYSTEM;
-       }
-}
-?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/MetaDataInterface.php b/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/MetaDataInterface.php
deleted file mode 100644 (file)
index c8f2513..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-namespace TYPO3\Flow\Package;
-
-/*                                                                        *
- * This script belongs to the TYPO3 Flow framework.                       *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License, either version 3   *
- * of the License, or (at your option) any later version.                 *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-
-/**
- * Interface for TYPO3 Package MetaData information
- *
- */
-interface MetaDataInterface {
-
-       const CONSTRAINT_TYPE_DEPENDS = 'depends';
-       const CONSTRAINT_TYPE_CONFLICTS = 'conflicts';
-       const CONSTRAINT_TYPE_SUGGESTS = 'suggests';
-
-       const PARTY_TYPE_PERSON = 'person';
-       const PARTY_TYPE_COMPANY = 'company';
-
-       const CONSTRAINT_SCOPE_PACKAGE = 'package';
-       const CONSTRAINT_SCOPE_SYSTEM = 'system';
-
-       /**
-        * @return string The package key
-        */
-       public function getPackageKey();
-
-       /**
-        * @return string The package version
-        */
-       public function getVersion();
-
-       /**
-        * @return string The package description
-        */
-       public function getDescription();
-
-       /**
-        * @return Array of string The package categories
-        */
-       public function getCategories();
-
-       /**
-        * @return Array of TYPO3\Flow\Package\MetaData\Party The package parties
-        */
-       public function getParties();
-
-       /**
-        * @param string $constraintType Type of the constraints to get: CONSTRAINT_TYPE_*
-        * @return Array of TYPO3\Flow\Package\MetaData\Constraint Package constraints
-        */
-       public function getConstraintsByType($constraintType);
-
-       /**
-        * Get all constraints
-        *
-        * @return array An array of array of \TYPO3\Flow\Package\MetaData\Constraint Package constraints
-        */
-       public function getConstraints();
-}
-?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Package.php b/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/Package.php
deleted file mode 100644 (file)
index 33c49b6..0000000
+++ /dev/null
@@ -1,474 +0,0 @@
-<?php
-namespace TYPO3\Flow\Package;
-
-/*                                                                        *
- * This script belongs to the TYPO3 Flow framework.                       *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License, either version 3   *
- * of the License, or (at your option) any later version.                 *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-
-use TYPO3\Flow\Utility\Files;
-
-/**
- * A Package
- *
- * @api
- */
-class Package implements PackageInterface {
-
-       /**
-        * Unique key of this package. Example for the Flow package: "TYPO3.Flow"
-        * @var string
-        */
-       protected $packageKey;
-
-       /**
-        * @var string
-        */
-       protected $manifestPath;
-
-       /**
-        * Full path to this package's main directory
-        * @var string
-        */
-       protected $packagePath;
-
-       /**
-        * Full path to this package's PSR-0 class loader entry point
-        * @var string
-        */
-       protected $classesPath;
-
-       /**
-        * If this package is protected and therefore cannot be deactivated or deleted
-        * @var boolean
-        * @api
-        */
-       protected $protected = FALSE;
-
-       /**
-        * @var \stdClass
-        */
-       protected $composerManifest;
-
-       /**
-        * Meta information about this package
-        * @var \TYPO3\Flow\Package\MetaData
-        */
-       protected $packageMetaData;
-
-       /**
-        * Names and relative paths (to this package directory) of files containing classes
-        * @var array
-        */
-       protected $classFiles;
-
-       /**
-        * The namespace of the classes contained in this package
-        * @var string
-        */
-       protected $namespace;
-
-       /**
-        * If enabled, the files in the Classes directory are registered and Reflection, Dependency Injection, AOP etc. are supported.
-        * Disable this flag if you don't need object management for your package and want to save some memory.
-        * @var boolean
-        * @api
-        */
-       protected $objectManagementEnabled = TRUE;
-
-       /**
-        * @var \TYPO3\Flow\Package\PackageManager
-        */
-       protected $packageManager;
-
-       /**
-        * Constructor
-        *
-        * @param \TYPO3\Flow\Package\PackageManager $packageManager the package manager which knows this package
-        * @param string $packageKey Key of this package
-        * @param string $packagePath Absolute path to the location of the package's composer manifest
-        * @param string $classesPath Path the classes of the package are in, relative to $packagePath. Optional, read from Composer manifest if not set.
-        * @param string $manifestPath Path the composer manifest of the package, relative to $packagePath. Optional, defaults to ''.
-        * @throws \TYPO3\Flow\Package\Exception\InvalidPackageKeyException if an invalid package key was passed
-        * @throws \TYPO3\Flow\Package\Exception\InvalidPackagePathException if an invalid package path was passed
-        * @throws \TYPO3\Flow\Package\Exception\InvalidPackageManifestException if no composer manifest file could be found
-        */
-       public function __construct(\TYPO3\Flow\Package\PackageManager $packageManager, $packageKey, $packagePath, $classesPath = NULL, $manifestPath = '') {
-               if (preg_match(self::PATTERN_MATCH_PACKAGEKEY, $packageKey) !== 1) {
-                       throw new \TYPO3\Flow\Package\Exception\InvalidPackageKeyException('"' . $packageKey . '" is not a valid package key.', 1217959510);
-               }
-               if (!(is_dir($packagePath) || (Files::is_link($packagePath) && is_dir(Files::getNormalizedPath($packagePath))))) {
-                       throw new \TYPO3\Flow\Package\Exception\InvalidPackagePathException(sprintf('Tried to instantiate a package object for package "%s" with a non-existing package path "%s". Either the package does not exist anymore, or the code creating this object contains an error.', $packageKey, $packagePath), 1166631889);
-               }
-               if (substr($packagePath, -1, 1) !== '/') {
-                       throw new \TYPO3\Flow\Package\Exception\InvalidPackagePathException(sprintf('The package path "%s" provided for package "%s" has no trailing forward slash.', $packagePath, $packageKey), 1166633720);
-               }
-               if ($classesPath[1] === '/') {
-                       throw new \TYPO3\Flow\Package\Exception\InvalidPackagePathException(sprintf('The package classes path provided for package "%s" has a leading forward slash.', $packageKey), 1334841320);
-               }
-               if (!file_exists($packagePath . $manifestPath . 'composer.json')) {
-                       throw new \TYPO3\Flow\Package\Exception\InvalidPackageManifestException(sprintf('No composer manifest file found for package "%s". Please create one at "%scomposer.json".', $packageKey, $manifestPath), 1349776393);
-               }
-
-               $this->packageManager = $packageManager;
-               $this->manifestPath = $manifestPath;
-               $this->packageKey = $packageKey;
-               $this->packagePath = Files::getNormalizedPath($packagePath);
-               if (isset($this->getComposerManifest()->autoload->{'psr-0'})) {
-                       $this->classesPath = Files::getNormalizedPath($this->packagePath . $this->getComposerManifest()->autoload->{'psr-0'}->{$this->getNamespace()});
-               } else {
-                       $this->classesPath = Files::getNormalizedPath($this->packagePath . $classesPath);
-               }
-       }
-
-       /**
-        * Invokes custom PHP code directly after the package manager has been initialized.
-        *
-        * @param \TYPO3\Flow\Core\Bootstrap $bootstrap The current bootstrap
-        * @return void
-        */
-       public function boot(\TYPO3\Flow\Core\Bootstrap $bootstrap) {
-       }
-
-       /**
-        * Returns the package meta data object of this package.
-        *
-        * @return \TYPO3\Flow\Package\MetaData
-        */
-       public function getPackageMetaData() {
-               if ($this->packageMetaData === NULL) {
-                       $this->packageMetaData = new MetaData($this->getPackageKey());
-                       $this->packageMetaData->setDescription($this->getComposerManifest('description'));
-                       $this->packageMetaData->setVersion($this->getComposerManifest('version'));
-                       $requirements = $this->getComposerManifest('require');
-                       if ($requirements !== NULL) {
-                               foreach ($requirements as $requirement => $version) {
-                                       if ($this->packageRequirementIsComposerPackage($requirement) === FALSE) {
-                                                       // Skip non-package requirements
-                                               continue;
-                                       }
-                                       $packageKey = $this->packageManager->getPackageKeyFromComposerName($requirement);
-                                       $constraint = new MetaData\PackageConstraint(MetaDataInterface::CONSTRAINT_TYPE_DEPENDS, $packageKey);
-                                       $this->packageMetaData->addConstraint($constraint);
-                               }
-                       }
-
-               }
-               return $this->packageMetaData;
-       }
-
-       /**
-        * Check whether the given package requirement (like "typo3/flow" or "php") is a composer package or not
-        *
-        * @param string $requirement the composer requirement string
-        * @return boolean TRUE if $requirement is a composer package (contains a slash), FALSE otherwise
-        */
-       protected function packageRequirementIsComposerPackage($requirement) {
-               return (strpos($requirement, '/') !== FALSE);
-       }
-
-       /**
-        * Returns the array of filenames of the class files
-        *
-        * @return array An array of class names (key) and their filename, including the relative path to the package's directory
-        */
-       public function getClassFiles() {
-               if (!is_array($this->classFiles)) {
-                       $this->classFiles = $this->buildArrayOfClassFiles($this->classesPath);
-               }
-               return $this->classFiles;
-       }
-
-       /**
-        * Returns the array of filenames of class files provided by functional tests contained in this package
-        *
-        * @return array An array of class names (key) and their filename, including the relative path to the package's directory
-        */
-       public function getFunctionalTestsClassFiles() {
-               return $this->buildArrayOfClassFiles($this->packagePath . self::DIRECTORY_TESTS_FUNCTIONAL, $this->getNamespace() . '\\Tests\\Functional\\');
-       }
-
-       /**
-        * Returns the package key of this package.
-        *
-        * @return string
-        * @api
-        */
-       public function getPackageKey() {
-               return $this->packageKey;
-       }
-
-       /**
-        * Returns the PHP namespace of classes in this package.
-        *
-        * @return string
-        * @throws \TYPO3\Flow\Package\Exception\InvalidPackageStateException
-        * @api
-        */
-       public function getNamespace() {
-               if (!$this->namespace) {
-                       $manifest = $this->getComposerManifest();
-                       if (isset($manifest->autoload->{'psr-0'})) {
-                               $namespaces = (array)$manifest->autoload->{'psr-0'};
-                               if (count($namespaces) === 1) {
-                                       $namespace = key($namespaces);
-                               } else {
-                                       throw new \TYPO3\Flow\Package\Exception\InvalidPackageStateException(sprintf('The Composer manifest of package "%s" contains multiple namespace definitions in its autoload section but Flow does only support one namespace per package.', $this->packageKey), 1348053245);
-                               }
-                       } else {
-                               $namespace = str_replace('.', '\\', $this->getPackageKey());
-                       }
-                       $this->namespace = $namespace;
-               }
-               return $this->namespace;
-       }
-
-       /**
-        * Tells if this package is protected and therefore cannot be deactivated or deleted
-        *
-        * @return boolean
-        * @api
-        */
-       public function isProtected() {
-               return $this->protected;
-       }
-
-       /**
-        * Tells if files in the Classes directory should be registered and object management enabled for this package.
-        *
-        * @return boolean
-        */
-       public function isObjectManagementEnabled() {
-               return $this->objectManagementEnabled;
-       }
-
-       /**
-        * Sets the protection flag of the package
-        *
-        * @param boolean $protected TRUE if the package should be protected, otherwise FALSE
-        * @return void
-        * @api
-        */
-       public function setProtected($protected) {
-               $this->protected = (boolean)$protected;
-       }
-
-       /**
-        * Returns the full path to this package's main directory
-        *
-        * @return string Path to this package's main directory
-        * @api
-        */
-       public function getPackagePath() {
-               return $this->packagePath;
-       }
-
-       /**
-        * Returns the full path to the packages Composer manifest
-        *
-        * @return string
-        */
-       public function getManifestPath() {
-               return $this->packagePath . $this->manifestPath;
-       }
-
-       /**
-        * Returns the full path to this package's Classes directory
-        *
-        * @return string Path to this package's Classes directory
-        * @api
-        */
-       public function getClassesPath() {
-               return $this->classesPath;
-       }
-
-       /**
-        * Returns the full path to the package's classes namespace entry path,
-        * e.g. "My.Package/ClassesPath/My/Package/"
-        *
-        * @return string Path to this package's Classes directory
-        * @api
-        */
-       public function getClassesNamespaceEntryPath() {
-               $pathifiedNamespace = str_replace('\\', '/', $this->getNamespace());
-               return Files::getNormalizedPath($this->classesPath . trim($pathifiedNamespace, '/'));
-       }
-
-       /**
-        * Returns the full path to this package's functional tests directory
-        *
-        * @return string Path to this package's functional tests directory
-        * @api
-        */
-       public function getFunctionalTestsPath() {
-               return $this->packagePath . self::DIRECTORY_TESTS_FUNCTIONAL;
-       }
-
-       /**
-        * Returns the full path to this package's Resources directory
-        *
-        * @return string Path to this package's Resources directory
-        * @api
-        */
-       public function getResourcesPath() {
-               return $this->packagePath . self::DIRECTORY_RESOURCES;
-       }
-
-       /**
-        * Returns the full path to this package's Configuration directory
-        *
-        * @return string Path to this package's Configuration directory
-        * @api
-        */
-       public function getConfigurationPath() {
-               return $this->packagePath . self::DIRECTORY_CONFIGURATION;
-       }
-
-       /**
-        * Returns the full path to the package's meta data directory
-        *
-        * @return string Full path to the package's meta data directory
-        * @api
-        */
-       public function getMetaPath() {
-               return $this->packagePath . self::DIRECTORY_METADATA;
-       }
-
-       /**
-        * Returns the full path to the package's documentation directory
-        *
-        * @return string Full path to the package's documentation directory
-        * @api
-        */
-       public function getDocumentationPath() {
-               return $this->packagePath . self::DIRECTORY_DOCUMENTATION;
-       }
-
-       /**
-        * Returns the available documentations for this package
-        *
-        * @return array Array of \TYPO3\Flow\Package\Documentation
-        * @api
-        */
-       public function getPackageDocumentations() {
-               $documentations = array();
-               $documentationPath = $this->getDocumentationPath();
-               if (is_dir($documentationPath)) {
-                       $documentationsDirectoryIterator = new \DirectoryIterator($documentationPath);
-                       $documentationsDirectoryIterator->rewind();
-                       while ($documentationsDirectoryIterator->valid()) {
-                               $filename = $documentationsDirectoryIterator->getFilename();
-                               if ($filename[0] != '.' && $documentationsDirectoryIterator->isDir()) {
-                                       $filename = $documentationsDirectoryIterator->getFilename();
-                                       $documentation = new \TYPO3\Flow\Package\Documentation($this, $filename, $documentationPath . $filename . '/');
-                                       $documentations[$filename] = $documentation;
-                               }
-                               $documentationsDirectoryIterator->next();
-                       }
-               }
-               return $documentations;
-       }
-
-       /**
-        * Returns contents of Composer manifest - or part there of.
-        *
-        * @param string $key Optional. Only return the part of the manifest indexed by 'key'
-        * @return mixed|NULL
-        * @see json_decode for return values
-        */
-       public function getComposerManifest($key = NULL) {
-               if (!isset($this->composerManifest)) {
-                       $this->composerManifest = PackageManager::getComposerManifest($this->getManifestPath());
-               }
-
-               return PackageManager::getComposerManifest($this->getManifestPath(), $key, $this->composerManifest);
-       }
-
-       /**
-        * Builds and returns an array of class names => file names of all
-        * *.php files in the package's Classes directory and its sub-
-        * directories.
-        *
-        * @param string $classesPath Base path acting as the parent directory for potential class files
-        * @param string $extraNamespaceSegment A PHP class namespace segment which should be inserted like so: \TYPO3\PackageKey\{namespacePrefix\}PathSegment\PathSegment\Filename
-        * @param string $subDirectory Used internally
-        * @param integer $recursionLevel Used internally
-        * @return array
-        * @throws \TYPO3\Flow\Package\Exception if recursion into directories was too deep or another error occurred
-        */
-       protected function buildArrayOfClassFiles($classesPath, $extraNamespaceSegment = '', $subDirectory = '', $recursionLevel = 0) {
-               $classFiles = array();
-               $currentPath = $classesPath . $subDirectory;
-               $currentRelativePath = substr($currentPath, strlen($this->packagePath));
-
-               if (!is_dir($currentPath)) {
-                       return array();
-               }
-               if ($recursionLevel > 100) {
-                       throw new \TYPO3\Flow\Package\Exception('Recursion too deep.', 1166635495);
-               }
-
-               try {
-                       $classesDirectoryIterator = new \DirectoryIterator($currentPath);
-                       while ($classesDirectoryIterator->valid()) {
-                               $filename = $classesDirectoryIterator->getFilename();
-                               if ($filename[0] != '.') {
-                                       if (is_dir($currentPath . $filename)) {
-                                               $classFiles = array_merge($classFiles, $this->buildArrayOfClassFiles($classesPath, $extraNamespaceSegment, $subDirectory . $filename . '/', ($recursionLevel + 1)));
-                                       } else {
-                                               if (substr($filename, -4, 4) === '.php') {
-                                                       $className = (str_replace('/', '\\', ($extraNamespaceSegment . substr($currentPath, strlen($classesPath)) . substr($filename, 0, -4))));
-                                                       $classFiles[$className] = $currentRelativePath . $filename;
-                                               }
-                                       }
-                               }
-                               $classesDirectoryIterator->next();
-                       }
-
-               } catch (\Exception $exception) {
-                       throw new \TYPO3\Flow\Package\Exception($exception->getMessage(), 1166633721);
-               }
-               return $classFiles;
-       }
-
-       /**
-        * Added by TYPO3 CMS
-        *
-        * The package caching serializes package objects.
-        * The package manager instance may not be serialized
-        * as a fresh instance is created upon every request.
-        *
-        * This method will be removed once the package is
-        * released of the package manager dependency.
-        *
-        * @return array
-        */
-       public function __sleep() {
-               $properties = get_class_vars(get_class($this));
-               unset($properties['packageManager']);
-               return array_keys($properties);
-       }
-
-       /**
-        * Added by TYPO3 CMS
-        *
-        * The package caching deserializes package objects.
-        * A fresh package manager instance has to be set
-        * during bootstrapping.
-        *
-        * This method will be removed once the package is
-        * released of the package manager dependency.
-        */
-       public function __wakeup() {
-               if (isset($GLOBALS['TYPO3_currentPackageManager'])) {
-                       $this->packageManager = $GLOBALS['TYPO3_currentPackageManager'];
-               }
-       }
-}
-
-?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/PackageFactory.php b/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/PackageFactory.php
deleted file mode 100644 (file)
index 81b1c76..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-<?php
-namespace TYPO3\Flow\Package;
-
-/*                                                                        *
- * This script belongs to the TYPO3 Flow framework.                       *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License, either version 3   *
- * of the License, or (at your option) any later version.                 *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-
-use TYPO3\Flow\Utility\Files;
-
-/**
- * Class for building Packages
- */
-class PackageFactory {
-
-       /**
-        * @var PackageManagerInterface
-        */
-       protected $packageManager;
-
-       /**
-        * Constructor
-        *
-        * @param \TYPO3\Flow\Package\PackageManagerInterface $packageManager
-        */
-       public function __construct(PackageManagerInterface $packageManager) {
-               $this->packageManager = $packageManager;
-       }
-
-       /**
-        * Returns a package instance.
-        *
-        * @param string $packagesBasePath the base install path of packages,
-        * @param string $packagePath path to package, relative to base path
-        * @param string $packageKey key / name of the package
-        * @param string $classesPath path to the classes directory, relative to the package path
-        * @param string $manifestPath path to the package's Composer manifest, relative to package path, defaults to same path
-        * @return \TYPO3\Flow\Package\PackageInterface
-        * @throws Exception\CorruptPackageException
-        */
-       public function create($packagesBasePath, $packagePath, $packageKey, $classesPath, $manifestPath = '') {
-               $packageClassPathAndFilename = Files::concatenatePaths(array($packagesBasePath, $packagePath, 'Classes/' . str_replace('.', '/', $packageKey) . '/Package.php'));
-               if (file_exists($packageClassPathAndFilename)) {
-                       require_once($packageClassPathAndFilename);
-                       /**
-                        * @todo there should be a general method for getting Namespace from $packageKey
-                        * @todo it should be tested if the package class implements the interface
-                        */
-                       $packageClassName = str_replace('.', '\\', $packageKey) . '\Package';
-                       if (!class_exists($packageClassName)) {
-                               throw new \TYPO3\Flow\Package\Exception\CorruptPackageException(sprintf('The package "%s" does not contain a valid package class. Check if the file "%s" really contains a class called "%s".', $packageKey, $packageClassPathAndFilename, $packageClassName), 1327587091);
-                       }
-               } else {
-                       $packageClassName = \TYPO3\Flow\Package\Package::class;
-               }
-               $packagePath = Files::concatenatePaths(array($packagesBasePath, $packagePath)) . '/';
-
-               $package = new $packageClassName($this->packageManager, $packageKey, $packagePath, $classesPath, $manifestPath);
-
-               return $package;
-       }
-
-       /**
-        * Resolves package key from Composer manifest
-        *
-        * If it is a Flow package the name of the containing directory will be used.
-        *
-        * Else if the composer name of the package matches the first part of the lowercased namespace of the package, the mixed
-        * case version of the composer name / namespace will be used, with backslashes replaced by dots.
-        *
-        * Else the composer name will be used with the slash replaced by a dot
-        *
-        * @param object $manifest
-        * @param string $packagesBasePath
-        * @return string
-        */
-       public static function getPackageKeyFromManifest($manifest, $packagePath, $packagesBasePath) {
-               if (!is_object($manifest)) {
-                       throw new  \TYPO3\Flow\Package\Exception\InvalidPackageManifestException('Invalid composer manifest.', 1348146450);
-               }
-               if (isset($manifest->type) && substr($manifest->type, 0, 11) === 'typo3-flow-') {
-                       $relativePackagePath = substr($packagePath, strlen($packagesBasePath));
-                       $packageKey = substr($relativePackagePath, strpos($relativePackagePath, '/') + 1, -1);
-                       /**
-                        * @todo check that manifest name and directory follows convention
-                        */
-               } else {
-                       $packageKey = str_replace('/', '.', $manifest->name);
-                       if (isset($manifest->autoload) && isset($manifest->autoload->{"psr-0"})) {
-                               $namespaces = array_keys(get_object_vars($manifest->autoload->{"psr-0"}));
-                               foreach ($namespaces as $namespace) {
-                                       $namespaceLead = substr($namespace, 0, strlen($manifest->name));
-                                       $dottedNamespaceLead = str_replace('\\', '.', $namespaceLead);
-                                       if (strtolower($dottedNamespaceLead) === $packageKey) {
-                                               $packageKey = $dottedNamespaceLead;
-                                       }
-                               }
-                       }
-               }
-               $packageKey = preg_replace('/[^A-Za-z0-9.]/', '', $packageKey);
-               return $packageKey;
-       }
-}
-?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/PackageInterface.php b/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/PackageInterface.php
deleted file mode 100644 (file)
index ad41b07..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-<?php
-namespace TYPO3\Flow\Package;
-
-/*                                                                        *
- * This script belongs to the TYPO3 Flow framework.                       *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License, either version 3   *
- * of the License, or (at your option) any later version.                 *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-
-/**
- * Interface for a Flow Package class
- *
- * @api
- */
-interface PackageInterface {
-
-       const PATTERN_MATCH_PACKAGEKEY = '/^[a-z0-9]+\.(?:[a-z0-9][\.a-z0-9]*)+$/i';
-
-       const DIRECTORY_CLASSES = 'Classes/';
-       const DIRECTORY_CONFIGURATION = 'Configuration/';
-       const DIRECTORY_DOCUMENTATION = 'Documentation/';
-       const DIRECTORY_METADATA = 'Meta/';
-       const DIRECTORY_TESTS_FUNCTIONAL = 'Tests/Functional/';
-       const DIRECTORY_TESTS_UNIT = 'Tests/Unit/';
-       const DIRECTORY_RESOURCES = 'Resources/';
-
-       /**
-        * Invokes custom PHP code directly after the package manager has been initialized.
-        *
-        * @param \TYPO3\Flow\Core\Bootstrap $bootstrap The current bootstrap
-        * @return void
-        */
-       public function boot(\TYPO3\Flow\Core\Bootstrap $bootstrap);
-
-       /**
-        * Returns the package meta object of this package.
-        *
-        * @return \TYPO3\Flow\Package\MetaData
-        */
-       public function getPackageMetaData();
-
-       /**
-        * Returns the array of filenames of the class files
-        *
-        * @return array An array of class names (key) and their filename, including the relative path to the package's directory
-        * @api
-        */
-       public function getClassFiles();
-
-       /**
-        * Returns the package key of this package.
-        *
-        * @return string
-        * @api
-        */
-       public function getPackageKey();
-
-       /**
-        * Returns the PHP namespace of classes in this package.
-        *
-        * @return string
-        * @api
-        */
-       public function getNamespace();
-
-       /**
-        * Tells if this package is protected and therefore cannot be deactivated or deleted
-        *
-        * @return boolean
-        * @api
-        */
-       public function isProtected();
-
-       /**
-        * Tells if files in the Classes directory should be registered and object management enabled for this package.
-        *
-        * @return boolean
-        */
-       public function isObjectManagementEnabled();
-
-       /**
-        * Sets the protection flag of the package
-        *
-        * @param boolean $protected TRUE if the package should be protected, otherwise FALSE
-        * @return void
-        * @api
-        */
-       public function setProtected($protected);
-
-       /**
-        * Returns the full path to this package's main directory
-        *
-        * @return string Path to this package's main directory
-        * @api
-        */
-       public function getPackagePath();
-
-       /**
-        * Returns the full path to this package's Classes directory
-        *
-        * @return string Path to this package's Classes directory
-        * @api
-        */
-       public function getClassesPath();
-
-       /**
-        * Returns the full path to the package's classes namespace entry path,
-        * e.g. "My.Package/ClassesPath/My/Package/"
-        *
-        * @return string Path to this package's Classes directory
-        * @api
-        */
-       public function getClassesNamespaceEntryPath();
-
-       /**
-        * Returns the full path to this package's Resources directory
-        *
-        * @return string Path to this package's Resources directory
-        * @api
-        */
-       public function getResourcesPath();
-
-       /**
-        * Returns the full path to this package's Configuration directory
-        *
-        * @return string Path to this package's Configuration directory
-        * @api
-        */
-       public function getConfigurationPath();
-
-       /**
-        * Returns the full path to this package's Package.xml file
-        *
-        * @return string Path to this package's Package.xml file
-        * @api
-        */
-       public function getMetaPath();
-
-       /**
-        * Returns the full path to the package's documentation directory
-        *
-        * @return string Full path to the package's documentation directory
-        * @api
-        */
-       public function getDocumentationPath();
-
-       /**
-        * Returns the available documentations for this package
-        *
-        * @return array Array of \TYPO3\Flow\Package\Documentation
-        * @api
-        */
-       public function getPackageDocumentations();
-
-}
-?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/PackageManager.php b/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/PackageManager.php
deleted file mode 100644 (file)
index 8a686b2..0000000
+++ /dev/null
@@ -1,1028 +0,0 @@
-<?php
-namespace TYPO3\Flow\Package;
-
-/*                                                                        *
- * This script belongs to the TYPO3 Flow framework.                       *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License, either version 3   *
- * of the License, or (at your option) any later version.                 *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-
-use TYPO3\Flow\Package\Package;
-use TYPO3\Flow\Package\PackageFactory;
-use TYPO3\Flow\Package\PackageInterface;
-use TYPO3\Flow\Utility\Files;
-use TYPO3\Flow\Annotations as Flow;
-
-/**
- * The default TYPO3 Package Manager
- *
- * @api
- * @Flow\Scope("singleton")
- */
-class PackageManager implements \TYPO3\Flow\Package\PackageManagerInterface {
-
-       /**
-        * @var \TYPO3\Flow\Core\ClassLoader
-        */
-       protected $classLoader;
-
-       /**
-        * @var \TYPO3\Flow\Core\Bootstrap
-        */
-       protected $bootstrap;
-
-       /**
-        * @var PackageFactory
-        */
-       protected $packageFactory;
-
-       /**
-        * Array of available packages, indexed by package key
-        * @var array
-        */
-       protected $packages = array();
-
-       /**
-        * A translation table between lower cased and upper camel cased package keys
-        * @var array
-        */
-       protected $packageKeys = array();
-
-       /**
-        * A map between ComposerName and PackageKey, only available when scanAvailablePackages is run
-        * @var array
-        */
-       protected $composerNameToPackageKeyMap = array();
-
-       /**
-        * List of active packages as package key => package object
-        * @var array
-        */
-       protected $activePackages = array();
-
-       /**
-        * Absolute path leading to the various package directories
-        * @var string
-        */
-       protected $packagesBasePath = FLOW_PATH_PACKAGES;
-
-       /**
-        * @var string
-        */
-       protected $packageStatesPathAndFilename;
-
-       /**
-        * Package states configuration as stored in the PackageStates.php file
-        * @var array
-        */
-       protected $packageStatesConfiguration = array();
-
-       /**
-        * @var array
-        */
-       protected $settings;
-
-       /**
-        * @var \TYPO3\Flow\Log\SystemLoggerInterface
-        */
-       protected $systemLogger;
-
-       /**
-        * @param \TYPO3\Flow\Core\ClassLoader $classLoader
-        * @return void
-        */
-       public function injectClassLoader(\TYPO3\Flow\Core\ClassLoader $classLoader) {
-               $this->classLoader = $classLoader;
-       }
-
-       /**
-        * @param array $settings
-        * @return void
-        */
-       public function injectSettings(array $settings) {
-               $this->settings = $settings;
-       }
-
-       /**
-        * @param \TYPO3\Flow\Log\SystemLoggerInterface $systemLogger
-        * @return void
-        */
-       public function injectSystemLogger(\TYPO3\Flow\Log\SystemLoggerInterface $systemLogger) {
-               if ($this->systemLogger instanceof \TYPO3\Flow\Log\EarlyLogger) {
-                       $this->systemLogger->replayLogsOn($systemLogger);
-                       unset($this->systemLogger);
-               }
-               $this->systemLogger = $systemLogger;
-       }
-
-       /**
-        * Initializes the package manager
-        *
-        * @param \TYPO3\Flow\Core\Bootstrap $bootstrap The current bootstrap
-        * @return void
-        */
-       public function initialize(\TYPO3\Flow\Core\Bootstrap $bootstrap) {
-               $this->systemLogger = new \TYPO3\Flow\Log\EarlyLogger();
-
-               $this->bootstrap = $bootstrap;
-               $this->packageStatesPathAndFilename = $this->packageStatesPathAndFilename ?: FLOW_PATH_CONFIGURATION . 'PackageStates.php';
-               $this->packageFactory = new PackageFactory($this);
-
-               $this->loadPackageStates();
-
-               foreach ($this->packages as $packageKey => $package) {
-                       if ($package->isProtected() || (isset($this->packageStatesConfiguration['packages'][$packageKey]['state']) && $this->packageStatesConfiguration['packages'][$packageKey]['state'] === 'active')) {
-                               $this->activePackages[$packageKey] = $package;
-                       }
-               }
-
-               $this->classLoader->setPackages($this->activePackages);
-
-               foreach ($this->activePackages as $package) {
-                       $package->boot($bootstrap);
-               }
-
-       }
-
-       /**
-        * Returns TRUE if a package is available (the package's files exist in the packages directory)
-        * or FALSE if it's not. If a package is available it doesn't mean necessarily that it's active!
-        *
-        * @param string $packageKey The key of the package to check
-        * @return boolean TRUE if the package is available, otherwise FALSE
-        * @api
-        */
-       public function isPackageAvailable($packageKey) {
-               return (isset($this->packages[$packageKey]));
-       }
-
-       /**
-        * Returns TRUE if a package is activated or FALSE if it's not.
-        *
-        * @param string $packageKey The key of the package to check
-        * @return boolean TRUE if package is active, otherwise FALSE
-        * @api
-        */
-       public function isPackageActive($packageKey) {
-               return (isset($this->activePackages[$packageKey]));
-       }
-
-       /**
-        * Returns the base path for packages
-        *
-        * @return string
-        */
-       public function getPackagesBasePath() {
-               return $this->packagesBasePath;
-       }
-
-       /**
-        * Returns a PackageInterface object for the specified package.
-        * A package is available, if the package directory contains valid MetaData information.
-        *
-        * @param string $packageKey
-        * @return \TYPO3\Flow\Package\PackageInterface The requested package object
-        * @throws \TYPO3\Flow\Package\Exception\UnknownPackageException if the specified package is not known
-        * @api
-        */
-       public function getPackage($packageKey) {
-               if (!$this->isPackageAvailable($packageKey)) {
-                       throw new \TYPO3\Flow\Package\Exception\UnknownPackageException('Package "' . $packageKey . '" is not available. Please check if the package exists and that the package key is correct (package keys are case sensitive).', 1166546734);
-               }
-               return $this->packages[$packageKey];
-       }
-
-       /**
-        * Finds a package by a given object of that package; if no such package
-        * could be found, NULL is returned. This basically works with comparing the package class' location
-        * against the given class' location. In order to not being satisfied with a shorter package's root path,
-        * the packages to check are sorted by the length of their root path descending.
-        *
-        * Please note that the class itself must be existing anyways, else PHP's generic "class not found"
-        * exception will be thrown.
-        *
-        * @param object $object The object to find the possessing package of
-        * @return \TYPO3\Flow\Package\PackageInterface The package the given object belongs to or NULL if it could not be found
-        */
-       public function getPackageOfObject($object) {
-               $sortedAvailablePackages = $this->getAvailablePackages();
-               usort($sortedAvailablePackages, function (PackageInterface $packageOne, PackageInterface $packageTwo) {
-                       return strlen($packageTwo->getPackagePath()) - strlen($packageOne->getPackagePath());
-               });
-
-               $className = $this->bootstrap->getObjectManager()->get(\TYPO3\Flow\Reflection\ReflectionService::class)->getClassNameByObject($object);
-               $reflectedClass = new \ReflectionClass($className);
-               $fileName = Files::getUnixStylePath($reflectedClass->getFileName());
-
-               foreach ($sortedAvailablePackages as $package) {
-                       $packagePath = Files::getUnixStylePath($package->getPackagePath());
-                       if (strpos($fileName, $packagePath) === 0) {
-                               return $package;
-                       }
-               }
-               return NULL;
-       }
-
-       /**
-        * Returns an array of \TYPO3\Flow\Package objects of all available packages.
-        * A package is available, if the package directory contains valid meta information.
-        *
-        * @return array Array of \TYPO3\Flow\Package\PackageInterface
-        * @api
-        */
-       public function getAvailablePackages() {
-               return $this->packages;
-       }
-
-       /**
-        * Returns an array of \TYPO3\Flow\Package objects of all active packages.
-        * A package is active, if it is available and has been activated in the package
-        * manager settings.
-        *
-        * @return array Array of \TYPO3\Flow\Package\PackageInterface
-        * @api
-        */
-       public function getActivePackages() {
-               return $this->activePackages;
-       }
-
-       /**
-        * Returns an array of \TYPO3\Flow\Package objects of all frozen packages.
-        * A frozen package is not considered by file monitoring and provides some
-        * precompiled reflection data in order to improve performance.
-        *
-        * @return array Array of \TYPO3\Flow\Package\PackageInterface
-        */
-       public function getFrozenPackages() {
-               $frozenPackages = array();
-               if ($this->bootstrap->getContext()->isDevelopment()) {
-                       foreach ($this->packages as $packageKey => $package) {
-                               if (isset($this->packageStatesConfiguration['packages'][$packageKey]['frozen']) &&
-                                               $this->packageStatesConfiguration['packages'][$packageKey]['frozen'] === TRUE) {
-                                       $frozenPackages[$packageKey] = $package;
-                               }
-                       }
-               }
-               return $frozenPackages;
-       }
-
-       /**
-        * Returns an array of \TYPO3\Flow\PackageInterface objects of all packages that match
-        * the given package state, path, and type filters. All three filters must match, if given.
-        *
-        * @param string $packageState defaults to available
-        * @param string $packagePath
-        * @param string $packageType
-        *
-        * @return array Array of \TYPO3\Flow\Package\PackageInterface
-        * @throws Exception\InvalidPackageStateException
-        * @api
-        */
-       public function getFilteredPackages($packageState = 'available', $packagePath = NULL, $packageType = NULL) {
-               $packages = array();
-               switch (strtolower($packageState)) {
-                       case 'available':
-                               $packages = $this->getAvailablePackages();
-                       break;
-                       case 'active':
-                               $packages = $this->getActivePackages();
-                       break;
-                       case 'frozen':
-                               $packages = $this->getFrozenPackages();
-                       break;
-                       default:
-                               throw new \TYPO3\Flow\Package\Exception\InvalidPackageStateException('The package state "' . $packageState . '" is invalid', 1372458274);
-               }
-
-               if($packagePath !== NULL) {
-                       $packages = $this->filterPackagesByPath($packages, $packagePath);
-               }
-               if($packageType !== NULL) {
-                       $packages = $this->filterPackagesByType($packages, $packageType);
-               }
-
-               return $packages;
-       }
-
-       /**
-        * Returns an array of \TYPO3\Flow\Package objects in the given array of packages
-        * that are in the specified Package Path
-        *
-        * @param array $packages Array of \TYPO3\Flow\Package\PackageInterface to be filtered
-        * @param string $filterPath Filter out anything that's not in this path
-        * @return array Array of \TYPO3\Flow\Package\PackageInterface
-        */
-       protected function filterPackagesByPath(&$packages, $filterPath) {
-               $filteredPackages = array();
-               /** @var $package Package */
-               foreach ($packages as $package) {
-                       $packagePath = substr($package->getPackagePath(), strlen(FLOW_PATH_PACKAGES));
-                       $packageGroup = substr($packagePath, 0, strpos($packagePath, '/'));
-                       if ($packageGroup === $filterPath) {
-                               $filteredPackages[$package->getPackageKey()] = $package;
-                       }
-               }
-               return $filteredPackages;
-       }
-
-       /**
-        * Returns an array of \TYPO3\Flow\Package objects in the given array of packages
-        * that are of the specified package type.
-        *
-        * @param array $packages Array of \TYPO3\Flow\Package\PackageInterface to be filtered
-        * @param string $packageType Filter out anything that's not of this packageType
-        * @return array Array of \TYPO3\Flow\Package\PackageInterface
-        */
-       protected function filterPackagesByType(&$packages, $packageType) {
-               $filteredPackages = array();
-               /** @var $package Package */
-               foreach ($packages as $package) {
-                       if ($package->getComposerManifest('type') === $packageType) {
-                               $filteredPackages[$package->getPackageKey()] = $package;
-                       }
-               }
-               return $filteredPackages;
-       }
-
-       /**
-        * Returns the upper camel cased version of the given package key or FALSE
-        * if no such package is available.
-        *
-        * @param string $unknownCasedPackageKey The package key to convert
-        * @return mixed The upper camel cased package key or FALSE if no such package exists
-        * @api
-        */
-       public function getCaseSensitivePackageKey($unknownCasedPackageKey) {
-               $lowerCasedPackageKey = strtolower($unknownCasedPackageKey);
-               return (isset($this->packageKeys[$lowerCasedPackageKey])) ? $this->packageKeys[$lowerCasedPackageKey] : FALSE;
-       }
-
-       /**
-        * Resolves a Flow package key from a composer package name.
-        *
-        * @param string $composerName
-        * @return string
-        * @throws Exception\InvalidPackageStateException
-        */
-       public function getPackageKeyFromComposerName($composerName) {
-               if (count($this->composerNameToPackageKeyMap) === 0) {
-                       foreach ($this->packageStatesConfiguration['packages'] as $packageKey => $packageStateConfiguration) {
-                               $this->composerNameToPackageKeyMap[strtolower($packageStateConfiguration['composerName'])] = $packageKey;
-                       }
-               }
-               $lowercasedComposerName = strtolower($composerName);
-               if (!isset($this->composerNameToPackageKeyMap[$lowercasedComposerName])) {
-                       throw new \TYPO3\Flow\Package\Exception\InvalidPackageStateException('Could not find package with composer name "' . $composerName . '" in PackageStates configuration.', 1352320649);
-               }
-               return $this->composerNameToPackageKeyMap[$lowercasedComposerName];
-       }
-
-       /**
-        * Check the conformance of the given package key
-        *
-        * @param string $packageKey The package key to validate
-        * @return boolean If the package key is valid, returns TRUE otherwise FALSE
-        * @api
-        */
-       public function isPackageKeyValid($packageKey) {
-               return preg_match(PackageInterface::PATTERN_MATCH_PACKAGEKEY, $packageKey) === 1;
-       }
-
-       /**
-        * Create a package, given the package key
-        *
-        * @param string $packageKey The package key of the new package
-        * @param \TYPO3\Flow\Package\MetaData $packageMetaData If specified, this package meta object is used for writing the Package.xml file, otherwise a rudimentary Package.xml file is created
-        * @param string $packagesPath If specified, the package will be created in this path, otherwise the default "Application" directory is used
-        * @param string $packageType If specified, the package type will be set, otherwise it will default to "typo3-flow-package"
-        * @return \TYPO3\Flow\Package\PackageInterface The newly created package
-        * @throws \TYPO3\Flow\Package\Exception
-        * @throws \TYPO3\Flow\Package\Exception\PackageKeyAlreadyExistsException
-        * @throws \TYPO3\Flow\Package\Exception\InvalidPackageKeyException
-        * @api
-        */
-       public function createPackage($packageKey, \TYPO3\Flow\Package\MetaData $packageMetaData = NULL, $packagesPath = NULL, $packageType = 'typo3-flow-package') {
-               if (!$this->isPackageKeyValid($packageKey)) {
-                       throw new \TYPO3\Flow\Package\Exception\InvalidPackageKeyException('The package key "' . $packageKey . '" is invalid', 1220722210);
-               }
-               if ($this->isPackageAvailable($packageKey)) {
-                       throw new \TYPO3\Flow\Package\Exception\PackageKeyAlreadyExistsException('The package key "' . $packageKey . '" already exists', 1220722873);
-               }
-
-               if ($packagesPath === NULL) {
-                       if (is_array($this->settings['package']['packagesPathByType']) && isset($this->settings['package']['packagesPathByType'][$packageType])) {
-                               $packagesPath = $this->settings['package']['packagesPathByType'][$packageType];
-                       } else {
-                               $packagesPath = 'Application';
-                       }
-                       $packagesPath = Files::getUnixStylePath(Files::concatenatePaths(array($this->packagesBasePath, $packagesPath)));
-               }
-
-               if ($packageMetaData === NULL) {
-                       $packageMetaData = new MetaData($packageKey);
-               }
-               if ($packageMetaData->getPackageType() === NULL) {
-                       $packageMetaData->setPackageType($packageType);
-               }
-
-               $packagePath = Files::concatenatePaths(array($packagesPath, $packageKey)) . '/';
-               Files::createDirectoryRecursively($packagePath);
-
-               foreach (
-                       array(
-                               PackageInterface::DIRECTORY_METADATA,
-                               PackageInterface::DIRECTORY_CLASSES,
-                               PackageInterface::DIRECTORY_CONFIGURATION,
-                               PackageInterface::DIRECTORY_DOCUMENTATION,
-                               PackageInterface::DIRECTORY_RESOURCES,
-                               PackageInterface::DIRECTORY_TESTS_UNIT,
-                               PackageInterface::DIRECTORY_TESTS_FUNCTIONAL,
-                       ) as $path) {
-                       Files::createDirectoryRecursively(Files::concatenatePaths(array($packagePath, $path)));
-               }
-
-               $this->writeComposerManifest($packagePath, $packageKey, $packageMetaData);
-
-               $packagePath = str_replace($this->packagesBasePath, '', $packagePath);
-               $package = $this->packageFactory->create($this->packagesBasePath, $packagePath, $packageKey, PackageInterface::DIRECTORY_CLASSES);
-
-               $this->packages[$packageKey] = $package;
-               foreach ($this->packages as $upperCamelCasedPackageKey => $_) {
-                       $this->packageKeys[strtolower($upperCamelCasedPackageKey)] = $upperCamelCasedPackageKey;
-               }
-
-               $this->activatePackage($packageKey);
-
-               return $package;
-       }
-
-       /**
-        * Write a composer manifest for the package.
-        *
-        * @param string $manifestPath
-        * @param string $packageKey
-        * @param MetaData $packageMetaData
-        * @return void
-        */
-       protected function writeComposerManifest($manifestPath, $packageKey, \TYPO3\Flow\Package\MetaData $packageMetaData = NULL) {
-               $manifest = array();
-
-               $nameParts = explode('.', $packageKey);
-               $vendor = array_shift($nameParts);
-               $manifest['name'] = strtolower($vendor . '/' . implode('-', $nameParts));
-               if ($packageMetaData !== NULL) {
-                       $manifest['type'] = $packageMetaData->getPackageType();
-                       $manifest['description'] = $packageMetaData->getDescription();
-                       $manifest['version'] = $packageMetaData->getVersion();
-               } else {
-                       $manifest['type'] = 'typo3-flow-package';
-                       $manifest['description'] = '';
-               }
-               $manifest['require'] = array('typo3/flow' => '*');
-               $manifest['autoload'] = array('psr-0' => array(str_replace('.', '\\', $packageKey) => 'Classes'));
-
-               if (defined('JSON_PRETTY_PRINT')) {
-                       file_put_contents(Files::concatenatePaths(array($manifestPath, 'composer.json')), json_encode($manifest, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));
-               } else {
-                       file_put_contents(Files::concatenatePaths(array($manifestPath, 'composer.json')), json_encode($manifest));
-               }
-       }
-
-       /**
-        * Deactivates a package
-        *
-        * @param string $packageKey The package to deactivate
-        * @return void
-        * @throws \TYPO3\Flow\Package\Exception\ProtectedPackageKeyException if a package is protected and cannot be deactivated
-        * @api
-        */
-       public function deactivatePackage($packageKey) {
-               if (!$this->isPackageActive($packageKey)) {
-                       return;
-               }
-
-               $package = $this->getPackage($packageKey);
-               if ($package->isProtected()) {
-                       throw new \TYPO3\Flow\Package\Exception\ProtectedPackageKeyException('The package "' . $packageKey . '" is protected and cannot be deactivated.', 1308662891);
-               }
-
-               unset($this->activePackages[$packageKey]);
-               $this->packageStatesConfiguration['packages'][$packageKey]['state'] = 'inactive';
-               $this->sortAndSavePackageStates();
-       }
-
-       /**
-        * Activates a package
-        *
-        * @param string $packageKey The package to activate
-        * @return void
-        * @api
-        */
-       public function activatePackage($packageKey) {
-               if ($this->isPackageActive($packageKey)) {
-                       return;
-               }
-
-               $package = $this->getPackage($packageKey);
-               $this->activePackages[$packageKey] = $package;
-               $this->packageStatesConfiguration['packages'][$packageKey]['state'] = 'active';
-               if (!isset($this->packageStatesConfiguration['packages'][$packageKey]['packagePath'])) {
-                       $this->packageStatesConfiguration['packages'][$packageKey]['packagePath'] = str_replace($this->packagesBasePath, '', $package->getPackagePath());
-               }
-               if (!isset($this->packageStatesConfiguration['packages'][$packageKey]['classesPath'])) {
-                       $this->packageStatesConfiguration['packages'][$packageKey]['classesPath'] = Package::DIRECTORY_CLASSES;
-               }
-               $this->sortAndSavePackageStates();
-       }
-
-       /**
-        * Freezes a package
-        *
-        * @param string $packageKey The package to freeze
-        * @return void
-        * @throws \LogicException
-        * @throws \TYPO3\Flow\Package\Exception\UnknownPackageException
-        */
-       public function freezePackage($packageKey) {
-               if (!$this->bootstrap->getContext()->isDevelopment()) {
-                       throw new \LogicException('Package freezing is only supported in Development context.', 1338810870);
-               }
-
-               if (!$this->isPackageActive($packageKey)) {
-                       throw new \TYPO3\Flow\Package\Exception\UnknownPackageException('Package "' . $packageKey . '" is not available or active.', 1331715956);
-               }
-               if ($this->isPackageFrozen($packageKey)) {
-                       return;
-               }
-
-               $this->bootstrap->getObjectManager()->get(\TYPO3\Flow\Reflection\ReflectionService::class)->freezePackageReflection($packageKey);
-
-               $this->packageStatesConfiguration['packages'][$packageKey]['frozen'] = TRUE;
-               $this->sortAndSavePackageStates();
-       }
-
-       /**
-        * Tells if a package is frozen
-        *
-        * @param string $packageKey The package to check
-        * @return boolean
-        */
-       public function isPackageFrozen($packageKey) {
-               return (
-                       $this->bootstrap->getContext()->isDevelopment()
-                       && isset($this->packageStatesConfiguration['packages'][$packageKey]['frozen'])
-                       && $this->packageStatesConfiguration['packages'][$packageKey]['frozen'] === TRUE
-               );
-       }
-
-       /**
-        * Unfreezes a package
-        *
-        * @param string $packageKey The package to unfreeze
-        * @return void
-        */
-       public function unfreezePackage($packageKey) {
-               if (!$this->isPackageFrozen($packageKey)) {
-                       return;
-               }
-
-               $this->bootstrap->getObjectManager()->get(\TYPO3\Flow\Reflection\ReflectionService::class)->unfreezePackageReflection($packageKey);
-
-               unset($this->packageStatesConfiguration['packages'][$packageKey]['frozen']);
-               $this->sortAndSavePackageStates();
-       }
-
-       /**
-        * Refreezes a package
-        *
-        * @param string $packageKey The package to refreeze
-        * @return void
-        */
-       public function refreezePackage($packageKey) {
-               if (!$this->isPackageFrozen($packageKey)) {
-                       return;
-               }
-
-               $this->bootstrap->getObjectManager()->get(\TYPO3\Flow\Reflection\ReflectionService::class)->unfreezePackageReflection($packageKey);
-       }
-
-       /**
-        * Register a native Flow package
-        *
-        * @param string $packageKey The Package to be registered
-        * @param boolean $sortAndSave allows for not saving packagestates when used in loops etc.
-        * @return PackageInterface
-        * @throws Exception\CorruptPackageException
-        */
-       public function registerPackage(PackageInterface $package, $sortAndSave = TRUE) {
-               $packageKey = $package->getPackageKey();
-               if ($this->isPackageAvailable($packageKey)) {
-                       throw new Exception\InvalidPackageStateException('Package "' . $packageKey . '" is already registered.', 1338996122);
-               }
-
-               $this->packages[$packageKey] = $package;
-               $this->packageStatesConfiguration['packages'][$packageKey]['packagePath'] = str_replace($this->packagesBasePath, '', $package->getPackagePath());
-               $this->packageStatesConfiguration['packages'][$packageKey]['classesPath'] = str_replace($package->getPackagePath(), '', $package->getClassesPath());
-
-               if ($sortAndSave === TRUE) {
-                       $this->sortAndSavePackageStates();
-               }
-
-               return $package;
-       }
-
-       /**
-        * Unregisters a package from the list of available packages
-        *
-        * @param PackageInterface $package The package to be unregistered
-        * @return void
-        * @throws Exception\InvalidPackageStateException
-        */
-       public function unregisterPackage(PackageInterface $package) {
-               $packageKey = $package->getPackageKey();
-               if (!$this->isPackageAvailable($packageKey)) {
-                       throw new Exception\InvalidPackageStateException('Package "' . $packageKey . '" is not registered.', 1338996142);
-               }
-               $this->unregisterPackageByPackageKey($packageKey);
-       }
-
-       /**
-        * Unregisters a package from the list of available packages
-        *
-        * @param string $packageKey Package Key of the package to be unregistered
-        * @return void
-        */
-       protected function unregisterPackageByPackageKey($packageKey) {
-               unset($this->packages[$packageKey]);
-               unset($this->packageKeys[strtolower($packageKey)]);
-               unset($this->packageStatesConfiguration['packages'][$packageKey]);
-               $this->sortAndSavePackageStates();
-       }
-
-       /**
-        * Removes a package from registry and deletes it from filesystem
-        *
-        * @param string $packageKey package to remove
-        * @return void
-        * @throws \TYPO3\Flow\Package\Exception\UnknownPackageException if the specified package is not known
-        * @throws \TYPO3\Flow\Package\Exception\ProtectedPackageKeyException if a package is protected and cannot be deleted
-        * @throws \TYPO3\Flow\Package\Exception
-        * @api
-        */
-       public function deletePackage($packageKey) {
-               if (!$this->isPackageAvailable($packageKey)) {
-                       throw new \TYPO3\Flow\Package\Exception\UnknownPackageException('Package "' . $packageKey . '" is not available and cannot be removed.', 1166543253);
-               }
-
-               $package = $this->getPackage($packageKey);
-               if ($package->isProtected()) {
-                       throw new \TYPO3\Flow\Package\Exception\ProtectedPackageKeyException('The package "' . $packageKey . '" is protected and cannot be removed.', 1220722120);
-               }
-
-               if ($this->isPackageActive($packageKey)) {
-                       $this->deactivatePackage($packageKey);
-               }
-
-               $packagePath = $package->getPackagePath();
-               try {
-                       Files::removeDirectoryRecursively($packagePath);
-               } catch (\TYPO3\Flow\Utility\Exception $exception) {
-                       throw new \TYPO3\Flow\Package\Exception('Please check file permissions. The directory "' . $packagePath . '" for package "' . $packageKey . '" could not be removed.', 1301491089, $exception);
-               }
-
-               $this->unregisterPackage($package);
-       }
-
-       /**
-        * Loads the states of available packages from the PackageStates.php file.
-        * The result is stored in $this->packageStatesConfiguration.
-        *
-        * @return void
-        */
-       protected function loadPackageStates() {
-               $this->packageStatesConfiguration = file_exists($this->packageStatesPathAndFilename) ? include($this->packageStatesPathAndFilename) : array();
-               if (!isset($this->packageStatesConfiguration['version']) || $this->packageStatesConfiguration['version'] < 4) {
-                       $this->packageStatesConfiguration = array();
-               }
-               if ($this->packageStatesConfiguration === array() || !$this->bootstrap->getContext()->isProduction()) {
-                       $this->scanAvailablePackages();
-               } else {
-                       $this->registerPackagesFromConfiguration();
-               }
-       }
-
-       /**
-        * Scans all directories in the packages directories for available packages.
-        * For each package a Package object is created and stored in $this->packages.
-        *
-        * @return void
-        * @throws \TYPO3\Flow\Package\Exception\DuplicatePackageException
-        */
-       protected function scanAvailablePackages() {
-               $previousPackageStatesConfiguration = $this->packageStatesConfiguration;
-
-               if (isset($this->packageStatesConfiguration['packages'])) {
-                       foreach ($this->packageStatesConfiguration['packages'] as $packageKey => $configuration) {
-                               if (!file_exists($this->packagesBasePath . $configuration['packagePath'])) {
-                                       unset($this->packageStatesConfiguration['packages'][$packageKey]);
-                               }
-                       }
-               } else {
-                       $this->packageStatesConfiguration['packages'] = array();
-               }
-
-               $packagePaths = array();
-               foreach (new \DirectoryIterator($this->packagesBasePath) as $parentFileInfo) {
-                       $parentFilename = $parentFileInfo->getFilename();
-                       if ($parentFilename[0] !== '.' && $parentFileInfo->isDir()) {
-                               $packagePaths = array_merge($packagePaths, $this->scanPackagesInPath($parentFileInfo->getPathName()));
-                       }
-               }
-
-               /**
-                * @todo similar functionality in registerPackage - should be refactored
-                */
-               foreach ($packagePaths as $packagePath => $composerManifestPath) {
-                       try {
-                               $composerManifest = self::getComposerManifest($composerManifestPath);
-                               $packageKey = PackageFactory::getPackageKeyFromManifest($composerManifest, $packagePath, $this->packagesBasePath);
-                               $this->composerNameToPackageKeyMap[strtolower($composerManifest->name)] = $packageKey;
-                               $this->packageStatesConfiguration['packages'][$packageKey]['manifestPath'] = substr($composerManifestPath, strlen($packagePath)) ?: '';
-                               $this->packageStatesConfiguration['packages'][$packageKey]['composerName'] = $composerManifest->name;
-                       } catch (\TYPO3\Flow\Package\Exception\MissingPackageManifestException $exception) {
-                               $relativePackagePath = substr($packagePath, strlen($this->packagesBasePath));
-                               $packageKey = substr($relativePackagePath, strpos($relativePackagePath, '/') + 1, -1);
-                       }
-                       if (!isset($this->packageStatesConfiguration['packages'][$packageKey]['state'])) {
-                               /**
-                                * @todo doesn't work, settings not available at this time
-                                */
-                               if (is_array($this->settings['package']['inactiveByDefault']) && in_array($packageKey, $this->settings['package']['inactiveByDefault'], TRUE)) {
-                                       $this->packageStatesConfiguration['packages'][$packageKey]['state'] = 'inactive';
-                               } else {
-                                       $this->packageStatesConfiguration['packages'][$packageKey]['state'] = 'active';
-                               }
-                       }
-
-                       $this->packageStatesConfiguration['packages'][$packageKey]['packagePath'] = str_replace($this->packagesBasePath, '', $packagePath);
-
-                               // Change this to read the target from Composer or any other source
-                       $this->packageStatesConfiguration['packages'][$packageKey]['classesPath'] = Package::DIRECTORY_CLASSES;
-               }
-
-               $this->registerPackagesFromConfiguration();
-               if ($this->packageStatesConfiguration != $previousPackageStatesConfiguration) {
-                       $this->sortAndsavePackageStates();
-               }
-       }
-
-       /**
-        * Looks for composer.json in the given path and returns a path or NULL.
-        *
-        * @param string $packagePath
-        * @return array
-        */
-       protected function findComposerManifestPaths($packagePath) {
-               $manifestPaths = array();
-               if (file_exists($packagePath . '/composer.json')) {
-                       $manifestPaths[] = $packagePath . '/';
-               } else {
-                       $jsonPathsAndFilenames = Files::readDirectoryRecursively($packagePath, '.json');
-                       asort($jsonPathsAndFilenames);
-                       foreach ($jsonPathsAndFilenames as $jsonPathAndFilename) {
-                               if (basename($jsonPathAndFilename) === 'composer.json') {
-                                       $manifestPath = dirname($jsonPathAndFilename) . '/';
-                                       $manifestPaths[] = $manifestPath;
-                                       $isNotSubPathOfManifestPath = function ($otherPath) use ($manifestPath) {
-                                               return strpos($otherPath, $manifestPath) !== 0;
-                                       };
-                                       $jsonPathsAndFilenames = array_filter($jsonPathsAndFilenames, $isNotSubPathOfManifestPath);
-                               }
-                       }
-               }
-
-               return $manifestPaths;
-       }
-
-       /**
-        * Scans all sub directories of the specified directory and collects the package keys of packages it finds.
-        *
-        * The return of the array is to make this method usable in array_merge.
-        *
-        * @param string $startPath
-        * @param array $collectedPackagePaths
-        * @return array
-        */
-       protected function scanPackagesInPath($startPath, array &$collectedPackagePaths = array()) {
-               foreach (new \DirectoryIterator($startPath) as $fileInfo) {
-                       if (!$fileInfo->isDir()) {
-                               continue;
-                       }
-                       $filename = $fileInfo->getFilename();
-                       if ($filename[0] !== '.') {
-                               $currentPath = Files::getUnixStylePath($fileInfo->getPathName());
-                               $composerManifestPaths = $this->findComposerManifestPaths($currentPath);
-                               foreach ($composerManifestPaths as $composerManifestPath) {
-                                       $targetDirectory = rtrim(self::getComposerManifest($composerManifestPath, 'target-dir'), '/');
-                                       $packagePath = $targetDirectory ? substr(rtrim($composerManifestPath, '/'), 0, -strlen((string)$targetDirectory)) : $composerManifestPath;
-                                       $collectedPackagePaths[$packagePath] = $composerManifestPath;
-                               }
-                       }
-               }
-               return $collectedPackagePaths;
-       }
-
-       /**
-        * Returns contents of Composer manifest - or part there of.
-        *
-        * @param string $manifestPath
-        * @param string $key Optional. Only return the part of the manifest indexed by 'key'
-        * @param object $composerManifest Optional. Manifest to use instead of reading it from file
-        * @return mixed
-        * @throws \TYPO3\Flow\Package\Exception\MissingPackageManifestException
-        * @see json_decode for return values
-        */
-       static public function getComposerManifest($manifestPath, $key = NULL, $composerManifest = NULL) {
-               if ($composerManifest === NULL) {
-                       if (!file_exists($manifestPath . 'composer.json')) {
-                               throw new \TYPO3\Flow\Package\Exception\MissingPackageManifestException('No composer manifest file found at "' . $manifestPath . '/composer.json".', 1349868540);
-                       }
-                       $json = file_get_contents($manifestPath . 'composer.json');
-                       $composerManifest = json_decode($json);
-               }
-
-               if ($key !== NULL) {
-                       if (isset($composerManifest->{$key})) {
-                               $value = $composerManifest->{$key};
-                       } else {
-                               $value = NULL;
-                       }
-               } else {
-                       $value = $composerManifest;
-               }
-               return $value;
-       }
-
-       /**
-        * Requires and registers all packages which were defined in packageStatesConfiguration
-        *
-        * @return void
-        * @throws \TYPO3\Flow\Package\Exception\CorruptPackageException
-        */
-       protected function registerPackagesFromConfiguration() {
-               foreach ($this->packageStatesConfiguration['packages'] as $packageKey => $stateConfiguration) {
-
-                       $packagePath = isset($stateConfiguration['packagePath']) ? $stateConfiguration['packagePath'] : NULL;
-                       $classesPath = isset($stateConfiguration['classesPath']) ? $stateConfiguration['classesPath'] : NULL;
-                       $manifestPath = isset($stateConfiguration['manifestPath']) ? $stateConfiguration['manifestPath'] : NULL;
-
-                       try {
-                               $package = $this->packageFactory->create($this->packagesBasePath, $packagePath, $packageKey, $classesPath, $manifestPath);
-                       } catch (\TYPO3\Flow\Package\Exception\InvalidPackagePathException $exception) {
-                               $this->unregisterPackageByPackageKey($packageKey);
-                               $this->systemLogger->log('Package ' . $packageKey . ' could not be loaded, it has been unregistered. Error description: "' . $exception->getMessage() . '" (' . $exception->getCode() . ')', LOG_WARNING);
-                               continue;
-                       }
-
-                       $this->registerPackage($package, FALSE);
-
-                       if (!$this->packages[$packageKey] instanceof PackageInterface) {
-                               throw new \TYPO3\Flow\Package\Exception\CorruptPackageException(sprintf('The package class in package "%s" does not implement PackageInterface.', $packageKey), 1300782487);
-                       }
-
-                       $this->packageKeys[strtolower($packageKey)] = $packageKey;
-                       if ($stateConfiguration['state'] === 'active') {
-                               $this->activePackages[$packageKey] = $this->packages[$packageKey];
-                       }
-               }
-       }
-
-       /**
-        * Saves the current content of $this->packageStatesConfiguration to the
-        * PackageStates.php file.
-        *
-        * @return void
-        */
-       protected function sortAndSavePackageStates() {
-               $this->sortAvailablePackagesByDependencies();
-
-               $this->packageStatesConfiguration['version'] = 4;
-
-               $fileDescription = "# PackageStates.php\n\n";
-               $fileDescription .= "# This file is maintained by Flow's package management. Although you can edit it\n";
-               $fileDescription .= "# manually, you should rather use the command line commands for maintaining packages.\n";
-               $fileDescription .= "# You'll find detailed information about the typo3.flow:package:* commands in their\n";
-               $fileDescription .= "# respective help screens.\n\n";
-               $fileDescription .= "# This file will be regenerated automatically if it doesn't exist. Deleting this file\n";
-               $fileDescription .= "# should, however, never become necessary if you use the package commands.\n";
-
-                       // we do not need the dependencies on disk...
-               foreach ($this->packageStatesConfiguration['packages'] as &$packageConfiguration) {
-                       if (isset($packageConfiguration['dependencies'])) {
-                               unset($packageConfiguration['dependencies']);
-                       }
-               }
-               if (!@is_writable($this->packageStatesPathAndFilename)) {
-                       // If file does not exists try to create it
-                       $fileHandle = @fopen($this->packageStatesPathAndFilename, 'x');
-                       if (!$fileHandle) {
-                               throw new \TYPO3\Flow\Package\Exception\PackageStatesFileNotWritableException(
-                                       sprintf('We could not update the list of installed packages because the file %s is not writable. Please, check the file system permissions for this file and make sure that the web server can update it.', $this->packageStatesPathAndFilename),
-                                       1382449759
-                               );
-                       }
-                       fclose($fileHandle);
-               }
-               $packageStatesCode = "<?php\n$fileDescription\nreturn " . var_export($this->packageStatesConfiguration, TRUE) . "\n ?>";
-               @file_put_contents($this->packageStatesPathAndFilename, $packageStatesCode);
-       }
-
-       /**
-        * Resolves the dependent packages from the meta data of all packages recursively. The
-        * resolved direct or indirect dependencies of each package will put into the package
-        * states configuration array.
-        *
-        * @return void
-        */
-       protected function resolvePackageDependencies() {
-               foreach ($this->packages as $packageKey => $package) {
-                       $this->packageStatesConfiguration['packages'][$packageKey]['dependencies'] = $this->getDependencyArrayForPackage($packageKey);
-               }
-       }
-
-       /**
-        * Returns an array of dependent package keys for the given package. It will
-        * do this recursively, so dependencies of dependant packages will also be
-        * in the result.
-        *
-        * @param string $packageKey The package key to fetch the dependencies for
-        * @param array $dependentPackageKeys
-        * @param array $trace An array of already visited package keys, to detect circular dependencies
-        * @return array|NULL An array of direct or indirect dependant packages
-        * @throws \TYPO3\Flow\Mvc\Exception\InvalidPackageKeyException
-        */
-       protected function getDependencyArrayForPackage($packageKey, array &$dependentPackageKeys = array(), array $trace = array()) {
-               if (!isset($this->packages[$packageKey])) {
-                       return NULL;
-               }
-               if (in_array($packageKey, $trace) !== FALSE) {
-                       return $dependentPackageKeys;
-               }
-               $trace[] = $packageKey;
-               $dependentPackageConstraints = $this->packages[$packageKey]->getPackageMetaData()->getConstraintsByType(MetaDataInterface::CONSTRAINT_TYPE_DEPENDS);
-               foreach ($dependentPackageConstraints as $constraint) {
-                       if ($constraint instanceof \TYPO3\Flow\Package\MetaData\PackageConstraint) {
-                               $dependentPackageKey = $constraint->getValue();
-                               if (in_array($dependentPackageKey, $dependentPackageKeys) === FALSE && in_array($dependentPackageKey, $trace) === FALSE) {
-                                       $dependentPackageKeys[] = $dependentPackageKey;
-                               }
-                               $this->getDependencyArrayForPackage($dependentPackageKey, $dependentPackageKeys, $trace);
-                       }
-               }
-               return array_reverse($dependentPackageKeys);
-       }
-
-       /**
-        * Orders all packages by comparing their dependencies. By this, the packages
-        * and package configurations arrays holds all packages in the correct
-        * initialization order.
-        *
-        * @return void
-        */
-       protected function sortAvailablePackagesByDependencies() {
-               $this->resolvePackageDependencies();
-
-               $packageStatesConfiguration = $this->packageStatesConfiguration['packages'];
-
-               $comparator = function ($firstPackageKey, $secondPackageKey) use ($packageStatesConfiguration) {
-                       if (isset($packageStatesConfiguration[$firstPackageKey]['dependencies'])
-                                       && (in_array($secondPackageKey, $packageStatesConfiguration[$firstPackageKey]['dependencies'])
-                                               && !in_array($firstPackageKey, $packageStatesConfiguration[$secondPackageKey]['dependencies']))) {
-                               return 1;
-                       } elseif (isset($packageStatesConfiguration[$secondPackageKey]['dependencies'])
-                               && (in_array($firstPackageKey, $packageStatesConfiguration[$secondPackageKey]['dependencies'])
-                                       && !in_array($secondPackageKey, $packageStatesConfiguration[$firstPackageKey]['dependencies']))) {
-                               return -1;
-                       }
-                       return strcmp($firstPackageKey, $secondPackageKey);
-               };
-
-               uasort($this->packages,
-                       function (\TYPO3\Flow\Package\PackageInterface $firstPackage, \TYPO3\Flow\Package\PackageInterface $secondPackage) use ($comparator) {
-                               return $comparator($firstPackage->getPackageKey(), $secondPackage->getPackageKey());
-                       }
-               );
-
-               uksort($this->packageStatesConfiguration['packages'],
-                       function ($firstPackageKey, $secondPackageKey) use ($comparator) {
-                               return $comparator($firstPackageKey, $secondPackageKey);
-                       }
-               );
-       }
-}
-
-?>
diff --git a/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/PackageManagerInterface.php b/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Package/PackageManagerInterface.php
deleted file mode 100644 (file)
index 1d7074b..0000000
+++ /dev/null
@@ -1,207 +0,0 @@
-<?php
-namespace TYPO3\Flow\Package;
-
-/*                                                                        *
- * This script belongs to the TYPO3 Flow framework.                       *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License, either version 3   *
- * of the License, or (at your option) any later version.                 *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-
-/**
- * Interface for the TYPO3 Package Manager
- *
- * @api
- */
-interface PackageManagerInterface {
-
-       /**
-        * Initializes the package manager
-        *
-        * @param \TYPO3\Flow\Core\Bootstrap $bootstrap The current bootstrap
-        * @return void
-        */
-       public function initialize(\TYPO3\Flow\Core\Bootstrap $bootstrap);
-
-       /**
-        * Returns TRUE if a package is available (the package's files exist in the packages directory)
-        * or FALSE if it's not. If a package is available it doesn't mean necessarily that it's active!
-        *
-        * @param string $packageKey The key of the package to check
-        * @return boolean TRUE if the package is available, otherwise FALSE
-        * @api
-        */
-       public function isPackageAvailable($packageKey);
-
-       /**
-        * Returns TRUE if a package is activated or FALSE if it's not.
-        *
-        * @param string $packageKey The key of the package to check
-        * @return boolean TRUE if package is active, otherwise FALSE
-        * @api
-        */
-       public function isPackageActive($packageKey);
-
-       /**
-        * Returns a \TYPO3\Flow\Package\PackageInterface object for the specified package.
-        * A package is available, if the package directory contains valid meta information.
-        *
-        * @param string $packageKey
-        * @return \TYPO3\Flow\Package\PackageInterface
-        * @api
-        */
-       public function getPackage($packageKey);
-
-       /**
-        * Finds a package by a given object of that package; if no such package
-        * could be found, NULL is returned.
-        *
-        * @param object $object The object to find the possessing package of
-        * @return \TYPO3\Flow\Package\PackageInterface The package the given object belongs to or NULL if it could not be found
-        */
-       public function getPackageOfObject($object);
-
-       /**
-        * Returns an array of \TYPO3\Flow\Package\PackageInterface objects of all available packages.
-        * A package is available, if the package directory contains valid meta information.
-        *
-        * @return array Array of \TYPO3\Flow\Package\PackageInterface
-        * @api
-        */
-       public function getAvailablePackages();
-
-       /**
-        * Returns an array of \TYPO3\Flow\PackageInterface objects of all active packages.
-        * A package is active, if it is available and has been activated in the package
-        * manager settings.
-        *
-        * @return array Array of \TYPO3\Flow\Package\PackageInterface
-        * @api
-        */
-       public function getActivePackages();
-
-       /**
-        * Returns an array of \TYPO3\Flow\PackageInterface objects of all packages that match
-        * the given package state, path, and type filters. All three filters must match, if given.
-        *
-        * @param string $packageState defaults to available
-        * @param string $packagePath
-        * @param string $packageType
-        *
-        * @return array Array of \TYPO3\Flow\Package\PackageInterface
-        * @api
-        */
-       public function getFilteredPackages($packageState = 'available', $packagePath = NULL, $packageType = NULL);
-
-       /**
-        * Returns the upper camel cased version of the given package key or FALSE
-        * if no such package is available.
-        *
-        * @param string $unknownCasedPackageKey The package key to convert
-        * @return mixed The upper camel cased package key or FALSE if no such package exists
-        * @api
-        */
-       public function getCaseSensitivePackageKey($unknownCasedPackageKey);
-
-       /**
-        * Check the conformance of the given package key
-        *
-        * @param string $packageKey The package key to validate
-        * @api
-        */
-       public function isPackageKeyValid($packageKey);
-
-       /**
-        * Create a new package, given the package key
-        *
-        * @param string $packageKey The package key to use for the new package
-        * @param \TYPO3\Flow\Package\MetaData $packageMetaData Package metadata
-        * @param string $packagesPath If specified, the package will be created in this path
-        * @param string $packageType If specified, the package type will be set
-        * @return \TYPO3\Flow\Package\Package The newly created package
-        * @api
-        */
-       public function createPackage($packageKey, \TYPO3\Flow\Package\MetaData $packageMetaData = NULL, $packagesPath = NULL, $packageType = NULL);
-
-       /**
-        * Deactivates a package if it is in the list of active packages
-        *
-        * @param string $packageKey The package to deactivate
-        * @return void
-        * @api
-        */
-       public function deactivatePackage($packageKey);
-
-       /**
-        * Activates a package
-        *
-        * @param string $packageKey The package to activate
-        * @return void
-        * @api
-        */
-       public function activatePackage($packageKey);
-
-       /**
-        * Freezes a package
-        *
-        * @param string $packageKey The package to freeze
-        * @return void
-        */
-       public function freezePackage($packageKey);
-
-       /**
-        * Tells if a package is frozen
-        *
-        * @param string $packageKey The package to check
-        * @return boolean
-        */
-       public function isPackageFrozen($packageKey);
-
-       /**
-        * Unfreezes a package
-        *
-        * @param string $packageKey The package to unfreeze
-        * @return void
-        */
-       public function unfreezePackage($packageKey);
-
-       /**
-        * Refreezes a package
-        *
-        * @param string $packageKey The package to refreeze
-        * @return void
-        */
-       public function refreezePackage($packageKey);
-
-       /**
-        * Register a native Flow package
-        *
-        * @param PackageInterface $packageKey The Package to be registered
-        * @param boolean $sortAndSave allows for not saving packagestates when used in loops etc.
-        * @return PackageInterface
-        * @throws Exception\CorruptPackageException
-        */
-       public function registerPackage(PackageInterface $package, $sortAndSave = TRUE);
-
-       /**
-        * Unregisters a package from the list of available packages
-        *
-        * @param PackageInterface $package The package to be unregistered
-        * @throws Exception\InvalidPackageStateException
-        */
-       public function unregisterPackage(PackageInterface $package);
-
-       /**
-        * Removes a package from registry and deletes it from filesystem
-        *
-        * @param string $packageKey package to delete
-        * @return void
-        * @api
-        */
-       public function deletePackage($packageKey);
-
-}
-?>
\ No newline at end of file
diff --git a/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Utility/Exception.php b/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Utility/Exception.php
deleted file mode 100644 (file)
index 9dc8210..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-<?php
-namespace TYPO3\Flow\Utility;
-
-/*                                                                        *
- * This script belongs to the TYPO3 Flow framework.                       *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License, either version 3   *
- * of the License, or (at your option) any later version.                 *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-
-/**
- * A generic Utility Exception
- *
- * @api
- */
-class Exception extends \TYPO3\Flow\Exception {
-
-}
diff --git a/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Utility/Files.php b/typo3/sysext/core/Resources/PHP/TYPO3.Flow/Classes/TYPO3/Flow/Utility/Files.php
deleted file mode 100644 (file)
index 123172d..0000000
+++ /dev/null
@@ -1,311 +0,0 @@
-<?php
-namespace TYPO3\Flow\Utility;
-
-/*                                                                        *
- * This script belongs to the TYPO3 Flow framework.                       *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU Lesser General Public License, either version 3   *
- * of the License, or (at your option) any later version.                 *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-
-/**
- * File and directory functions
- *
- */
-class Files {
-
-       /**
-        * Replacing backslashes and double slashes to slashes.
-        * It's needed to compare paths (especially on windows).
-        *
-        * @param string $path Path which should transformed to the Unix Style.
-        * @return string
-        */
-       static public function getUnixStylePath($path) {
-               if (strpos($path, ':') === FALSE) {
-                       return str_replace('//', '/', strtr($path, '\\', '/'));
-               } else {
-                       return preg_replace('/^([a-z]{2,}):\//', '$1://', str_replace('//', '/', strtr($path, '\\', '/')));
-               }
-       }
-
-       /**
-        * Makes sure path has a trailing slash
-        *
-        * @param string $path
-        * @return string
-        */
-       static public function getNormalizedPath($path) {
-               return rtrim($path, '/') . '/';
-       }
-
-       /**
-        * Properly glues together filepaths / filenames by replacing
-        * backslashes and double slashes of the specified paths.
-        * Note: trailing slashes will be removed, leading slashes won't.
-        * Usage: concatenatePaths(array('dir1/dir2', 'dir3', 'file'))
-        *
-        * @param array $paths the file paths to be combined. Last array element may include the filename.
-        * @return string concatenated path without trailing slash.
-        * @see getUnixStylePath()
-        */
-       static public function concatenatePaths(array $paths) {
-               return rtrim(self::getUnixStylePath(implode('/', $paths)), '/');
-       }
-
-       /**
-        * Returns all filenames from the specified directory. Filters hidden files and
-        * directories.
-        *
-        * @param string $path Path to the directory which shall be read
-        * @param string $suffix If specified, only filenames with this extension are returned (eg. ".php" or "foo.bar")
-        * @param boolean $returnRealPath If turned on, all paths are resolved by calling realpath()
-        * @param boolean $returnDotFiles If turned on, also files beginning with a dot will be returned
-        * @param array $filenames Internally used for the recursion - don't specify!
-        * @return array Filenames including full path
-        * @throws Exception
-        */
-       static public function readDirectoryRecursively($path, $suffix = NULL, $returnRealPath = FALSE, $returnDotFiles = FALSE, &$filenames = array()) {
-               if (!is_dir($path)) throw new \TYPO3\Flow\Utility\Exception('"' . $path . '" is no directory.', 1207253462);
-
-               $directoryIterator = new \DirectoryIterator($path);
-               $suffixLength = strlen($suffix);
-
-               foreach ($directoryIterator as $fileInfo) {
-                       $filename = $fileInfo->getFilename();
-                       if ($filename === '.' || $filename === '..' || ($returnDotFiles === FALSE && $filename[0] === '.')) {
-                               continue;
-                       }
-                       if ($fileInfo->isFile() && ($suffix === NULL || substr($filename, -$suffixLength) === $suffix)) {
-                               $filenames[] = self::getUnixStylePath(($returnRealPath === TRUE ? realpath($fileInfo->getPathname()) : $fileInfo->getPathname()));
-                       }
-                       if ($fileInfo->isDir()) {
-                               self::readDirectoryRecursively($fileInfo->getPathname(), $suffix, $returnRealPath, $returnDotFiles, $filenames);
-                       }
-               }
-               return $filenames;
-       }
-
-       /**
-        * Deletes all files, directories and subdirectories from the specified
-        * directory. The passed directory itself won't be deleted though.
-        *
-        * @param string $path Path to the directory which shall be emptied.
-        * @return void
-        * @throws Exception
-        * @see removeDirectoryRecursively()
-        */
-       static public function emptyDirectoryRecursively($path) {
-               if (!is_dir($path)) {
-                       throw new \TYPO3\Flow\Utility\Exception('"' . $path . '" is no directory.', 1169047616);
-               }
-
-               if (self::is_link($path)) {
-                       if (self::unlink($path) !== TRUE) {
-                               throw new \TYPO3\Flow\Utility\Exception('Could not unlink symbolic link "' . $path . '".', 1323697654);
-                       }
-               } else {
-                       $directoryIterator = new \RecursiveDirectoryIterator($path);
-                       foreach ($directoryIterator as $fileInfo) {
-                               if (!$fileInfo->isDir()) {
-                                       if (self::unlink($fileInfo->getPathname()) !== TRUE) {
-                                               throw new \TYPO3\Flow\Utility\Exception('Could not unlink file "' . $fileInfo->getPathname() . '".', 1169047619);
-                                       }
-                               } elseif (!$directoryIterator->isDot()) {
-                                       self::removeDirectoryRecursively($fileInfo->getPathname());
-                               }
-                       }
-               }
-       }
-
-       /**
-        * Deletes all files, directories and subdirectories from the specified
-        * directory. Contrary to emptyDirectoryRecursively() this function will
-        * also finally remove the emptied directory.
-        *
-        * @param  string $path Path to the directory which shall be removed completely.
-        * @return void
-        * @throws Exception
-        * @see emptyDirectoryRecursively()
-        */
-       static public function removeDirectoryRecursively($path) {
-               if (self::is_link($path)) {
-                       if (self::unlink($path) !== TRUE) {
-                               throw new \TYPO3\Flow\Utility\Exception('Could not unlink symbolic link "' . $path . '".', 1316000297);
-                       }
-               } else {
-                       self::emptyDirectoryRecursively($path);
-                       try {
-                               if (rmdir($path) !== TRUE) {
-                                       throw new \TYPO3\Flow\Utility\Exception('Could not remove directory "' . $path . '".', 1316000298);
-                               }
-                       } catch (\Exception $exception) {
-                               throw new \TYPO3\Flow\Utility\Exception('Could not remove directory "' . $path . '".', 1323961907);
-                       }
-               }
-       }
-
-       /**
-        * Creates a directory specified by $path. If the parent directories
-        * don't exist yet, they will be created as well.
-        *
-        * @param string $path Path to the directory which shall be created
-        * @return void
-        * @throws Exception
-        * @todo Make mode configurable / make umask configurable
-        */
-       static public function createDirectoryRecursively($path) {
-               if (substr($path, -2) === '/.') {
-                       $path = substr($path, 0, -1);
-               }
-               if (is_file($path)) {
-                       throw new \TYPO3\Flow\Utility\Exception('Could not create directory "' . $path . '", because a file with that name exists!', 1349340620);
-               }
-               if ($path !== '' && !is_dir($path)) {
-                       $oldMask = umask(000);
-                       mkdir($path, 0777, TRUE);
-                       umask($oldMask);
-                       if (!is_dir($path)) {
-                               throw new \TYPO3\Flow\Utility\Exception('Could not create directory "' . $path . '"!', 1170251400);
-                       }
-               }
-       }
-
-       /**
-        * Copies the contents of the source directory to the target directory.
-        * $targetDirectory will be created if it does not exist.
-        *
-        * If $keepExistingFiles is TRUE, this will keep files already present
-        * in the target location. It defaults to FALSE.
-        *
-        * If $copyDotFiles is TRUE, this will copy files whose name begin with
-        * a dot. It defaults to FALSE.
-        *
-        * @param string $sourceDirectory
-        * @param string $targetDirectory
-        * @param boolean $keepExistingFiles
-        * @param boolean $copyDotFiles
-        * @return void
-        * @throws Exception
-        */
-       static public function copyDirectoryRecursively($sourceDirectory, $targetDirectory, $keepExistingFiles = FALSE, $copyDotFiles = FALSE) {
-               if (!is_dir($sourceDirectory)) {
-                       throw new \TYPO3\Flow\Utility\Exception('"' . $sourceDirectory . '" is no directory.', 1235428779);
-               }
-
-               self::createDirectoryRecursively($targetDirectory);
-               if (!is_dir($targetDirectory)) {
-                       throw new \TYPO3\Flow\Utility\Exception('"' . $targetDirectory . '" is no directory.', 1235428780);
-               }
-
-               $sourceFilenames = self::readDirectoryRecursively($sourceDirectory, NULL, FALSE, $copyDotFiles);
-               foreach ($sourceFilenames as $filename) {
-                       $relativeFilename = str_replace($sourceDirectory, '', $filename);
-                       self::createDirectoryRecursively($targetDirectory . dirname($relativeFilename));
-                       $targetPathAndFilename = self::concatenatePaths(array($targetDirectory, $relativeFilename));
-                       if ($keepExistingFiles === FALSE || !file_exists($targetPathAndFilename)) {
-                               copy($filename, $targetPathAndFilename);
-                       }
-               }
-       }
-
-       /**
-        * An enhanced version of file_get_contents which intercepts the warning
-        * issued by the original function if a file could not be loaded.
-        *
-        * @param string $pathAndFilename Path and name of the file to load
-        * @param integer $flags (optional) ORed flags using PHP's FILE_* constants (see manual of file_get_contents).
-        * @param resource $context (optional) A context resource created by stream_context_create()
-        * @param integer $offset (optional) Offset where reading of the file starts.
-        * @param integer $maximumLength (optional) Maximum length to read. Default is -1 (no limit)
-        * @return mixed The file content as a string or FALSE if the file could not be opened.
-        */
-       static public function getFileContents($pathAndFilename, $flags = 0, $context = NULL, $offset = -1, $maximumLength = -1) {
-               if ($flags === TRUE) $flags = FILE_USE_INCLUDE_PATH;
-               try {
-                       if ($maximumLength > -1) {
-                               $content = file_get_contents($pathAndFilename, $flags, $context, $offset, $maximumLength);
-                       } else {
-                               $content = file_get_contents($pathAndFilename, $flags, $context, $offset);
-                       }
-               } catch (\TYPO3\Flow\Error\Exception $ignoredException) {
-                       $content = FALSE;
-               }
-               return $content;
-       }
-
-       /**
-        * Returns a human-readable message for the given PHP file upload error
-        * constant.
-        *
-        * @param integer $errorCode One of the UPLOAD_ERR_ constants
-        * @return string
-        */
-       static public function getUploadErrorMessage($errorCode) {
-               switch ($errorCode) {
-                       case \UPLOAD_ERR_INI_SIZE:
-                               return 'The uploaded file exceeds the upload_max_filesize directive in php.ini';
-                       case \UPLOAD_ERR_FORM_SIZE:
-                               return 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form';
-                       case \UPLOAD_ERR_PARTIAL:
-                               return 'The uploaded file was only partially uploaded';
-                       case \UPLOAD_ERR_NO_FILE:
-                               return 'No file was uploaded';
-                       case \UPLOAD_ERR_NO_TMP_DIR:
-                               return 'Missing a temporary folder';
-                       case \UPLOAD_ERR_CANT_WRITE:
-                               return 'Failed to write file to disk';
-                       case \UPLOAD_ERR_EXTENSION:
-                               return 'File upload stopped by extension';
-                       default:
-                               return 'Unknown upload error';
-               }
-       }
-
-       /**
-        * A version of is_link() that works on Windows too
-        * @see http://www.php.net/is_link
-        *
-        * If http://bugs.php.net/bug.php?id=51766 gets fixed we can drop this.
-        *
-        * @param string $pathAndFilename Path and name of the file or directory
-        * @return boolean TRUE if the path exists and is a symbolic link, FALSE otherwise
-        */
-       static public function is_link($pathAndFilename) {
-                       // if not on Windows, call PHPs own is_link() function
-               if (DIRECTORY_SEPARATOR === '/') {
-                       return \is_link($pathAndFilename);
-               }
-               if (!file_exists($pathAndFilename)) {
-                       return FALSE;
-               }
-               $normalizedPathAndFilename = strtolower(rtrim(self::getUnixStylePath($pathAndFilename), '/'));
-               $normalizedTargetPathAndFilename = strtolower(self::getUnixStylePath(realpath($pathAndFilename)));
-               if ($normalizedTargetPathAndFilename === '') {
-                       return FALSE;
-               }
-               return $normalizedPathAndFilename !== $normalizedTargetPathAndFilename;
-       }
-
-       /**
-        * A version of unlink() that works on Windows regardless on the symlink type (file/directory)
-        *
-        * @param string $pathAndFilename Path and name of the file or directory
-        * @return boolean TRUE if file/directory was removed successfully
-        */
-       static public function unlink($pathAndFilename) {
-               try {
-                               // if not on Windows, call PHPs own unlink() function
-                       if (DIRECTORY_SEPARATOR === '/' || is_file($pathAndFilename)) {
-                               return @\unlink($pathAndFilename);
-                       }
-                       return rmdir($pathAndFilename);
-               } catch (\Exception $exception) {
-                       return FALSE;
-               }
-       }
-}
-?>
diff --git a/typo3/sysext/core/Resources/PHP/TYPO3.Flow/README b/typo3/sysext/core/Resources/PHP/TYPO3.Flow/README
deleted file mode 100644 (file)
index bac8181..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-This folder contains the parts of TYPO3 Flow for the intermediary
-package management to work.
-
-The following has been changed:
-* TYPO3\Flow\Exception now extends TYPO3\CMS\Core\Exception
-* TYPO3\Flow\Package\Package has magic sleep and wakeup methods
-* TYPO3\Flow\Package\PackageManager::sortAndSavePackageStates throws error if write access to PackageState file is missing
-
-It has been imported from this commmit hash:
-
-327db44575d90f5f7309ec9febaa444fc2ac8a4e
-
-2014-03-10 Changes to PackageManager classes
-* The PackageManagerInterface dictates a constructor with only 1 parameter.
-  The PackageManager classes and the calls are adopted accordingly.
\ No newline at end of file
index 74ca5a1..2b81457 100644 (file)
@@ -60,11 +60,15 @@ class ClassLoaderTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
 
                mkdir('vfs://Test/Packages/Application/Acme.MyApp/Classes/', 0770, TRUE);
                file_put_contents('vfs://Test/Packages/Application/Acme.MyApp/composer.json', '{"name": "acme/myapp", "type": "flow-test"}');
-               $package1 = new \TYPO3\Flow\Package\Package($this->getMock(\TYPO3\Flow\Package\PackageManager::class), 'Acme.MyApp', 'vfs://Test/Packages/Application/Acme.MyApp/', 'Classes');
+               file_put_contents('vfs://Test/Packages/Application/Acme.MyApp/ext_emconf.php', '');
+               $packageManager = $this->getMock(\TYPO3\CMS\Core\Package\PackageManager::class, array('isPackageKeyValid'));
+               $packageManager->expects($this->any())->method('isPackageKeyValid')->willReturn(TRUE);
+               $package1 = new \TYPO3\CMS\Core\Package\Package($packageManager, 'Acme.MyApp', 'vfs://Test/Packages/Application/Acme.MyApp/', 'Classes');
 
                mkdir('vfs://Test/Packages/Application/Acme.MyAppAddon/Classes/', 0770, TRUE);
                file_put_contents('vfs://Test/Packages/Application/Acme.MyAppAddon/composer.json', '{"name": "acme/myappaddon", "type": "flow-test"}');
-               $package2 = new \TYPO3\Flow\Package\Package($this->getMock(\TYPO3\Flow\Package\PackageManager::class), 'Acme.MyAppAddon', 'vfs://Test/Packages/Application/Acme.MyAppAddon/', 'Classes');
+               file_put_contents('vfs://Test/Packages/Application/Acme.MyAppAddon/ext_emconf.php', '');
+               $package2 = new \TYPO3\CMS\Core\Package\Package($packageManager, 'Acme.MyAppAddon', 'vfs://Test/Packages/Application/Acme.MyAppAddon/', 'Classes');
 
                $mockClassAliasMap = $this->getMock(\TYPO3\CMS\Core\Core\ClassAliasMap::class, array('setPackagesButDontBuildMappingFilesReturnClassNameToAliasMappingInstead', 'buildMappingFiles'), array(), '', FALSE);
                $mockClassAliasMap->expects($this->any())->method('setPackagesButDontBuildMappingFilesReturnClassNameToAliasMappingInstead')->will($this->returnValue(array()));
@@ -109,8 +113,8 @@ class ClassLoaderTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function classesFromSubDirectoriesAreLoaded() {
-               mkdir('vfs://Test/Packages/Application/Acme.MyApp/Classes/Acme/MyApp/SubDirectory', 0770, TRUE);
-               file_put_contents('vfs://Test/Packages/Application/Acme.MyApp/Classes/Acme/MyApp/SubDirectory/ClassInSubDirectory.php', '<?php ' . __CLASS__ . '::$testClassWasLoaded = TRUE; ?>');
+               mkdir('vfs://Test/Packages/Application/Acme.MyApp/Classes/SubDirectory', 0770, TRUE);
+               file_put_contents('vfs://Test/Packages/Application/Acme.MyApp/Classes/SubDirectory/ClassInSubDirectory.php', '<?php ' . __CLASS__ . '::$testClassWasLoaded = TRUE; ?>');
 
                self::$testClassWasLoaded = FALSE;
                $this->classLoader->loadClass('Acme\MyApp\SubDirectory\ClassInSubDirectory');
@@ -121,8 +125,8 @@ class ClassLoaderTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function classesFromDeeplyNestedSubDirectoriesAreLoaded() {
-               mkdir('vfs://Test/Packages/Application/Acme.MyApp/Classes/Acme/MyApp/SubDirectory/A/B/C/D', 0770, TRUE);
-               file_put_contents('vfs://Test/Packages/Application/Acme.MyApp/Classes/Acme/MyApp/SubDirectory/A/B/C/D/E.php', '<?php ' . __CLASS__ . '::$testClassWasLoaded = TRUE; ?>');
+               mkdir('vfs://Test/Packages/Application/Acme.MyApp/Classes/SubDirectory/A/B/C/D', 0770, TRUE);
+               file_put_contents('vfs://Test/Packages/Application/Acme.MyApp/Classes/SubDirectory/A/B/C/D/E.php', '<?php ' . __CLASS__ . '::$testClassWasLoaded = TRUE; ?>');
 
                self::$testClassWasLoaded = FALSE;
                $this->classLoader->loadClass('Acme\MyApp\SubDirectory\A\B\C\D\E');
@@ -136,8 +140,7 @@ class ClassLoaderTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         * @test
         */
        public function classesFromSubMatchingPackagesAreLoaded() {
-               mkdir('vfs://Test/Packages/Application/Acme.MyAppAddon/Classes/Acme/MyAppAddon', 0770, TRUE);
-               file_put_contents('vfs://Test/Packages/Application/Acme.MyAppAddon/Classes/Acme/MyAppAddon/Class.php', '<?php ' . __CLASS__ . '::$testClassWasLoaded = TRUE; ?>');
+               file_put_contents('vfs://Test/Packages/Application/Acme.MyAppAddon/Classes/Class.php', '<?php ' . __CLASS__ . '::$testClassWasLoaded = TRUE; ?>');
 
      &nb