synolia / sylius-scheduler-command-plugin
调度命令插件。
v3.6.0
2023-09-15 14:44 UTC
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-09-12 12:36:12 UTC
README
调度命令插件
在您的Sylius管理面板中安排Symfony命令。
命令列表
安排的命令列表
特性
- 查看计划中的命令列表
- 添加、编辑、启用/禁用或删除安排的命令
- 对于每个命令,您必须定义
- 名称
- 从Symfony命令列表中选择指定的命令
- 基于Cron计划表达式,请参阅Cron格式
- 输出日志文件前缀(可选)
- 优先级(最高优先级)
- 立即运行命令(在命令
synolia:scheduler-run
的下一次通过时) - 只运行一次命令(从历史页面点击
启动命令
按钮) - 直接从管理面板下载或实时查看日志文件
- 使用工厂定义命令(例如从Doctrine迁移)
要求
安装
-
在您的composer.json中添加包及其依赖项
composer config extra.symfony.allow-contrib true composer req synolia/sylius-scheduler-command-plugin
-
将迁移应用于您的数据库
bin/console doctrine:migrations:migrate
-
在Crontab中启动Run命令
* * * * * /_PROJECT_DIRECTORY_/bin/console synolia:scheduler-run
-
(可选)显示人性化的cron表达式
composer require lorisleiva/cron-translator
-
直到
symfony/recipes-contrib
更新到v3,您必须按照相同的文件夹架构将install/Application/config/{packages,routes}
中的sylius_scheduler_command.yaml
添加到您的项目中。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/
使用方法
- 登录到管理面板
- 在主菜单中点击“安排命令”部分下的“安排的命令”来管理您的安排命令
- 在主菜单中点击“安排命令历史”部分下的“安排的命令历史”来查看命令的历史
数据集
在sylius数据集文件config/packages/sylius_fixtures.yaml
中,您可以添加安排命令数据集到您的测试套件。
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
命令
synolia:scheduler-run
执行安排的命令。
- 选项
- –id(只运行特定的安排命令)
运行所有安排的命令: php bin/console synolia:scheduler-run
运行一个安排的命令: php bin/console synolia:scheduler-run –id=5
synolia:scheduler:purge-history
清除超过{X}天旧的安排命令历史。
- 选项
- –all(清除所有内容)
- –days(保留天数)
- –state(安排状态的数组)
- –dry-run
示例:在7天后删除所有完成和错误的安排命令
php bin/console synolia:scheduler:purge-history --state=finished --state=error --days=7
可选服务
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
开发
查看如何贡献。
许可证
此库受MIT许可证的约束。
鸣谢
由Synolia开发。