Completed
Pull Request — master (#99)
by
unknown
02:38
created

CheckForUpdatesJob::process()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace BringYourOwnIdeas\Maintenance\Jobs;
4
5
use BringYourOwnIdeas\Maintenance\Tasks\UpdatePackageInfoTask;
6
use Symbiote\QueuedJobs\Services\QueuedJob;
7
use SilverStripe\Core\Injector\Injector;
8
use Symbiote\QueuedJobs\Services\AbstractQueuedJob;
9
10
/**
11
 * Refresh report job. Runs as a queued job.
12
 *
13
 */
14
class CheckForUpdatesJob extends AbstractQueuedJob implements QueuedJob
15
{
16
    /**
17
     * Define the title
18
     *
19
     * @return string
20
     */
21
    public function getTitle()
22
    {
23
        return _t(__CLASS__ . '.TITLE', 'Check for updates to installed modules');
24
    }
25
26
    /**
27
     * Define the type.
28
     */
29
    public function getJobType()
30
    {
31
        $this->totalSteps = 1;
32
        return QueuedJob::QUEUED;
33
    }
34
35
    /**
36
     * Processes the task as a job
37
     */
38
    public function process()
39
    {
40
        // Run the UpdatePackageInfo task
41
        $updateTask = Injector::inst()->create(UpdatePackageInfoTask::class);
42
        $updateTask->run(null);
43
44
        // mark job as completed
45
        $this->isComplete = true;
46
    }
47
}
48