Skip to content

Commit

Permalink
--job-id option
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonkelly committed Feb 2, 2024
1 parent 505301a commit ca8602c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG-WIP.md
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
# Release notes for Craft CMS 4.8.0 (WIP)

### Administration
- The `queue/run` command now supports a `--job-id` option.
22 changes: 22 additions & 0 deletions src/queue/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ class Command extends \yii\queue\cli\Command
{
use ControllerTrait;

/**
* @var string The job ID to run
* @since 4.8.0
*/
public ?string $jobId = null;

/**
* @var Queue
*/
Expand All @@ -40,6 +46,18 @@ class Command extends \yii\queue\cli\Command
'class' => VerboseBehavior::class,
];

/**
* @inheritdoc
*/
public function options($actionID)
{
$options = parent::options($actionID);
if ($actionID === 'run') {
$options[] = 'jobId';
}
return $options;
}

/**
* @inheritdoc
*/
Expand All @@ -65,6 +83,10 @@ public function actions(): array
*/
public function actionRun(): int
{
if ($this->jobId) {
return $this->queue->executeJob($this->jobId) ? ExitCode::OK : ExitCode::UNSPECIFIED_ERROR;
}

return $this->queue->run() ?? ExitCode::OK;
}

Expand Down

0 comments on commit ca8602c

Please sign in to comment.