-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
API Update API to reflect changes to CLI interaction
- Loading branch information
1 parent
feedb5f
commit dde7a1e
Showing
14 changed files
with
283 additions
and
238 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
Name: queuedjobs-cli | ||
--- | ||
SilverStripe\Cli\Sake: | ||
commands: | ||
- 'Symbiote\QueuedJobs\Cli\ProcessJobQueueChildCommand' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
namespace Symbiote\QueuedJobs\Cli; | ||
|
||
use Symbiote\QueuedJobs\Services\QueuedJobService; | ||
use Symfony\Component\Console\Attribute\AsCommand; | ||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputArgument; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
#[AsCommand('queuedjobs:process-queue-child', hidden: true)] | ||
class ProcessJobQueueChildCommand extends Command | ||
{ | ||
protected function execute(InputInterface $input, OutputInterface $output): int | ||
{ | ||
$task = @unserialize(@base64_decode($input->getArgument('base64-task'))); | ||
if ($task) { | ||
$this->getService()->runJob($task->getDescriptor()->ID); | ||
} | ||
return Command::SUCCESS; | ||
} | ||
|
||
/** | ||
* Returns an instance of the QueuedJobService. | ||
* | ||
* @return QueuedJobService | ||
*/ | ||
protected function getService() | ||
{ | ||
return QueuedJobService::singleton(); | ||
} | ||
|
||
protected function configure() | ||
{ | ||
$this->addArgument('base64-task', InputArgument::REQUIRED); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.