From 434f2d0a5f859b0c2d5ce90e5d31374a11b29305 Mon Sep 17 00:00:00 2001 From: Dmitry Dulepov Date: Wed, 8 Feb 2023 16:51:32 +0300 Subject: [PATCH] [BUGFIX] Fix #55: exception when page end date is in the past --- Classes/Utility/BackendUtility.php | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/Classes/Utility/BackendUtility.php b/Classes/Utility/BackendUtility.php index 9a83589..aab26d3 100644 --- a/Classes/Utility/BackendUtility.php +++ b/Classes/Utility/BackendUtility.php @@ -40,24 +40,16 @@ public static function filterPagesForAccess(array $pids) if (!self::isBackendAdmin()) { $pageRepository = GeneralUtility::makeInstance(PageRepository::class); - /** - * @todo check if this if block can be deleted - */ - $t3Version = GeneralUtility::makeInstance(Typo3Version::class); - - if (version_compare($t3Version->getBranch(), '10', '<')) { - $expressionBuilder = GeneralUtility::makeInstance(ConnectionPool::class) - ->getQueryBuilderForTable('pages') - ->expr() - ; - $oldExpression = $expressionBuilder->lt('pages.doktype', 200); - $newExpression = $expressionBuilder->neq('pages.doktype', PageRepository::DOKTYPE_RECYCLER); - $pageRepository->where_hid_del = str_replace( - $oldExpression, - $newExpression, - $pageRepository->where_hid_del - ); - } + // Make sure that we fetch all pages exept deleted and recyclers + $expressionBuilder = GeneralUtility::makeInstance(ConnectionPool::class) + ->getQueryBuilderForTable('pages') + ->expr() + ; + $visibilityCondition = $expressionBuilder->andX( + $expressionBuilder->neq('pages.doktype', PageRepository::DOKTYPE_RECYCLER), + $expressionBuilder->eq('pages.deleted', 0) + ); + $pageRepository->where_hid_del = (string)$visibilityCondition; $newPids = []; foreach ($pids as $pid) {