[BUGFIX] Load ext_emconf information in extension installation 00/50500/2
authorNicole Cordes <typo3@cordes.co>
Wed, 2 Nov 2016 11:53:48 +0000 (12:53 +0100)
committerMarkus Klein <markus.klein@typo3.org>
Fri, 4 Nov 2016 09:04:06 +0000 (10:04 +0100)
With patch https://review.typo3.org/50427/ TER information were not
loaded for extension information. Unfortunately this also skips loading
the dependencies which results in uninstalled dependencies. This patch
introduces a new function to only load needed (and available)
information from ext_emconf file for processing a correct extension
installation/activation.

Resolves: #78540
Releases: master, 7.6, 6.2
Change-Id: I16bddc91cb2523488cedc2293936eeb8aa2eb577
Reviewed-on: https://review.typo3.org/50500
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/extensionmanager/Classes/Utility/InstallUtility.php
typo3/sysext/extensionmanager/Classes/Utility/ListUtility.php

index 8b0ae28..14ae3c0 100644 (file)
@@ -332,11 +332,11 @@ class InstallUtility implements \TYPO3\CMS\Core\SingletonInterface
     {
         $extension = $this->getExtensionArray($extensionKey);
         if (!$loadTerInformation) {
-            return $extension;
+            $availableAndInstalledExtensions = $this->listUtility->enrichExtensionsWithEmConfInformation([$extensionKey => $extension]);
+        } else {
+            $availableAndInstalledExtensions = $this->listUtility->enrichExtensionsWithEmConfAndTerInformation([$extensionKey => $extension]);
         }
 
-        $availableAndInstalledExtensions = $this->listUtility->enrichExtensionsWithEmConfAndTerInformation([$extensionKey => $extension]);
-
         if (!isset($availableAndInstalledExtensions[$extensionKey])) {
             throw new ExtensionManagerException(
                 'Please check your uploaded extension "' . $extensionKey . '". The configuration file "ext_emconf.php" seems to be invalid.',
index 1186fe6..81acef8 100644 (file)
@@ -190,23 +190,12 @@ class ListUtility implements \TYPO3\CMS\Core\SingletonInterface
      * @param array $extensions
      * @return array
      */
-    public function enrichExtensionsWithEmConfAndTerInformation(array $extensions)
+    public function enrichExtensionsWithEmConfInformation(array $extensions)
     {
         foreach ($extensions as $extensionKey => $properties) {
             $emconf = $this->emConfUtility->includeEmConf($properties);
             if ($emconf) {
                 $extensions[$extensionKey] = array_merge($emconf, $properties);
-                $terObject = $this->getExtensionTerData($extensionKey, $extensions[$extensionKey]['version']);
-                if ($terObject !== null) {
-                    $extensions[$extensionKey]['terObject'] = $terObject;
-                    $extensions[$extensionKey]['updateAvailable'] = false;
-                    $extensions[$extensionKey]['updateToVersion'] = null;
-                    $extensionToUpdate = $this->installUtility->getUpdateableVersion($terObject);
-                    if ($extensionToUpdate !== false) {
-                        $extensions[$extensionKey]['updateAvailable'] = true;
-                        $extensions[$extensionKey]['updateToVersion'] = $extensionToUpdate;
-                    }
-                }
             } else {
                 unset($extensions[$extensionKey]);
             }
@@ -215,6 +204,31 @@ class ListUtility implements \TYPO3\CMS\Core\SingletonInterface
     }
 
     /**
+     * Adds the information from the emconf array and TER to the extension information
+     *
+     * @param array $extensions
+     * @return array
+     */
+    public function enrichExtensionsWithEmConfAndTerInformation(array $extensions)
+    {
+        $extensions = $this->enrichExtensionsWithEmConfInformation($extensions);
+        foreach ($extensions as $extensionKey => $properties) {
+            $terObject = $this->getExtensionTerData($extensionKey, $extensions[$extensionKey]['version']);
+            if ($terObject !== null) {
+                $extensions[$extensionKey]['terObject'] = $terObject;
+                $extensions[$extensionKey]['updateAvailable'] = false;
+                $extensions[$extensionKey]['updateToVersion'] = null;
+                $extensionToUpdate = $this->installUtility->getUpdateableVersion($terObject);
+                if ($extensionToUpdate !== false) {
+                    $extensions[$extensionKey]['updateAvailable'] = true;
+                    $extensions[$extensionKey]['updateToVersion'] = $extensionToUpdate;
+                }
+            }
+        }
+        return $extensions;
+    }
+
+    /**
      * Tries to find given extension with given version in TER data.
      * If extension is found but not the given version, we return TER data from highest version with version data set to
      * given one.