From 136113a22b2cc02a86a343d55eb0ce38b3dc6bbd Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 17 Oct 2018 14:58:02 +0200 Subject: 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 --- apps/files_trashbin/lib/Trash/ITrashItem.php | 5 ++--- apps/files_trashbin/lib/Trash/LegacyTrashBackend.php | 10 +++++----- apps/files_trashbin/lib/Trash/TrashItem.php | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) (limited to 'apps/files_trashbin/lib') 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; } -- cgit v1.2.3