[BUGFIX] Hide unsafe extensions in EM TER list
authorJigal van Hemert <jigal@xs4all.nl>
Fri, 19 Oct 2012 20:44:32 +0000 (22:44 +0200)
committerHelmut Hummel <helmut.hummel@typo3.org>
Fri, 19 Oct 2012 21:47:07 +0000 (23:47 +0200)
When showing extensions from TER unsafe extensions must not be shown
in the list or search results.

Change-Id: I229e3fc2b00a25c4e1cbcdc1ec2ac1596692630a
Fixes: #42153
Releases: 6.0
Reviewed-on: http://review.typo3.org/15824
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel
typo3/sysext/extensionmanager/Classes/Domain/Repository/ExtensionRepository.php

index 939f65c..2114dcc 100644 (file)
@@ -109,7 +109,11 @@ class ExtensionRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
         */
        public function findOneByExtensionKeyAndVersion($extensionKey, $version) {
                $query = $this->createQuery();
-               $query->matching($query->logicalAnd($query->equals('extensionKey', $extensionKey), $query->equals('version', $version)));
+               $query->matching($query->logicalAnd(
+                       $query->equals('extensionKey', $extensionKey),
+                       $query->equals('version', $version),
+                       $query->greaterThanOrEqual('reviewState', 0)
+               ));
                return $query->setLimit(1)->execute()->getFirst();
        }
 
@@ -143,7 +147,7 @@ class ExtensionRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
                                        OR
                                        title LIKE ' . $quotedSearchStringForLike . '
                                )
-                               AND current_version=1
+                               AND current_version=1 AND review_state >= 0
                                HAVING position > 0';
                $order = 'position desc';
                $result = $this->databaseConnection->exec_SELECTgetRows($select, $from, $where, '', $order);
@@ -254,9 +258,16 @@ class ExtensionRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
         */
        protected function addDefaultConstraints(\TYPO3\CMS\Extbase\Persistence\Generic\Query $query) {
                if ($query->getConstraint()) {
-                       $query->matching($query->logicalAnd($query->getConstraint(), $query->equals('current_version', TRUE)));
+                       $query->matching($query->logicalAnd(
+                               $query->getConstraint(),
+                               $query->equals('current_version', TRUE),
+                               $query->greaterThanOrEqual('reviewState', 0)
+                       ));
                } else {
-                       $query->matching($query->equals('current_version', TRUE));
+                       $query->matching($query->logicalAnd(
+                               $query->equals('current_version', TRUE),
+                               $query->greaterThanOrEqual('reviewState', 0)
+                       ));
                }
                return $query;
        }