Skip to content

Commit 23b38b0

Browse files
committed
NGSTACK-913 prevent trashed content being processed in command
1 parent c11032b commit 23b38b0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

bundle/Command/ScheduledVisibilityUpdateCommand.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException;
1212
use Ibexa\Contracts\Core\Repository\LanguageService;
1313
use Ibexa\Contracts\Core\Repository\Repository;
14+
use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo;
1415
use Ibexa\Contracts\Core\Repository\Values\Content\Language;
1516
use Netgen\Bundle\IbexaScheduledVisibilityBundle\Core\Configuration;
1617
use Netgen\Bundle\IbexaScheduledVisibilityBundle\Core\Exception\InvalidStateException;
@@ -30,6 +31,7 @@
3031

3132
use function count;
3233
use function sprintf;
34+
use function time;
3335

3436
final class ScheduledVisibilityUpdateCommand extends Command
3537
{
@@ -205,8 +207,10 @@ private function getQueryBuilder(?int $since, array $contentTypeIds): QueryBuild
205207
->select('id', 'initial_language_id')
206208
->from('ezcontentobject')
207209
->where('published != :unpublished')
210+
->andWhere('status != :trashed')
208211
->orderBy('id', 'ASC')
209-
->setParameter('unpublished', 0);
212+
->setParameter('unpublished', 0)
213+
->setParameter('trashed', ContentInfo::STATUS_TRASHED);
210214

211215
$this->applySince($queryBuilder, $since);
212216
$this->applyContentTypes($queryBuilder, $contentTypeIds);
@@ -254,6 +258,7 @@ private function getPager(?int $since): Pagerfanta
254258
->from('ezcontentobject')
255259
->where('published != :unpublished')
256260
->setParameter('unpublished', 0)
261+
->setParameter('trashed', ContentInfo::STATUS_TRASHED)
257262
->setMaxResults(1);
258263

259264
$this->applySince($queryBuilder, $since);

0 commit comments

Comments
 (0)