[BUGFIX] Skip dependency check for extensions 75/40775/2
authorNicole Cordes <typo3@cordes.co>
Tue, 30 Jun 2015 17:44:58 +0000 (19:44 +0200)
committerMarkus Klein <markus.klein@typo3.org>
Wed, 1 Jul 2015 09:19:37 +0000 (11:19 +0200)
If an incompatible extension is trying to be installed, a popup opens
with the possibility to skip dependency checks and retry the
installation. Currently the skipping is only implemented for system
checks (TYPO3 and PHP versions). This patch adds the missing skip method
during extension dependency resolving.

Resolves: #67863
Releases: master
Change-Id: Idbd4bc649a83a8e8a98652ffb8bd8081a7c65192
Reviewed-on: http://review.typo3.org/40775
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Florian Weiss <typo3org@leblanc.at>
Tested-by: Florian Weiss <typo3org@leblanc.at>
Tested-by: Markus Klein <markus.klein@typo3.org>
typo3/sysext/extensionmanager/Classes/Controller/ActionController.php
typo3/sysext/extensionmanager/Classes/Controller/DownloadController.php
typo3/sysext/extensionmanager/Classes/Service/ExtensionManagementService.php
typo3/sysext/extensionmanager/Classes/Utility/DependencyUtility.php

index ccfdf5f..3977432 100644 (file)
@@ -81,7 +81,7 @@ class ActionController extends AbstractController {
         * @return void
         */
        public function installExtensionWithoutSystemDependencyCheckAction($extensionKey) {
-               $this->managementService->setSkipSystemDependencyCheck(TRUE);
+               $this->managementService->setSkipDependencyCheck(TRUE);
                $this->forward('toggleExtensionInstallationState', NULL, NULL, array('extensionKey' => $extensionKey));
        }
 
index 8fcd0f4..26d1aad 100644 (file)
@@ -128,7 +128,7 @@ class DownloadController extends AbstractController {
         * @throws \Exception
         */
        public function installExtensionWithoutSystemDependencyCheckAction(\TYPO3\CMS\Extensionmanager\Domain\Model\Extension $extension) {
-               $this->managementService->setSkipSystemDependencyCheck(TRUE);
+               $this->managementService->setSkipDependencyCheck(TRUE);
                $this->forward('installFromTer', NULL, NULL, array('extension' => $extension, 'downloadPath' => 'Local'));
        }
 
index 7a4235e..d5fadd1 100644 (file)
@@ -70,7 +70,7 @@ class ExtensionManagementService implements \TYPO3\CMS\Core\SingletonInterface {
        /**
         * @var bool
         */
-       protected $skipSystemDependencyCheck = FALSE;
+       protected $skipDependencyCheck = FALSE;
 
        /**
         * @param string $extensionKey
@@ -124,10 +124,10 @@ class ExtensionManagementService implements \TYPO3\CMS\Core\SingletonInterface {
        /**
         * Enables or disables the dependency check for system environment (PHP, TYPO3) before extension installation
         *
-        * @param bool $skipSystemDependencyCheck
+        * @param bool $skipDependencyCheck
         */
-       public function setSkipSystemDependencyCheck($skipSystemDependencyCheck) {
-               $this->skipSystemDependencyCheck = $skipSystemDependencyCheck;
+       public function setSkipDependencyCheck($skipDependencyCheck) {
+               $this->skipDependencyCheck = $skipDependencyCheck;
        }
 
        /**
@@ -223,7 +223,7 @@ class ExtensionManagementService implements \TYPO3\CMS\Core\SingletonInterface {
         * @return bool Returns TRUE if all dependencies can be resolved, otherwise FALSE
         */
        protected function checkDependencies(Extension $extension) {
-               $this->dependencyUtility->setSkipSystemDependencyCheck($this->skipSystemDependencyCheck);
+               $this->dependencyUtility->setSkipDependencyCheck($this->skipDependencyCheck);
                $this->dependencyUtility->checkDependencies($extension);
 
                return !$this->dependencyUtility->hasDependencyErrors();
@@ -323,7 +323,7 @@ class ExtensionManagementService implements \TYPO3\CMS\Core\SingletonInterface {
         * @return array
         */
        public function getAndResolveDependencies(Extension $extension) {
-               $this->dependencyUtility->setSkipSystemDependencyCheck($this->skipSystemDependencyCheck);
+               $this->dependencyUtility->setSkipDependencyCheck($this->skipDependencyCheck);
                $this->dependencyUtility->checkDependencies($extension);
                $installQueue = $this->downloadQueue->getExtensionInstallStorage();
                if (is_array($installQueue) && !empty($installQueue)) {
index fbf2313..81562f8 100644 (file)
@@ -75,7 +75,7 @@ class DependencyUtility implements \TYPO3\CMS\Core\SingletonInterface {
        /**
         * @var bool
         */
-       protected $skipSystemDependencyCheck = FALSE;
+       protected $skipDependencyCheck = FALSE;
 
        /**
         * @param string $localExtensionStorage
@@ -99,8 +99,8 @@ class DependencyUtility implements \TYPO3\CMS\Core\SingletonInterface {
         * @param bool $skipSpecialDependencyCheck
         * @return void
         */
-       public function setSkipSystemDependencyCheck($skipSpecialDependencyCheck) {
-               $this->skipSystemDependencyCheck = $skipSpecialDependencyCheck;
+       public function setSkipDependencyCheck($skipDependencyCheck) {
+               $this->skipDependencyCheck = $skipDependencyCheck;
        }
 
        /**
@@ -117,7 +117,7 @@ class DependencyUtility implements \TYPO3\CMS\Core\SingletonInterface {
                        $identifier = strtolower($dependency->getIdentifier());
                        try {
                                if (in_array($identifier, Dependency::$specialDependencies)) {
-                                       if (!$this->skipSystemDependencyCheck) {
+                                       if (!$this->skipDependencyCheck) {
                                                $methodName = 'check' . ucfirst($identifier) . 'Dependency';
                                                $this->{$methodName}($dependency);
                                        }
@@ -240,7 +240,7 @@ class DependencyUtility implements \TYPO3\CMS\Core\SingletonInterface {
                $extensionIsLoaded = $this->isDependentExtensionLoaded($extensionKey);
                if ($extensionIsLoaded === TRUE) {
                        $isLoadedVersionCompatible = $this->isLoadedVersionCompatible($dependency);
-                       if ($isLoadedVersionCompatible === TRUE) {
+                       if ($isLoadedVersionCompatible === TRUE || $this->skipDependencyCheck) {
                                return TRUE;
                        }
                        $extension = $this->listUtility->getExtension($extensionKey);
@@ -277,18 +277,22 @@ class DependencyUtility implements \TYPO3\CMS\Core\SingletonInterface {
                                                try {
                                                        $this->getExtensionFromRepository($extensionKey, $dependency);
                                                } catch (Exception\MissingExtensionDependencyException $e) {
-                                                       throw new Exception\MissingVersionDependencyException(
-                                                               'The extension ' . $extensionKey . ' is available in version ' . $availableVersion
+                                                       if (!$this->skipDependencyCheck) {
+                                                               throw new Exception\MissingVersionDependencyException(
+                                                                       'The extension ' . $extensionKey . ' is available in version ' . $availableVersion
                                                                        . ' but is needed in version ' . $dependency->getLowestVersion() . ' - ' . $dependency->getHighestVersion() . ' and could not be fetched from TER',
-                                                               1430560390
-                                                       );
+                                                                       1430560390
+                                                               );
+                                                       }
                                                }
                                        } else {
-                                               throw new Exception\MissingVersionDependencyException(
-                                                       'The extension ' . $extensionKey . ' is available in version ' . $availableVersion
+                                               if (!$this->skipDependencyCheck) {
+                                                       throw new Exception\MissingVersionDependencyException(
+                                                               'The extension ' . $extensionKey . ' is available in version ' . $availableVersion
                                                                . ' but is needed in version ' . $dependency->getLowestVersion() . ' - ' . $dependency->getHighestVersion(),
-                                                       1430562374
-                                               );
+                                                               1430562374
+                                                       );
+                                               }
                                        }
                                }
                        } else {
@@ -297,6 +301,7 @@ class DependencyUtility implements \TYPO3\CMS\Core\SingletonInterface {
                                $this->dependencyErrors = array_merge($unresolvedDependencyErrors, $this->dependencyErrors);
                        }
                }
+
                return FALSE;
        }
 
@@ -345,7 +350,7 @@ class DependencyUtility implements \TYPO3\CMS\Core\SingletonInterface {
        protected function getExtensionFromTer($extensionKey, Dependency $dependency) {
                $isExtensionDownloadableFromTer = $this->isExtensionDownloadableFromTer($extensionKey);
                if (!$isExtensionDownloadableFromTer) {
-                       if (!$this->skipSystemDependencyCheck) {
+                       if (!$this->skipDependencyCheck) {
                                if ($this->extensionRepository->countAll() > 0) {
                                        throw new Exception\MissingExtensionDependencyException(
                                                'The extension ' . $extensionKey . ' is not available from TER.',
@@ -363,7 +368,7 @@ class DependencyUtility implements \TYPO3\CMS\Core\SingletonInterface {
 
                $isDownloadableVersionCompatible = $this->isDownloadableVersionCompatible($dependency);
                if (!$isDownloadableVersionCompatible) {
-                       if (!$this->skipSystemDependencyCheck) {
+                       if (!$this->skipDependencyCheck) {
                                throw new Exception\MissingVersionDependencyException(
                                        'No compatible version found for extension ' . $extensionKey,
                                        1399161284
@@ -374,7 +379,7 @@ class DependencyUtility implements \TYPO3\CMS\Core\SingletonInterface {
 
                $latestCompatibleExtensionByIntegerVersionDependency = $this->getLatestCompatibleExtensionByIntegerVersionDependency($dependency);
                if (!$latestCompatibleExtensionByIntegerVersionDependency instanceof Extension) {
-                       if (!$this->skipSystemDependencyCheck) {
+                       if (!$this->skipDependencyCheck) {
                                throw new Exception\MissingExtensionDependencyException(
                                        'Could not resolve dependency for "' . $dependency->getIdentifier() . '"',
                                        1399161302