1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @author Thomas Müller <[email protected]> |
4
|
|
|
* @copyright Copyright (c) 2018, ownCloud GmbH |
5
|
|
|
* @license AGPL-3.0 |
6
|
|
|
* |
7
|
|
|
* This code is free software: you can redistribute it and/or modify |
8
|
|
|
* it under the terms of the GNU Affero General Public License, version 3, |
9
|
|
|
* as published by the Free Software Foundation. |
10
|
|
|
* |
11
|
|
|
* This program is distributed in the hope that it will be useful, |
12
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14
|
|
|
* GNU Affero General Public License for more details. |
15
|
|
|
* |
16
|
|
|
* You should have received a copy of the GNU Affero General Public License, version 3, |
17
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/> |
18
|
|
|
*/ |
19
|
|
|
|
20
|
|
|
namespace OC\Lock\Persistent; |
21
|
|
|
|
22
|
|
|
use OCP\AppFramework\Db\Entity; |
23
|
|
|
use OCP\Lock\Persistent\ILock; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Class Lock |
27
|
|
|
* |
28
|
|
|
* @method int getFileId() |
29
|
|
|
* @method string getOwner() |
30
|
|
|
* @method int getTimeout() |
31
|
|
|
* @method int getCreatedAt() |
32
|
|
|
* @method string getToken() |
33
|
|
|
* @method string getTokenHash() |
34
|
|
|
* @method int getScope() |
35
|
|
|
* @method int getDepth() |
36
|
|
|
* @method string getPath() |
37
|
|
|
* @method string getUriV1() |
38
|
|
|
* @method string getUriV2() |
39
|
|
|
* @method string getOwnerAccountId() |
40
|
|
|
* |
41
|
|
|
* @method setFileId(int $fileId) |
42
|
|
|
* @method setCreatedAt(int $timestamp) |
43
|
|
|
* @method setTimeout(int $timeout) |
44
|
|
|
* @method setScope(int $scope) |
45
|
|
|
* @method setDepth(int $depth) |
46
|
|
|
* |
47
|
|
|
* @package OC\Lock\Persistent |
48
|
|
|
*/ |
49
|
|
|
class Lock extends Entity implements ILock { |
50
|
|
|
|
51
|
|
|
/** @var int BIGINT - foreign key to oc_filecache.fileid */ |
52
|
|
|
protected $fileId; |
53
|
|
|
/** @var string - plain text field as transmitted by clients*/ |
54
|
|
|
protected $owner; |
55
|
|
|
/** @var int - seconds of lock life time */ |
56
|
|
|
protected $timeout; |
57
|
|
|
/** @var int - unix timestamp when lock was created*/ |
58
|
|
|
protected $createdAt; |
59
|
|
|
/** @var string - uuid in WebDAV */ |
60
|
|
|
protected $token; |
61
|
|
|
/** @var string - md5 of token */ |
62
|
|
|
protected $tokenHash; |
63
|
|
|
/** @var int - LOCK_SCOPE_EXCLUSIVE or LOCK_SCOPE_SHARED */ |
64
|
|
|
protected $scope; |
65
|
|
|
/** @var int: 0, 1 or infinite */ |
66
|
|
|
protected $depth; |
67
|
|
|
/** @var int - foreign key zu oc_account.id */ |
68
|
|
|
protected $ownerAccountId; |
69
|
|
|
|
70
|
|
|
/** @var string - joined with oc_filecache */ |
71
|
|
|
protected $path; |
72
|
|
|
/** @var string - computed value */ |
73
|
|
|
protected $globalUserId; |
74
|
|
|
/** @var string - computed value */ |
75
|
|
|
protected $globalFileName; |
76
|
|
|
|
77
|
|
|
public function __construct() { |
78
|
|
|
$this->addType('fileId', 'integer'); |
79
|
|
|
$this->addType('timeout', 'integer'); |
80
|
|
|
$this->addType('createdAt', 'integer'); |
81
|
|
|
$this->addType('scope', 'integer'); |
82
|
|
|
$this->addType('depth', 'integer'); |
83
|
|
|
$this->addType('ownerAccountId', 'integer'); |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* @param $token |
88
|
|
|
*/ |
89
|
|
|
public function setToken($token) { |
90
|
|
|
parent::setter('token', [$token]); |
|
|
|
|
91
|
|
|
parent::setter('tokenHash', [\md5($token)]); |
|
|
|
|
92
|
|
|
} |
93
|
|
|
} |
94
|
|
|
|
This check looks for a call to a parent method whose name is different than the method from which it is called.
Consider the following code:
The
getFirstName()
method in theSon
calls the wrong method in the parent class.