Completed
Pull Request — master (#78)
by
unknown
01:54
created

CheckForUpdatesJob::getTitle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 5
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(
24
            'CheckForUpdates.TITLE',
25
            'Check for updates'
26
        );
27
    }
28
29
    /**
30
     * Define the type.
31
     */
32
    public function getJobType()
33
    {
34
        $this->totalSteps = 1;
35
        return QueuedJob::QUEUED;
36
    }
37
38
    /**
39
     * Create the instance of the task
40
     */
41
    public function setup()
42
    {
43
        $this->task = Injector::inst()->create(CheckForUpdatesJob::class);
0 ignored issues
show
Bug Best Practice introduced by
The property task does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
44
    }
45
46
    /**
47
     * Processes the task as a job
48
     */
49
    public function process()
50
    {
51
        // Run the UpdatePackageInfo task
52
        $updateTask = Injector::inst()->create(UpdatePackageInfoTask::class);
53
        $updateTask->run(null);
54
55
        // mark job as completed
56
        $this->isComplete = true;
57
    }
58
}
59