[BUGFIX] Make exts installable when automatic install is disabled 23/38323/3
authorMarkus Klein <klein.t3@reelworx.at>
Sat, 28 Mar 2015 12:08:08 +0000 (13:08 +0100)
committerNicole Cordes <typo3@cordes.co>
Sat, 28 Mar 2015 19:20:32 +0000 (20:20 +0100)
This fix allows to install extensions manually again if the user has
disabled the automatic extension installation.

Releases: master
Resolves: #66110
Change-Id: I20f19e6874a8c41aa891907e53642ed4013c3222
Reviewed-on: http://review.typo3.org/38323
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Nicole Cordes <typo3@cordes.co>
Tested-by: Nicole Cordes <typo3@cordes.co>
typo3/sysext/extensionmanager/Classes/Controller/DownloadController.php
typo3/sysext/extensionmanager/Classes/Service/ExtensionManagementService.php

index 815255b..11cad48 100644 (file)
@@ -239,6 +239,7 @@ class DownloadController extends AbstractController {
                $errorMessages = array();
                try {
                        $this->downloadUtility->setDownloadPath($downloadPath);
+                       $this->managementService->setAutomaticInstallationEnabled($this->configurationUtility->getCurrentConfiguration('extensionmanager')['automaticInstallation']['value']);
                        if (($result = $this->managementService->installExtension($extension)) === FALSE) {
                                $errorMessages = $this->managementService->getDependencyErrors();
                        }
index 1821c5f..dac042d 100644 (file)
@@ -14,6 +14,9 @@ namespace TYPO3\CMS\Extensionmanager\Service;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Extbase\Object\ObjectManager;
+use TYPO3\CMS\Extbase\SignalSlot\Dispatcher;
 use TYPO3\CMS\Extensionmanager\Domain\Model\Extension;
 
 /**
@@ -60,10 +63,9 @@ class ExtensionManagementService implements \TYPO3\CMS\Core\SingletonInterface {
        protected $downloadUtility;
 
        /**
-        * @var \TYPO3\CMS\Extensionmanager\Utility\ConfigurationUtility
-        * @inject
+        * @var bool
         */
-       protected $configurationUtility;
+       protected $automaticInstallationEnabled = TRUE;
 
        /**
         * @var bool
@@ -130,13 +132,10 @@ class ExtensionManagementService implements \TYPO3\CMS\Core\SingletonInterface {
        }
 
        /**
-        * Returns whether automatic installation is enabled.
-        *
-        * @return array
+        * @param bool $automaticInstallationEnabled
         */
-       protected function isAutomaticInstallationEnabled() {
-               $emConfiguration = $this->configurationUtility->getCurrentConfiguration('extensionmanager');
-               return (bool)$emConfiguration['automaticInstallation']['value'];
+       public function setAutomaticInstallationEnabled($automaticInstallationEnabled) {
+               $this->automaticInstallationEnabled = (bool)$automaticInstallationEnabled;
        }
 
        /**
@@ -163,7 +162,7 @@ class ExtensionManagementService implements \TYPO3\CMS\Core\SingletonInterface {
                if (array_key_exists('download', $queue)) {
                        $downloadedDependencies = $this->downloadDependencies($queue['download']);
                }
-               if ($this->isAutomaticInstallationEnabled()) {
+               if ($this->automaticInstallationEnabled) {
                        if (array_key_exists('update', $queue)) {
                                $this->downloadDependencies($queue['update']);
                                $updatedDependencies = $this->uninstallDependenciesToBeUpdated($queue['update']);
@@ -234,8 +233,8 @@ class ExtensionManagementService implements \TYPO3\CMS\Core\SingletonInterface {
                $installPaths = Extension::returnAllowedInstallPaths();
                foreach ($copyQueue as $extensionKey => $sourceFolder) {
                        $destination = $installPaths['Local'] . $extensionKey;
-                       \TYPO3\CMS\Core\Utility\GeneralUtility::mkdir($destination);
-                       \TYPO3\CMS\Core\Utility\GeneralUtility::copyDirectory($sourceFolder . $extensionKey, $destination);
+                       GeneralUtility::mkdir($destination);
+                       GeneralUtility::copyDirectory($sourceFolder . $extensionKey, $destination);
                        $this->markExtensionForInstallation($extensionKey);
                        $this->downloadQueue->removeExtensionFromCopyQueue($extensionKey);
                }
@@ -346,12 +345,12 @@ class ExtensionManagementService implements \TYPO3\CMS\Core\SingletonInterface {
        /**
         * Get the SignalSlot dispatcher
         *
-        * @return \TYPO3\CMS\Extbase\SignalSlot\Dispatcher
+        * @return Dispatcher
         */
        protected function getSignalSlotDispatcher() {
                if (!isset($this->signalSlotDispatcher)) {
-                       $this->signalSlotDispatcher = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Object\ObjectManager::class)
-                               ->get(\TYPO3\CMS\Extbase\SignalSlot\Dispatcher::class);
+                       $this->signalSlotDispatcher = GeneralUtility::makeInstance(ObjectManager::class)
+                               ->get(Dispatcher::class);
                }
                return $this->signalSlotDispatcher;
        }