From 16c4eb4d3f634c771d444bc3ff0ad961657f34e3 Mon Sep 17 00:00:00 2001 From: Jigal van Hemert <jigal.van.hemert@typo3.org> Date: Wed, 27 Apr 2016 12:50:57 +0200 Subject: [PATCH] [BUGFIX] Allow Upgrade Wizards to install extensions 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> --- .../Updates/AbstractDownloadExtensionUpdate.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/typo3/sysext/install/Classes/Updates/AbstractDownloadExtensionUpdate.php b/typo3/sysext/install/Classes/Updates/AbstractDownloadExtensionUpdate.php index c34e6ecb1c59..cf0a6368ff09 100644 --- a/typo3/sysext/install/Classes/Updates/AbstractDownloadExtensionUpdate.php +++ b/typo3/sysext/install/Classes/Updates/AbstractDownloadExtensionUpdate.php @@ -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; -- GitLab