[BUGFIX] Resolve dependencies on extension update 03/39603/2
authorNicole Cordes <typo3@cordes.co>
Tue, 3 Mar 2015 13:32:07 +0000 (14:32 +0100)
committerNicole Cordes <typo3@cordes.co>
Mon, 18 May 2015 21:44:29 +0000 (23:44 +0200)
For installed extensions the (new) dependencies have to be resolved
on extension update. If the extension isn't installed yet,
the dependencies are fetched on update anyway,
so this doesn't have to be tackled.

Releases: master, 6.2
Resolves: #65484
Change-Id: I5c1e8622b3b15b6c25d7181c6cb1fc07f271437d
Reviewed-on: http://review.typo3.org/39603
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Nicole Cordes <typo3@cordes.co>
Tested-by: Nicole Cordes <typo3@cordes.co>
typo3/sysext/extensionmanager/Classes/Controller/DownloadController.php

index d3ff14d..34a76bc 100644 (file)
@@ -184,9 +184,19 @@ class DownloadController extends AbstractController {
         */
        protected function updateExtensionAction() {
                $extensionKey = $this->request->getArgument('extension');
-               $highestTerVersionExtension = $this->extensionRepository->findHighestAvailableVersion($extensionKey);
+               $version = $this->request->getArgument('version');
+               $extension = $this->extensionRepository->findOneByExtensionKeyAndVersion($extensionKey, $version);
+               if (!$extension instanceof Extension) {
+                       $extension = $this->extensionRepository->findHighestAvailableVersion($extensionKey);
+               }
+               $installedExtensions = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getLoadedExtensionListArray();
                try {
-                       $this->managementService->downloadMainExtension($highestTerVersionExtension);
+                       if (in_array($extensionKey, $installedExtensions, TRUE)) {
+                               // To resolve new dependencies the extension is installed again
+                               $this->managementService->installExtension($extension);
+                       } else {
+                               $this->managementService->downloadMainExtension($extension);
+                       }
                        $this->addFlashMessage(
                                htmlspecialchars($this->translate('extensionList.updateFlashMessage.body', array($extensionKey))),
                                $this->translate('extensionList.updateFlashMessage.title')