[BUGFIX] Fallback to version of ext_emconf.php if not found in Composer 71/37971/5
authorPeter Niederlag <peter.niederlag@typo3.org>
Fri, 20 Mar 2015 12:37:58 +0000 (13:37 +0100)
committerXavier Perseguers <xavier@typo3.org>
Tue, 9 Feb 2016 08:33:22 +0000 (09:33 +0100)
Resolves: #65866
Releases: 6.2
Change-Id: I9e8383de10e2df1b722fda4b55d1379908f13138
Reviewed-on: https://review.typo3.org/37971
Reviewed-by: Nicole Cordes <typo3@cordes.co>
Tested-by: Nicole Cordes <typo3@cordes.co>
Reviewed-by: Adrien Crivelli <adrien.crivelli@ecodev.ch>
Tested-by: Adrien Crivelli <adrien.crivelli@ecodev.ch>
Reviewed-by: Fabien Udriot <fabien.udriot@ecodev.ch>
Reviewed-by: Xavier Perseguers <xavier@typo3.org>
Tested-by: Xavier Perseguers <xavier@typo3.org>
typo3/sysext/core/Classes/Package/Package.php

index 611d318..75e6bf2 100644 (file)
@@ -201,6 +201,21 @@ class Package extends \TYPO3\Flow\Package\Package implements PackageInterface {
        public function getPackageMetaData() {
                if ($this->packageMetaData === NULL) {
                        parent::getPackageMetaData();
+
+                       // Fallback to retrieve the version number from ext_emconf.php
+                       // in case no version was found in the composer.json manifest.
+                       $version = $this->packageMetaData->getVersion();
+                       if (empty($version)) {
+                               $_EXTKEY = $this->packageKey; // required to resolve $EM_CONF[$_EXTKEY] in ext_emconf.php
+                               $path = $this->packagePath . 'ext_emconf.php';
+                               if (@file_exists($path)) {
+                                       include $path;
+                                       if (isset($EM_CONF[$_EXTKEY]['version'])) {
+                                               $this->packageMetaData->setVersion($EM_CONF[$_EXTKEY]['version']);
+                                       }
+                               }
+                       }
+
                        $suggestions = $this->getComposerManifest('suggest');
                        if ($suggestions !== NULL) {
                                foreach ($suggestions as $suggestion => $version) {