[BUGFIX] Fallback to version of ext_emconf.php 33/41133/4
authorNicole Cordes <typo3@cordes.co>
Mon, 13 Jul 2015 15:51:42 +0000 (17:51 +0200)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Tue, 14 Jul 2015 21:53:41 +0000 (23:53 +0200)
To resolve dependencies the ExtensionManager needs a version of an
extension. If the current composer.json fails to provide a version
we should fall back to the ext_emconf.php.

Releases: master
Resolves: #65866
Change-Id: I9e8383de10e2df1b722fda4b55d1379908f13138
Reviewed-on: http://review.typo3.org/41133
Reviewed-by: Benjamin Mack <benni@typo3.org>
Tested-by: Benjamin Mack <benni@typo3.org>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
typo3/sysext/core/Classes/Package/Package.php

index 02e5470..3de91c6 100644 (file)
@@ -111,6 +111,7 @@ class Package implements PackageInterface {
                        if (!$this->loadExtensionEmconf()) {
                                throw new Exception\InvalidPackageManifestException('No valid ext_emconf.php file found for package "' . $packageKey . '".', 1360403545);
                        }
+                       $this->mapExtensionManagerConfigurationToComposerManifest();
                }
                $this->loadFlagsFromComposerManifest();
        }
@@ -201,7 +202,6 @@ class Package implements PackageInterface {
                        include $path;
                        if (is_array($EM_CONF[$_EXTKEY])) {
                                $this->extensionManagerConfiguration = $EM_CONF[$_EXTKEY];
-                               $this->mapExtensionManagerConfigurationToComposerManifest();
                                return TRUE;
                        }
                }
@@ -263,7 +263,16 @@ class Package implements PackageInterface {
                if ($this->packageMetaData === NULL) {
                        $this->packageMetaData = new MetaData($this->getPackageKey());
                        $this->packageMetaData->setDescription($this->getValueFromComposerManifest('description'));
-                       $this->packageMetaData->setVersion($this->getValueFromComposerManifest('version'));
+                       $version = $this->getValueFromComposerManifest('version');
+                       if ($version !== NULL) {
+                               $this->packageMetaData->setVersion($version);
+                       } else {
+                               // As version is important within the core we need to make sure it is available
+                               // Fetch it from ext_emconf.php
+                               if ($this->loadExtensionEmconf()) {
+                                       $this->packageMetaData->setVersion($this->extensionManagerConfiguration['version']);
+                               }
+                       }
                        $requirements = $this->getValueFromComposerManifest('require');
                        if ($requirements !== NULL) {
                                foreach ($requirements as $requirement => $version) {