Task::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 3
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
/**
3
 * ownCloud - Files_antivirus
4
 *
5
 * This file is licensed under the Affero General Public License version 3 or
6
 * later.See the COPYING file.
7
 *
8
 * @author Viktar Dubiniuk <[email protected]>
9
 *
10
 * @copyright Viktar Dubiniuk 2015-2018
11
 * @license AGPL-3.0
12
 */
13
14
namespace OCA\Files_Antivirus\Cron;
15
16
use OC\BackgroundJob\TimedJob;
17
use OCA\Files_Antivirus\AppInfo\Application;
18
19
class Task extends TimedJob {
20
21
	/**
22
	 * sets the correct interval for this timed job
23
	 */
24
	public function __construct() {
25
		// Run once per 15 minutes
26
		$this->setInterval(60 * 15);
27
	}
28
29
	/**
30
	 * @param string $argument
31
	 *
32
	 * @return void
33
	 */
34
	protected function run($argument) {
35
		if (!\OCP\App::isEnabled('files_antivirus')) {
36
			return;
37
		}
38
39
		$application = new Application();
40
		$container = $application->getContainer();
41
		$container->query('BackgroundScanner')->run();
42
	}
43
}
44