[BUGFIX] Fix wrong handling of php and TYPO3 dependencies 73/23673/4
authorSusanne Moog <typo3@susannemoog.de>
Sun, 8 Sep 2013 13:26:22 +0000 (15:26 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Sat, 28 Sep 2013 14:32:34 +0000 (16:32 +0200)
Due to a superfluos try-catch block dependencies for TYPO3 and
PHP version were not checked correctly.

Additionally the TER version comparison was wrong as it did not
include the given version (only less or greater was checked, not
...OrEqual).

Resolves: #48809
Resolves: #51730
Resolves: #51182
Releases: 6.2, 6.1, 6.0
Change-Id: I773e1af014cd3e8525794c2fcdc615ea8a5f36a1
Reviewed-on: https://review.typo3.org/23673
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
typo3/sysext/extensionmanager/Classes/Controller/ActionController.php
typo3/sysext/extensionmanager/Classes/Domain/Repository/ExtensionRepository.php
typo3/sysext/extensionmanager/Classes/Utility/DependencyUtility.php

index e619f65..e20e8fb 100644 (file)
@@ -59,25 +59,25 @@ class ActionController extends \TYPO3\CMS\Extensionmanager\Controller\AbstractCo
         */
        protected function toggleExtensionInstallationStateAction($extension) {
                $installedExtensions = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getLoadedExtensionListArray();
-               if (in_array($extension, $installedExtensions)) {
-                       // uninstall
-                       try {
+               try {
+                       if (in_array($extension, $installedExtensions)) {
+                               // uninstall
                                $this->installUtility->uninstall($extension);
-                       } catch (\TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException $e) {
-                               $flashMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
-                                       'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
-                                       htmlspecialchars($e->getMessage()),
-                                       '',
-                                       \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
-                                       TRUE
+                       } else {
+                               // install
+                               $this->managementService->resolveDependenciesAndInstall(
+                                       $this->installUtility->enrichExtensionWithDetails($extension)
                                );
-                               $this->getControllerContext()->getFlashMessageQueue()->enqueue($flashMessage);
                        }
-               } else {
-                       // install
-                       $this->managementService->resolveDependenciesAndInstall(
-                               $this->installUtility->enrichExtensionWithDetails($extension)
+               } catch (\TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException $e) {
+                       $flashMessage = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
+                               'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
+                               htmlspecialchars($e->getMessage()),
+                               '',
+                               \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
+                               TRUE
                        );
+                       $this->getControllerContext()->getFlashMessageQueue()->enqueue($flashMessage);
                }
                $this->redirect('index', 'List', NULL, array(self::TRIGGER_RefreshModuleMenu => TRUE));
        }
index 1f96076..e3d8c8b 100644 (file)
@@ -177,11 +177,11 @@ class ExtensionRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
                $query = $this->createQuery();
                $constraint = NULL;
                if ($lowestVersion !== 0 && $highestVersion !== 0) {
-                       $constraint = $query->logicalAnd($query->lessThan('integerVersion', $highestVersion), $query->greaterThan('integerVersion', $lowestVersion), $query->equals('extensionKey', $extensionKey));
+                       $constraint = $query->logicalAnd($query->lessThanOrEqual('integerVersion', $highestVersion), $query->greaterThanOrEqual('integerVersion', $lowestVersion), $query->equals('extensionKey', $extensionKey));
                } elseif ($lowestVersion === 0 && $highestVersion !== 0) {
-                       $constraint = $query->logicalAnd($query->lessThan('integerVersion', $highestVersion), $query->equals('extensionKey', $extensionKey));
+                       $constraint = $query->logicalAnd($query->lessThanOrEqual('integerVersion', $highestVersion), $query->equals('extensionKey', $extensionKey));
                } elseif ($lowestVersion !== 0 && $highestVersion === 0) {
-                       $constraint = $query->logicalAnd($query->greaterThan('integerVersion', $lowestVersion), $query->equals('extensionKey', $extensionKey));
+                       $constraint = $query->logicalAnd($query->greaterThanOrEqual('integerVersion', $lowestVersion), $query->equals('extensionKey', $extensionKey));
                } elseif ($lowestVersion === 0 && $highestVersion === 0) {
                        $constraint = $query->equals('extensionKey', $extensionKey);
                }
index 473da84..31ec797 100644 (file)
@@ -68,10 +68,6 @@ class DependencyUtility implements \TYPO3\CMS\Core\SingletonInterface {
         */
        protected $availableExtensions = array();
 
-       /**
-        * @var array
-        */
-       protected $errors = array();
 
        /**
         * Setter for available extensions
@@ -142,14 +138,7 @@ class DependencyUtility implements \TYPO3\CMS\Core\SingletonInterface {
                        $identifier = strtolower($dependency->getIdentifier());
                        if (in_array($identifier, \TYPO3\CMS\Extensionmanager\Domain\Model\Dependency::$specialDependencies)) {
                                $methodname = 'check' . ucfirst($identifier) . 'Dependency';
-                               try {
-                                       $this->{$methodname}($dependency);
-                               } catch (\TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException $e) {
-                                       $this->errors[] = array(
-                                               'identifier' => $identifier,
-                                               'message' => $e->getMessage()
-                                       );
-                               }
+                               $this->{$methodname}($dependency);
                        } else {
                                if ($dependency->getType() === 'depends') {
                                        $dependenciesToResolve = !(bool) $this->checkExtensionDependency($dependency);