Skip to content

Commit 9afcfa3

Browse files
committed
feature #49795 add debug:scheduler command (kbond)
This PR was squashed before being merged into the 6.3 branch. Discussion ---------- add `debug:scheduler` command | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | n/a | License | MIT | Doc PR | todo Example output: ``` Scheduler ========= default ------- ---------------------- ------------------- --------------------------- Message Trigger Next Run ---------------------- ------------------- --------------------------- stdClass cron: 10 10 5 2 0 2024-02-04T10:10:00-05:00 generate user report cron: 0 0 * * * 2023-03-25T00:00:00-04:00 ---------------------- ------------------- --------------------------- ``` The output is helped if the trigger and message implement `\Stringable`. I've made `CronExpressionTrigger` stringable but I think we should have all the packaged triggers implement. Commits ------- 398e2b2708 add `debug:scheduler` command
2 parents 7699822 + b304deb commit 9afcfa3

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

DependencyInjection/FrameworkExtension.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2016,6 +2016,10 @@ private function registerSchedulerConfiguration(array $config, ContainerBuilder
20162016
}
20172017

20182018
$loader->load('scheduler.php');
2019+
2020+
if (!$this->hasConsole()) {
2021+
$container->removeDefinition('console.command.scheduler_debug');
2022+
}
20192023
}
20202024

20212025
private function registerMessengerConfiguration(array $config, ContainerBuilder $container, PhpFileLoader $loader, bool $validationEnabled): void

Resources/config/console.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,14 @@
4242
use Symfony\Component\Console\EventListener\ErrorListener;
4343
use Symfony\Component\Dotenv\Command\DebugCommand as DotenvDebugCommand;
4444
use Symfony\Component\Messenger\Command\ConsumeMessagesCommand;
45-
use Symfony\Component\Messenger\Command\DebugCommand;
45+
use Symfony\Component\Messenger\Command\DebugCommand as MessengerDebugCommand;
4646
use Symfony\Component\Messenger\Command\FailedMessagesRemoveCommand;
4747
use Symfony\Component\Messenger\Command\FailedMessagesRetryCommand;
4848
use Symfony\Component\Messenger\Command\FailedMessagesShowCommand;
4949
use Symfony\Component\Messenger\Command\SetupTransportsCommand;
5050
use Symfony\Component\Messenger\Command\StatsCommand;
5151
use Symfony\Component\Messenger\Command\StopWorkersCommand;
52+
use Symfony\Component\Scheduler\Command\DebugCommand as SchedulerDebugCommand;
5253
use Symfony\Component\Translation\Command\TranslationPullCommand;
5354
use Symfony\Component\Translation\Command\TranslationPushCommand;
5455
use Symfony\Component\Translation\Command\XliffLintCommand;
@@ -172,7 +173,7 @@
172173
])
173174
->tag('console.command')
174175

175-
->set('console.command.messenger_debug', DebugCommand::class)
176+
->set('console.command.messenger_debug', MessengerDebugCommand::class)
176177
->args([
177178
[], // Message to handlers mapping
178179
])
@@ -218,6 +219,12 @@
218219
])
219220
->tag('console.command')
220221

222+
->set('console.command.scheduler_debug', SchedulerDebugCommand::class)
223+
->args([
224+
tagged_locator('scheduler.schedule_provider', 'name'),
225+
])
226+
->tag('console.command')
227+
221228
->set('console.command.router_debug', RouterDebugCommand::class)
222229
->args([
223230
service('router'),

0 commit comments

Comments
 (0)