|
1
|
|
|
<?php |
|
2
|
|
|
declare(strict_types=1); |
|
3
|
|
|
/** |
|
4
|
|
|
* @copyright Copyright (c) 2016, ownCloud, Inc. |
|
5
|
|
|
* |
|
6
|
|
|
* @author Lukas Reschke <[email protected]> |
|
7
|
|
|
* @author Thomas Müller <[email protected]> |
|
8
|
|
|
* |
|
9
|
|
|
* @license AGPL-3.0 |
|
10
|
|
|
* |
|
11
|
|
|
* This code is free software: you can redistribute it and/or modify |
|
12
|
|
|
* it under the terms of the GNU Affero General Public License, version 3, |
|
13
|
|
|
* as published by the Free Software Foundation. |
|
14
|
|
|
* |
|
15
|
|
|
* This program is distributed in the hope that it will be useful, |
|
16
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
17
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
18
|
|
|
* GNU Affero General Public License for more details. |
|
19
|
|
|
* |
|
20
|
|
|
* You should have received a copy of the GNU Affero General Public License, version 3, |
|
21
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/> |
|
22
|
|
|
* |
|
23
|
|
|
*/ |
|
24
|
|
|
namespace OCA\DAV\Upload; |
|
25
|
|
|
|
|
26
|
|
|
use Sabre\DAVACL\AbstractPrincipalCollection; |
|
27
|
|
|
use Sabre\DAVACL\PrincipalBackend; |
|
28
|
|
|
|
|
29
|
|
|
class RootCollection extends AbstractPrincipalCollection { |
|
30
|
|
|
|
|
31
|
|
|
/** @var CleanupService */ |
|
32
|
|
|
private $cleanupService; |
|
33
|
|
|
|
|
34
|
|
|
public function __construct(PrincipalBackend\BackendInterface $principalBackend, |
|
35
|
|
|
string $principalPrefix, |
|
36
|
|
|
CleanupService $cleanupService) { |
|
37
|
|
|
parent::__construct($principalBackend, $principalPrefix); |
|
38
|
|
|
$this->cleanupService = $cleanupService; |
|
39
|
|
|
} |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* @inheritdoc |
|
43
|
|
|
*/ |
|
44
|
|
|
public function getChildForPrincipal(array $principalInfo): UploadHome { |
|
45
|
|
|
return new UploadHome($principalInfo, $this->cleanupService); |
|
|
|
|
|
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* @inheritdoc |
|
50
|
|
|
*/ |
|
51
|
|
|
public function getName(): string { |
|
52
|
|
|
return 'uploads'; |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
} |
|
56
|
|
|
|
In the issue above, the returned value is violating the contract defined by the mentioned interface.
Let's take a look at an example: