Completed
Push — master ( 047b73...cb7aa6 )
by Robbie
11s
created

NightlyUpdatesCron::getSchedule()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/**
4
 * These nightly updates can clean up anything that might have been missed by the other tasks
5
 */
6
class NightlyUpdatesCron implements CronTask
7
{
8
9
    /**
10
     * Run at 1am every morning
11
     *
12
     * @return string
13
     */
14
    public function getSchedule()
15
    {
16
        return "0 1 * * *";
17
    }
18
19
    /**
20
     * Run the build task to update addons
21
     * @return void
22
     */
23
    public function process()
24
    {
25
        $taskClasses = [
26
            [BuildAddonsTask::class, null], // rebuild all addons
27
        ];
28
29 View Code Duplication
        foreach ($taskClasses as $taskInfo) {
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
30
            list($taskClass, $taskQuerystring) = $taskInfo;
31
            $job = new RunBuildTaskJob($taskClass, $taskQuerystring);
32
            $jobID = Injector::inst()->get(QueuedJobService::class)->queueJob($job);
33
            echo 'Added ' . $taskClass . ' to job queue (job ID ' . $jobID . ")\n";
34
        }
35
    }
36
}
37