Completed
Push — master ( 24a68b...bc84ac )
by Thomas
22:37 queued 09:54
created

CleanupPersistentFileLocks   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 28
rs 10
c 0
b 0
f 0
wmc 2
lcom 1
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A run() 0 3 1
1
<?php
2
/**
3
 * @author Thomas Müller <[email protected]>
4
 *
5
 * @copyright Copyright (c) 2018, ownCloud GmbH
6
 * @license AGPL-3.0
7
 *
8
 * This code is free software: you can redistribute it and/or modify
9
 * it under the terms of the GNU Affero General Public License, version 3,
10
 * as published by the Free Software Foundation.
11
 *
12
 * This program is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
 * GNU Affero General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU Affero General Public License, version 3,
18
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
19
 *
20
 */
21
22
namespace OCA\Files\BackgroundJob;
23
24
use OC\BackgroundJob\TimedJob;
25
use OC\Lock\Persistent\LockMapper;
26
27
/**
28
 * Clean up persistent file locks that are expired
29
 */
30
class CleanupPersistentFileLocks extends TimedJob {
31
32
	/**
33
	 * Default interval in minutes
34
	 *
35
	 * @var int $defaultIntervalMin
36
	 **/
37
	protected $defaultIntervalMin = 30;
38
	/** @var LockMapper */
39
	private $lockMapper;
40
41
	/**
42
	 * CleanupPersistentFileLocks constructor.
43
	 *
44
	 * @param LockMapper $lockMapper
45
	 */
46
	public function __construct(LockMapper $lockMapper) {
47
		$this->interval = $this->defaultIntervalMin * 60;
48
		$this->lockMapper = $lockMapper;
49
	}
50
51
	/**
52
	 * @param $argument
53
	 */
54
	public function run($argument) {
55
		$this->lockMapper->cleanup();
56
	}
57
}
58