synolia / sylius-scheduler-command-plugin
Scheduler Command Plugin.
Installs: 257 481
Dependents: 0
Suggesters: 0
Security: 0
Stars: 31
Watchers: 12
Forks: 20
Open Issues: 11
Type:sylius-plugin
Requires
- php: ^8.0
- ext-intl: *
- ext-json: *
- dragonmantank/cron-expression: ^3.0
- sylius/sylius: ^1.10
- symfony/framework-bundle: ^5.4|^6.0
- symfony/lock: ^5.4|^6.0
- symfony/polyfill-intl-icu: ^1.26
- symfony/process: ^5.4|^6.0
- symfony/service-contracts: ^1.1|^2.0|^3.0
- webmozart/assert: ^1.10
Requires (Dev)
- behat/behat: 3.12.0
- behat/mink-selenium2-driver: 1.6.0
- dmore/behat-chrome-extension: 1.4.0
- dmore/chrome-mink-driver: 2.9.0
- friends-of-behat/mink: 1.10.0
- friends-of-behat/mink-browserkit-driver: 1.6.1
- friends-of-behat/mink-debug-extension: 2.1.0
- friends-of-behat/mink-extension: 2.7.2
- friends-of-behat/page-object-extension: 0.3.2
- friends-of-behat/suite-settings-extension: 1.1.0
- friends-of-behat/symfony-extension: 2.4.0
- friends-of-behat/variadic-extension: 1.5.0
- friendsoftwig/twigcs: 6.0.0
- j13k/yaml-lint: 1.1.4
- php-parallel-lint/php-parallel-lint: 1.3.2
- phpmd/phpmd: 2.13.0
- phpro/grumphp: 1.15.0
- phpspec/phpspec: 7.3.0
- phpstan/extension-installer: 1.2.0
- phpstan/phpstan: 1.9.5
- phpstan/phpstan-doctrine: 1.3.28
- phpstan/phpstan-strict-rules: 1.4.4
- phpstan/phpstan-webmozart-assert: 1.2.2
- phpunit/phpunit: 9.5.27
- rector/rector: ^0.15.2
- sebastian/phpcpd: 6.0.3
- seld/jsonlint: 1.9.0
- slevomat/coding-standard: 8.7.1
- sylius-labs/coding-standard: 4.3.0
- symfony/browser-kit: 6.0.11
- symfony/debug-bundle: 6.0.11
- symfony/dotenv: 6.0.5
- symfony/intl: 6.0.15
- symfony/web-profiler-bundle: 6.0.17
- symplify/easy-coding-standard: 11.1.32.72
Suggests
- lorisleiva/cron-translator: Allow showing humanized and translated cron expression.
- dev-master
- v3.6.0
- v3.5.0
- v3.4.2
- v3.4.1
- v3.4.0
- v3.3.0
- v3.2.0
- v3.1.0
- v3.0.1
- v3.0.0
- v2.2.0
- v2.1.0
- v2.0.1
- v2.0.0
- v1.1.4
- v1.1.3
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- dev-fix/+92-live-logs
- dev-allow-logs-dir-overwrite
- dev-feature/async-runner
- dev-feature/compatibility-sylius-1-11-php-8-1
- dev-upgrade-minimal-php-version
- dev-feature/added-new-ecs-rules
- dev-fix/ci
This package is auto-updated.
Last update: 2024-12-12 13:09:48 UTC
README
Scheduler Command Plugin
Schedule Symfony Commands in your Sylius admin panel.
Commands list
Scheduled Commands list
Features
- See the list of planned command
- Add, edit, enable/disable or delete scheduled commands
- For each command, you have to define :
- Name
- Selected Command from the list of Symfony commands
- Based on Cron schedule expression see Cron formats
- Output Log file prefix (optional)
- Priority (highest is priority)
- Run the Command immediately (at the next passage of the command
synolia:scheduler-run
) - Run a Command juste one time (from history page clic on
Launch a command
button) - Download or live view of log files directly from the admin panel
- Define commands with a Factory (from a Doctrine migration, for example)
Requirements
Installation
-
Add the bundle and dependencies in your composer.json :
composer config extra.symfony.allow-contrib true composer req synolia/sylius-scheduler-command-plugin
-
Apply migrations to your database:
bin/console doctrine:migrations:migrate
-
Launch Run command in your Crontab
* * * * * /_PROJECT_DIRECTORY_/bin/console synolia:scheduler-run
-
(optional) Showing humanized cron expression
composer require lorisleiva/cron-translator
-
Till
symfony/recipes-contrib
is updated for the v3, you must addsylius_scheduler_command.yaml
frominstall/Application/config/{packages,routes}
to your project by respecting the same folder architecture.cp -R vendor/synolia/sylius-scheduler-command-plugin/install/Application/config/packages/* config/packages/ cp -R vendor/synolia/sylius-scheduler-command-plugin/install/Application/config/routes/* config/routes/
Usage
- Log into admin panel
- Click on
Scheduled commands
in the Scheduled commands section in main menu to manage your Scheduled commands - Click on
Scheduled commands history
in the Scheduled commands section in main menu to see history of commands
Fixtures
Inside sylius fixture file config/packages/sylius_fixtures.yaml
you can add scheduled command fixtures to your suite.
sylius_fixtures: suites: my_fixture_suite: fixtures: scheduler_command: options: scheduled_commands: - name: 'Reset Sylius' command: 'sylius:fixtures:load' cronExpression: '0 0 * * *' logFilePrefix: 'reset' priority: 0 enabled: true - name: 'Cancel Unpaid Orders' command: 'sylius:cancel-unpaid-orders' cronExpression: '0 0 * * *' priority: 1 enabled: false
Commands
synolia:scheduler-run
Execute scheduled commands.
- options:
- --id (run only a specific scheduled command)
Run all scheduled commands : php bin/console synolia:scheduler-run
Run one scheduled command : php bin/console synolia:scheduler-run --id=5
synolia:scheduler:purge-history
Purge scheduled command history greater than {X} days old.
- options:
- --all (purge everything)
- --days (number of days to keep)
- --state (array of schedule states)
- --dry-run
Example to remove all finished and in error scheduled commands after 7 days :
php bin/console synolia:scheduler:purge-history --state=finished --state=error --days=7
Optional services
services: ... # By enabling this service, it will be requested to vote after the other EveryMinuteIsDueChecker checker. # Using some cloud providers, even if the master cron is set to run every minute, it is actually not run that often # This service allows you to set a soft threshold limit, so if your provider is actually running the master cron every 5 minutes # This service will execute the cron if we are still in the threshold limit ONLY IF it was not already executed another time in the same range. # # CONFIGURATION SCENARIO: cron set to be run at 01:07 in the scheduler command plugin # # SCENARIO CASES AT 1 CRON PASS EVERY 5 MINUTES FROM THE PROVIDER # cron passes at 01:04 - 1..5 minutes: IS NOT DUE # cron passes at 01:05 - 1..5 minutes: IS NOT DUE # cron passes at 01:06 - 1..5 minutes: IS NOT DUE # cron passes at 01:07 - 1..5 minutes: IS DUE (but it should already be handled by EveryMinuteIsDueChecker) # cron passes at 01:08 - 1..5 minutes: IS DUE # cron passes at 01:09 - 1..5 minutes: IS DUE #should not if another has started during the threshold period # cron passes at 01:10 - 1..5 minutes: IS DUE #should not if another has started during the threshold period # cron passes at 01:11 - 1..5 minutes: IS DUE #should not if another has started during the threshold period # cron passes at 01:12 - 1..5 minutes: IS DUE #should not if another has started during the threshold period # cron passes at 01:13 - 1..5 minutes: IS NOT DUE Synolia\SyliusSchedulerCommandPlugin\Checker\SoftLimitThresholdIsDueChecker: tags: - { name: !php/const Synolia\SyliusSchedulerCommandPlugin\Checker\IsDueCheckerInterface::TAG_ID } #optionnal, default value is 5 minutes arguments: $threshold: 5 #soft limit threshold in minutes
Development
See How to contribute.
License
This library is under the MIT license.
Credits
Developed by Synolia.