Completed
Pull Request — master (#362)
by Maxence
02:54
created

GlobalSync::run()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.9
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php declare(strict_types=1);
2
3
4
/**
5
 * Circles - Bring cloud-users closer together.
6
 *
7
 * This file is licensed under the Affero General Public License version 3 or
8
 * later. See the COPYING file.
9
 *
10
 * @author Maxence Lange <[email protected]>
11
 * @copyright 2017
12
 * @license GNU AGPL version 3 or any later version
13
 *
14
 * This program is free software: you can redistribute it and/or modify
15
 * it under the terms of the GNU Affero General Public License as
16
 * published by the Free Software Foundation, either version 3 of the
17
 * License, or (at your option) any later version.
18
 *
19
 * This program is distributed in the hope that it will be useful,
20
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22
 * GNU Affero General Public License for more details.
23
 *
24
 * You should have received a copy of the GNU Affero General Public License
25
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
26
 *
27
 */
28
29
30
namespace OCA\Circles\Cron;
31
32
33
use OC\BackgroundJob\TimedJob;
34
use OCA\Circles\AppInfo\Application;
35
use OCA\Circles\Exceptions\GSStatusException;
36
use OCA\Circles\Service\GSUpstreamService;
37
use OCP\AppFramework\QueryException;
38
39
40
/**
41
 * Class GlobalSync
42
 *
43
 * @package OCA\Cicles\Cron
44
 */
45
class GlobalSync extends TimedJob {
46
47
48
	/**
49
	 * Cache constructor.
50
	 */
51
	public function __construct() {
52
		$this->setInterval(10);
53
	}
54
55
56
	/**
57
	 * @param $argument
58
	 *
59
	 * @throws QueryException
60
	 */
61
	protected function run($argument) {
62
		$app = new Application();
63
		$c = $app->getContainer();
64
65
		/** @var GSUpstreamService $gsUpstreamService */
66
		$gsUpstreamService = $c->query(GSUpstreamService::class);
67
		try {
68
			$gsUpstreamService->synchronize();
69
		} catch (GSStatusException $e) {
0 ignored issues
show
Coding Style Comprehensibility introduced by
Consider adding a comment why this CATCH block is empty.
Loading history...
70
		}
71
	}
72
73
}
74
75