[BUGFIX] Allow Upgrade Wizards to install extensions 33/47933/2
authorJigal van Hemert <jigal.van.hemert@typo3.org>
Wed, 27 Apr 2016 10:50:57 +0000 (12:50 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Wed, 27 Apr 2016 18:05:04 +0000 (20:05 +0200)
With the patch for #73605 the ObjectManager was removed throughout
the Install Tool. ListUtility, TerUtility, FileHandlingUtility and
InstallUtility need recursive DI and constructor argument handling.
Until the EM and the Upgrade Wizards are rewritten the OM is
reintroduced to make the Upgrade Wizards work.

Releases: master
Resolves: #75883
Change-Id: I4c68853befd33bfeba71bd19cfd1979369dd4803
Reviewed-on: https://review.typo3.org/47933
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Nicole Cordes <typo3@cordes.co>
Tested-by: Nicole Cordes <typo3@cordes.co>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/install/Classes/Updates/AbstractDownloadExtensionUpdate.php

index c34e6ec..cf0a636 100644 (file)
@@ -15,6 +15,7 @@ namespace TYPO3\CMS\Install\Updates;
  */
 
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Extbase\Object\ObjectManager;
 use TYPO3\CMS\Extensionmanager\Utility\Connection\TerUtility;
 use TYPO3\CMS\Extensionmanager\Utility\FileHandlingUtility;
 use TYPO3\CMS\Extensionmanager\Utility\InstallUtility;
@@ -52,8 +53,11 @@ abstract class AbstractDownloadExtensionUpdate extends AbstractUpdate
     protected function installExtension($extensionKey, &$customMessages)
     {
         $updateSuccessful = true;
+        /** @var $objectManager ObjectManager */
+        $objectManager = GeneralUtility::makeInstance(ObjectManager::class);
+
         /** @var $extensionListUtility ListUtility */
-        $extensionListUtility = GeneralUtility::makeInstance(ListUtility::class);
+        $extensionListUtility = $objectManager->get(ListUtility::class);
 
         $availableExtensions = $extensionListUtility->getAvailableExtensions();
         $availableAndInstalledExtensions = $extensionListUtility->getAvailableAndInstalledExtensions($availableExtensions);
@@ -61,7 +65,7 @@ abstract class AbstractDownloadExtensionUpdate extends AbstractUpdate
         // Extension is not downloaded yet.
         if (!is_array($availableAndInstalledExtensions[$extensionKey])) {
             /** @var $extensionTerUtility TerUtility */
-            $extensionTerUtility = GeneralUtility::makeInstance(TerUtility::class);
+            $extensionTerUtility = $objectManager->get(TerUtility::class);
             $extensionDetails = $this->getExtensionDetails($extensionKey);
             if (empty($extensionDetails)) {
                 $updateSuccessful = false;
@@ -79,7 +83,7 @@ abstract class AbstractDownloadExtensionUpdate extends AbstractUpdate
             }
 
             /** @var $extensionFileHandlingUtility FileHandlingUtility */
-            $extensionFileHandlingUtility = GeneralUtility::makeInstance(FileHandlingUtility::class);
+            $extensionFileHandlingUtility = $objectManager->get(FileHandlingUtility::class);
             $extensionFileHandlingUtility->unpackExtensionFromExtensionDataArray($t3xExtracted);
 
             // The listUtility now needs to have the regenerated list of packages
@@ -88,7 +92,7 @@ abstract class AbstractDownloadExtensionUpdate extends AbstractUpdate
 
         if ($updateSuccessful !== false) {
             /** @var $extensionInstallUtility InstallUtility */
-            $extensionInstallUtility = GeneralUtility::makeInstance(InstallUtility::class);
+            $extensionInstallUtility = $objectManager->get(InstallUtility::class);
             $extensionInstallUtility->install($extensionKey);
         }
         return $updateSuccessful;