summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/Console/JobCommand.php35
-rw-r--r--app/Core/Queue/QueueManager.php2
-rw-r--r--app/ServiceProvider/CommandProvider.php2
3 files changed, 38 insertions, 1 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);
+ }
+}
diff --git a/app/Core/Queue/QueueManager.php b/app/Core/Queue/QueueManager.php
index dcf0ebf5..1d7c2d1e 100644
--- a/app/Core/Queue/QueueManager.php
+++ b/app/Core/Queue/QueueManager.php
@@ -64,7 +64,7 @@ class QueueManager extends Base
public function listen()
{
if ($this->queue === null) {
- throw new LogicException('No queue driver defined!');
+ throw new LogicException('No queue driver defined or unable to connect to broker!');
}
while ($job = $this->queue->pull()) {
diff --git a/app/ServiceProvider/CommandProvider.php b/app/ServiceProvider/CommandProvider.php
index c9abb294..f17ba352 100644
--- a/app/ServiceProvider/CommandProvider.php
+++ b/app/ServiceProvider/CommandProvider.php
@@ -5,6 +5,7 @@ namespace Kanboard\ServiceProvider;
use Kanboard\Console\CronjobCommand;
use Kanboard\Console\DatabaseMigrationCommand;
use Kanboard\Console\DatabaseVersionCommand;
+use Kanboard\Console\JobCommand;
use Kanboard\Console\LocaleComparatorCommand;
use Kanboard\Console\LocaleSyncCommand;
use Kanboard\Console\PluginInstallCommand;
@@ -52,6 +53,7 @@ class CommandProvider implements ServiceProviderInterface
$application->add(new TaskTriggerCommand($container));
$application->add(new CronjobCommand($container));
$application->add(new WorkerCommand($container));
+ $application->add(new JobCommand($container));
$application->add(new ResetPasswordCommand($container));
$application->add(new ResetTwoFactorCommand($container));
$application->add(new PluginUpgradeCommand($container));