summaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin/lib
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2018-10-17 14:58:02 +0200
committerRobin Appelman <robin@icewind.nl>2018-10-17 14:58:02 +0200
commit136113a22b2cc02a86a343d55eb0ce38b3dc6bbd (patch)
tree7516a9370ecba424d67a2d3f0e6a572ed0bca242 /apps/files_trashbin/lib
parenta369adb4cde6b210d5e1b86743995bdc004fec2c (diff)
downloadnextcloud-server-136113a22b2cc02a86a343d55eb0ce38b3dc6bbd.tar.gz
nextcloud-server-136113a22b2cc02a86a343d55eb0ce38b3dc6bbd.zip
remove user parameter from `ITrashItem::getOriginalLocation`
since the target user is known at the time of creating the trashitem the original location can already be adjusted on a per user level Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps/files_trashbin/lib')
-rw-r--r--apps/files_trashbin/lib/Trash/ITrashItem.php5
-rw-r--r--apps/files_trashbin/lib/Trash/LegacyTrashBackend.php10
-rw-r--r--apps/files_trashbin/lib/Trash/TrashItem.php2
3 files changed, 8 insertions, 9 deletions
diff --git a/apps/files_trashbin/lib/Trash/ITrashItem.php b/apps/files_trashbin/lib/Trash/ITrashItem.php
index ed01894beef..75e0f410301 100644
--- a/apps/files_trashbin/lib/Trash/ITrashItem.php
+++ b/apps/files_trashbin/lib/Trash/ITrashItem.php
@@ -37,13 +37,12 @@ interface ITrashItem extends FileInfo {
public function getTrashBackend(): ITrashBackend;
/**
- * Get the original location for the trash item for the user
+ * Get the original location for the trash item
*
- * @param IUser $user
* @return string
* @since 15.0.0
*/
- public function getOriginalLocation(IUser $user): string;
+ public function getOriginalLocation(): string;
/**
* Get the timestamp that the file was moved to trash
diff --git a/apps/files_trashbin/lib/Trash/LegacyTrashBackend.php b/apps/files_trashbin/lib/Trash/LegacyTrashBackend.php
index 04e3b284775..2c0d19afebf 100644
--- a/apps/files_trashbin/lib/Trash/LegacyTrashBackend.php
+++ b/apps/files_trashbin/lib/Trash/LegacyTrashBackend.php
@@ -49,13 +49,13 @@ class LegacyTrashBackend implements ITrashBackend {
* @param ITrashItem $parent
* @return ITrashItem[]
*/
- private function mapTrashItems(array $items, IUser $user, ITrashItem $parent = null): array {
+ private function mapTrashItems(array $items, ITrashItem $parent = null): array {
$parentTrashPath = ($parent instanceof ITrashItem) ? $parent->getTrashPath() : '';
$isRoot = $parent === null;
- return array_map(function (FileInfo $file) use ($parent, $parentTrashPath, $isRoot, $user) {
+ return array_map(function (FileInfo $file) use ($parent, $parentTrashPath, $isRoot) {
return new TrashItem(
$this,
- $isRoot ? $file['extraData'] : $parent->getOriginalLocation($user) . '/' . $file->getName(),
+ $isRoot ? $file['extraData'] : $parent->getOriginalLocation() . '/' . $file->getName(),
$file->getMTime(),
$parentTrashPath . '/' . $file->getName() . ($isRoot ? '.d' . $file->getMtime() : ''),
$file
@@ -65,12 +65,12 @@ class LegacyTrashBackend implements ITrashBackend {
public function listTrashRoot(IUser $user): array {
$entries = Helper::getTrashFiles('/', $user->getUID());
- return $this->mapTrashItems($entries, $user, null);
+ return $this->mapTrashItems($entries);
}
public function listTrashFolder(IUser $user, ITrashItem $folder): array {
$entries = Helper::getTrashFiles($folder->getTrashPath(), $user->getUID());
- return $this->mapTrashItems($entries, $user, $folder);
+ return $this->mapTrashItems($entries, $folder);
}
public function restoreItem(ITrashItem $item) {
diff --git a/apps/files_trashbin/lib/Trash/TrashItem.php b/apps/files_trashbin/lib/Trash/TrashItem.php
index 6d1c6dc328d..880a5503014 100644
--- a/apps/files_trashbin/lib/Trash/TrashItem.php
+++ b/apps/files_trashbin/lib/Trash/TrashItem.php
@@ -57,7 +57,7 @@ class TrashItem implements ITrashItem {
return $this->backend;
}
- public function getOriginalLocation(IUser $user): string {
+ public function getOriginalLocation(): string {
return $this->orignalLocation;
}