summaryrefslogtreecommitdiff
path: root/app/Console
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2017-01-28 10:50:25 -0500
committerFrederic Guillot <fred@kanboard.net>2017-01-28 10:50:25 -0500
commit9357b3a4ec64fbcca58967d0319065de7d363560 (patch)
treee49c00881e4829543af80cd9c4ecfe80348670ab /app/Console
parent20832b439d16510bad1ac607fe5db9b338d11ea7 (diff)
Add command to execute individual job
Diffstat (limited to 'app/Console')
-rw-r--r--app/Console/JobCommand.php35
1 files changed, 35 insertions, 0 deletions
diff --git a/app/Console/JobCommand.php b/app/Console/JobCommand.php
new file mode 100644
index 00000000..bdaae32f
--- /dev/null
+++ b/app/Console/JobCommand.php
@@ -0,0 +1,35 @@
+<?php
+
+namespace Kanboard\Console;
+
+use Kanboard\Core\Queue\JobHandler;
+use SimpleQueue\Job;
+use Symfony\Component\Console\Input\InputInterface;
+use Symfony\Component\Console\Output\OutputInterface;
+
+/**
+ * Class JobCommand
+ *
+ * @package Kanboard\Console
+ * @author Frederic Guillot
+ */
+class JobCommand extends BaseCommand
+{
+ protected function configure()
+ {
+ $this
+ ->setName('job')
+ ->setDescription('Execute individual job (read payload from stdin)')
+ ;
+ }
+
+ protected function execute(InputInterface $input, OutputInterface $output)
+ {
+ $payload = fgets(STDIN);
+
+ $job = new Job();
+ $job->unserialize($payload);
+
+ JobHandler::getInstance($this->container)->executeJob($job);
+ }
+}