Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ibexa scheduled visibility fixes #5

Merged
merged 3 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,49 +8,49 @@

$config = new PhpCsFixer\Config();
return $config
->setRiskyAllowed(true)
->setRules([
'@PSR12' => true,
'@PSR12:risky' => true,
'@PER' => true,
'@PER:risky' => true,
'@PhpCsFixer' => true,
'@PhpCsFixer:risky' => true,

// Overrides for rules included in PhpCsFixer rule sets
'concat_space' => ['spacing' => 'one'],
'fully_qualified_strict_types' => ['phpdoc_tags' => []],
'method_chaining_indentation' => false,
'multiline_whitespace_before_semicolons' => false,
'native_function_invocation' => ['include' => ['@all']],
'no_superfluous_phpdoc_tags' => false,
'no_unset_on_property' => false,
'ordered_imports' => ['imports_order' => ['class', 'function', 'const'], 'sort_algorithm' => 'alpha'],
'ordered_types' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'alpha'],
'php_unit_internal_class' => false,
'php_unit_test_case_static_method_calls' => ['call_type' => 'self'],
'php_unit_test_class_requires_covers' => false,
'phpdoc_align' => false,
'phpdoc_order' => ['order' => ['param', 'throws', 'return']],
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
'single_line_comment_style' => false,
'trailing_comma_in_multiline' => ['elements' => ['arrays', 'arguments']],
'trailing_comma_in_multiline' => ['elements' => ['arrays', 'arguments', 'match', 'parameters']],
'yoda_style' => false,
'php_unit_strict' => false,
'php_unit_test_annotation' => false,

// Additional rules
'return_assignment' => false,
'date_time_immutable' => true,
'declare_strict_types' => true,
'global_namespace_import' => [
'import_classes' => null,
'import_constants' => true,
'import_functions' => true,
],
'list_syntax' => ['syntax' => 'short'],
'heredoc_indentation' => ['indentation' => 'same_as_start'],
'mb_str_functions' => true,
'native_constant_invocation' => true,
'nullable_type_declaration_for_default_null_value' => true,
'static_lambda' => true,
'ternary_to_null_coalescing' => true,
'use_arrow_functions' => true,
])
])
->setRiskyAllowed(true)
->setFinder($finder)
;
7 changes: 6 additions & 1 deletion bundle/Command/ScheduledVisibilityUpdateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException;
use Ibexa\Contracts\Core\Repository\LanguageService;
use Ibexa\Contracts\Core\Repository\Repository;
use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo;
use Ibexa\Contracts\Core\Repository\Values\Content\Language;
use Netgen\Bundle\IbexaScheduledVisibilityBundle\Core\Configuration;
use Netgen\Bundle\IbexaScheduledVisibilityBundle\Core\Exception\InvalidStateException;
Expand All @@ -30,6 +31,7 @@

use function count;
use function sprintf;
use function time;

final class ScheduledVisibilityUpdateCommand extends Command
{
Expand Down Expand Up @@ -205,8 +207,10 @@ private function getQueryBuilder(?int $since, array $contentTypeIds): QueryBuild
->select('id', 'initial_language_id')
->from('ezcontentobject')
->where('published != :unpublished')
->andWhere('status != :trashed')
->orderBy('id', 'ASC')
->setParameter('unpublished', 0);
->setParameter('unpublished', 0)
->setParameter('trashed', ContentInfo::STATUS_TRASHED);

$this->applySince($queryBuilder, $since);
$this->applyContentTypes($queryBuilder, $contentTypeIds);
Expand Down Expand Up @@ -254,6 +258,7 @@ private function getPager(?int $since): Pagerfanta
->from('ezcontentobject')
->where('published != :unpublished')
->setParameter('unpublished', 0)
->setParameter('trashed', ContentInfo::STATUS_TRASHED)
->setMaxResults(1);

$this->applySince($queryBuilder, $since);
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ By default it is set to 1024.
The command also has a ``since`` option that limits processing to content items modified since the given number of days.
By default it is not set, which means all items will be processed.
Command can be executed with: ``bin/console ngscheduledvisibility:update``.
For this mechanism to work how it was intended, this command should be set as cron job.
For this mechanism to work how it was intended, this command should be set as cron job with ``--no-interaction`` option.
Loading