|
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
|
|
|
|