summaryrefslogtreecommitdiff
path: root/app/Console/JobCommand.php
blob: bdaae32f2547f5c3fc5ce3d809d91993024ba962 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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);
    }
}