summaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin/lib/Sabre/AbstractTrash.php
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2018-09-10 14:40:35 +0200
committerRobin Appelman <robin@icewind.nl>2018-10-17 14:56:45 +0200
commit4adac445dc57d1ccc7f26e21018e1e731e5b1654 (patch)
treeb3da061a9332a1ebca2809a61ea3cf186d9fb259 /apps/files_trashbin/lib/Sabre/AbstractTrash.php
parent2634ceb35b72eac94e6bf4c61640036392c5f97f (diff)
downloadnextcloud-server-4adac445dc57d1ccc7f26e21018e1e731e5b1654.tar.gz
nextcloud-server-4adac445dc57d1ccc7f26e21018e1e731e5b1654.zip
fix select statement
fix select statement Make trashbin api modules Apps can register trashbin backends for specific storages, allowing them to modify trashbin behavior for storages The old trashbin implementation has been wrapped in a "legacy" backend, for future work this can be replaced with a new backend that better handles shares while still keeping the legacy backend around to keep existing trash from being accessible Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps/files_trashbin/lib/Sabre/AbstractTrash.php')
-rw-r--r--apps/files_trashbin/lib/Sabre/AbstractTrash.php31
1 files changed, 28 insertions, 3 deletions
diff --git a/apps/files_trashbin/lib/Sabre/AbstractTrash.php b/apps/files_trashbin/lib/Sabre/AbstractTrash.php
index 43f9cc02749..5d4b19513a4 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,24 @@
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;
+
+ /** @var IUser */
+ protected $user;
+
+ public function __construct(ITrashManager $trashManager, IUser $user, ITrashItem $data) {
+ $this->trashManager = $trashManager;
+ $this->user = $user;
$this->data = $data;
}
@@ -36,7 +48,7 @@ abstract class AbstractTrash implements ITrash {
}
public function getDeletionTime(): int {
- return $this->data->getMtime();
+ return $this->data->getDeletedTime();
}
public function getFileId(): int {
@@ -66,4 +78,17 @@ abstract class AbstractTrash implements ITrash {
public function getName(): string {
return $this->data->getName();
}
+
+ public function getOriginalLocation(): string {
+ return $this->data->getOriginalLocation($this->user);
+ }
+
+ public function delete() {
+ $this->trashManager->removeItem($this->user, $this->data);
+ }
+
+ public function restore(): bool {
+ $this->trashManager->restoreItem($this->data);
+ return true;
+ }
}