Skip to content

Commit

Permalink
[BUGFIX] Fix #55: exception when page end date is in the past
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Dulepov committed Feb 8, 2023
1 parent 4f88ab7 commit 434f2d0
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions Classes/Utility/BackendUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 434f2d0

Please sign in to comment.