2018-04-16 17:02:50 +02:00
|
|
|
<?php
|
2019-12-03 19:57:53 +01:00
|
|
|
|
2018-04-16 17:02:50 +02:00
|
|
|
declare(strict_types=1);
|
2019-12-03 19:57:53 +01:00
|
|
|
|
2018-04-16 17:02:50 +02:00
|
|
|
/**
|
2024-06-02 15:26:54 +02:00
|
|
|
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
2018-04-16 17:02:50 +02:00
|
|
|
*/
|
|
|
|
namespace OCA\Files_Trashbin\Sabre;
|
|
|
|
|
|
|
|
use Sabre\DAV\Exception\Forbidden;
|
|
|
|
use Sabre\DAV\ICollection;
|
|
|
|
use Sabre\DAV\IMoveTarget;
|
|
|
|
use Sabre\DAV\INode;
|
|
|
|
|
|
|
|
class RestoreFolder implements ICollection, IMoveTarget {
|
|
|
|
public function createFile($name, $data = null) {
|
|
|
|
throw new Forbidden();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function createDirectory($name) {
|
|
|
|
throw new Forbidden();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getChild($name) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function delete() {
|
|
|
|
throw new Forbidden();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getName() {
|
|
|
|
return 'restore';
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setName($name) {
|
|
|
|
throw new Forbidden();
|
|
|
|
}
|
|
|
|
|
2018-04-25 20:24:23 +02:00
|
|
|
public function getLastModified(): int {
|
2018-04-16 17:02:50 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-04-25 20:24:23 +02:00
|
|
|
public function getChildren(): array {
|
2018-04-16 17:02:50 +02:00
|
|
|
return [];
|
|
|
|
}
|
|
|
|
|
2018-04-25 20:24:23 +02:00
|
|
|
public function childExists($name): bool {
|
2018-04-16 17:02:50 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2018-04-25 20:24:23 +02:00
|
|
|
public function moveInto($targetName, $sourcePath, INode $sourceNode): bool {
|
2018-04-16 17:02:50 +02:00
|
|
|
if (!($sourceNode instanceof ITrash)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $sourceNode->restore();
|
|
|
|
}
|
|
|
|
}
|