diff options
Diffstat (limited to 'apps/files_trashbin/lib/Sabre/AbstractTrash.php')
-rw-r--r-- | apps/files_trashbin/lib/Sabre/AbstractTrash.php | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/apps/files_trashbin/lib/Sabre/AbstractTrash.php b/apps/files_trashbin/lib/Sabre/AbstractTrash.php index 43f9cc02749..b4d13a41e38 100644 --- a/apps/files_trashbin/lib/Sabre/AbstractTrash.php +++ b/apps/files_trashbin/lib/Sabre/AbstractTrash.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); /** * @copyright Copyright (c) 2018 Robin Appelman <robin@icewind.nl> * @@ -21,13 +22,20 @@ namespace OCA\Files_Trashbin\Sabre; +use OCA\Files_Trashbin\Trash\ITrashItem; +use OCA\Files_Trashbin\Trash\ITrashManager; use OCP\Files\FileInfo; +use OCP\IUser; abstract class AbstractTrash implements ITrash { - /** @var FileInfo */ + /** @var ITrashItem */ protected $data; - public function __construct(FileInfo $data) { + /** @var ITrashManager */ + protected $trashManager; + + public function __construct(ITrashManager $trashManager, ITrashItem $data) { + $this->trashManager = $trashManager; $this->data = $data; } @@ -36,7 +44,7 @@ abstract class AbstractTrash implements ITrash { } public function getDeletionTime(): int { - return $this->data->getMtime(); + return $this->data->getDeletedTime(); } public function getFileId(): int { @@ -66,4 +74,17 @@ abstract class AbstractTrash implements ITrash { public function getName(): string { return $this->data->getName(); } + + public function getOriginalLocation(): string { + return $this->data->getOriginalLocation(); + } + + public function delete() { + $this->trashManager->removeItem($this->data); + } + + public function restore(): bool { + $this->trashManager->restoreItem($this->data); + return true; + } } |