[BUGFIX] Prevent current extension version in update dialog 91/43691/2
authorNicole Cordes <typo3@cordes.co>
Thu, 1 Oct 2015 12:25:17 +0000 (14:25 +0200)
committerAlexander Opitz <opitz.alexander@googlemail.com>
Mon, 5 Oct 2015 11:20:49 +0000 (13:20 +0200)
If you update an extension, the current version is included in the
confirmation dialog. This might confuse the user as this version is
already available. The patch re-adds the usage of the repository
function to exclude the current used version in the query.

Resolves: #65904
Releases: master, 6.2
Change-Id: I49aa2ba36bbfd7888aa202028dfd9e9c882a8183
Reviewed-on: http://review.typo3.org/43691
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Stephan GroƟberndt <stephan@grossberndt.de>
Reviewed-by: Daniel Goerz <ervaude@gmail.com>
Tested-by: Daniel Goerz <ervaude@gmail.com>
Reviewed-by: Alexander Opitz <opitz.alexander@googlemail.com>
Tested-by: Alexander Opitz <opitz.alexander@googlemail.com>
typo3/sysext/extensionmanager/Classes/Controller/DownloadController.php
typo3/sysext/extensionmanager/Classes/Domain/Repository/ExtensionRepository.php
typo3/sysext/extensionmanager/Classes/Utility/InstallUtility.php

index cd4c691..e07dd2c 100644 (file)
@@ -273,7 +273,8 @@ class DownloadController extends AbstractController {
                $updatableVersions = $this->extensionRepository->findByVersionRangeAndExtensionKeyOrderedByVersion(
                        $extensionKey,
                        $versionStart,
-                       $versionStop
+                       $versionStop,
+                       FALSE
                );
                $highestPossibleVersion = FALSE;
 
index 80cd617..94b1278 100644 (file)
@@ -179,15 +179,23 @@ class ExtensionRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
                $query = $this->createQuery();
                $constraint = NULL;
                if ($lowestVersion !== 0 && $highestVersion !== 0) {
-                       $constraint = $query->logicalAnd($query->lessThanOrEqual('integerVersion', $highestVersion), $query->greaterThanOrEqual('integerVersion', $lowestVersion), $query->equals('extensionKey', $extensionKey));
-               } elseif ($lowestVersion === 0 && $highestVersion !== 0 && $includeCurrentVersion) {
-                       $constraint = $query->logicalAnd($query->lessThanOrEqual('integerVersion', $highestVersion), $query->equals('extensionKey', $extensionKey));
+                       if ($includeCurrentVersion) {
+                               $constraint = $query->logicalAnd($query->lessThanOrEqual('integerVersion', $highestVersion), $query->greaterThanOrEqual('integerVersion', $lowestVersion), $query->equals('extensionKey', $extensionKey));
+                       } else {
+                               $constraint = $query->logicalAnd($query->lessThanOrEqual('integerVersion', $highestVersion), $query->greaterThan('integerVersion', $lowestVersion), $query->equals('extensionKey', $extensionKey));
+                       }
                } elseif ($lowestVersion === 0 && $highestVersion !== 0) {
-                       $constraint = $query->logicalAnd($query->lessThan('integerVersion', $highestVersion), $query->equals('extensionKey', $extensionKey));
-               } elseif ($lowestVersion !== 0 && $highestVersion === 0 && $includeCurrentVersion) {
-                       $constraint = $query->logicalAnd($query->greaterThanOrEqual('integerVersion', $lowestVersion), $query->equals('extensionKey', $extensionKey));
+                       if ($includeCurrentVersion) {
+                               $constraint = $query->logicalAnd($query->lessThanOrEqual('integerVersion', $highestVersion), $query->equals('extensionKey', $extensionKey));
+                       } else {
+                               $constraint = $query->logicalAnd($query->lessThan('integerVersion', $highestVersion), $query->equals('extensionKey', $extensionKey));
+                       }
                } elseif ($lowestVersion !== 0 && $highestVersion === 0) {
-                       $constraint = $query->logicalAnd($query->greaterThan('integerVersion', $lowestVersion), $query->equals('extensionKey', $extensionKey));
+                       if ($includeCurrentVersion) {
+                               $constraint = $query->logicalAnd($query->greaterThanOrEqual('integerVersion', $lowestVersion), $query->equals('extensionKey', $extensionKey));
+                       } else {
+                               $constraint = $query->logicalAnd($query->greaterThan('integerVersion', $lowestVersion), $query->equals('extensionKey', $extensionKey));
+                       }
                } elseif ($lowestVersion === 0 && $highestVersion === 0) {
                        $constraint = $query->equals('extensionKey', $extensionKey);
                }
index 9b00f49..c8f7335 100644 (file)
@@ -511,7 +511,9 @@ class InstallUtility implements \TYPO3\CMS\Core\SingletonInterface {
                /** @var $extensionUpdates[] \TYPO3\CMS\Extensionmanager\Domain\Model\Extension */
                $extensionUpdates = $this->extensionRepository->findByVersionRangeAndExtensionKeyOrderedByVersion(
                        $extensionData->getExtensionKey(),
-                       $version + 1
+                       $version,
+                       0,
+                       FALSE
                );
                if ($extensionUpdates->count() > 0) {
                        foreach ($extensionUpdates as $extensionUpdate) {