1
|
|
|
<?php |
2
|
|
|
declare(strict_types=1); |
3
|
|
|
/** |
4
|
|
|
* @copyright 2018, Roeland Jago Douma <[email protected]> |
5
|
|
|
* |
6
|
|
|
* @author Roeland Jago Douma <[email protected]> |
7
|
|
|
* |
8
|
|
|
* @license GNU AGPL version 3 or any later version |
9
|
|
|
* |
10
|
|
|
* This program is free software: you can redistribute it and/or modify |
11
|
|
|
* it under the terms of the GNU Affero General Public License as |
12
|
|
|
* published by the Free Software Foundation, either version 3 of the |
13
|
|
|
* License, or (at your option) any later version. |
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 |
21
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
22
|
|
|
* |
23
|
|
|
*/ |
24
|
|
|
|
25
|
|
|
namespace OCA\Files_Versions\Sabre; |
26
|
|
|
|
27
|
|
|
use OCP\IUser; |
28
|
|
|
use Sabre\DAV\Exception\Forbidden; |
29
|
|
|
use Sabre\DAV\ICollection; |
30
|
|
|
use Sabre\DAV\IMoveTarget; |
31
|
|
|
use Sabre\DAV\INode; |
32
|
|
|
|
33
|
|
|
|
34
|
|
|
class RestoreFolder implements ICollection, IMoveTarget { |
35
|
|
|
public function createFile($name, $data = null) { |
36
|
|
|
throw new Forbidden(); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
public function createDirectory($name) { |
40
|
|
|
throw new Forbidden(); |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
public function getChild($name) { |
44
|
|
|
return null; |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
public function delete() { |
48
|
|
|
throw new Forbidden(); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
public function getName() { |
52
|
|
|
return 'restore'; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
public function setName($name) { |
56
|
|
|
throw new Forbidden(); |
57
|
|
|
} |
58
|
|
|
|
59
|
|
|
public function getLastModified(): int { |
60
|
|
|
return 0; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
public function getChildren(): array { |
64
|
|
|
return []; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
public function childExists($name): bool { |
68
|
|
|
return false; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
public function moveInto($targetName, $sourcePath, INode $sourceNode): bool { |
72
|
|
|
if (!($sourceNode instanceof VersionFile)) { |
73
|
|
|
return false; |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
$sourceNode->rollBack(); |
77
|
|
|
return true; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
} |
81
|
|
|
|