From ebcaaecdd9ee78567052e1423e35b846bef32eb1 Mon Sep 17 00:00:00 2001 From: Jan-Hendrik Willms Date: Tue, 14 Jan 2025 11:30:09 +0100 Subject: adjustments according to review --- app/views/file/_file_aside.php | 2 +- app/views/files/index.php | 2 +- lib/filesystem/FolderType.php | 2 +- lib/filesystem/InboxOutboxFolder.php | 2 +- lib/filesystem/PermissionEnabledFolder.php | 4 ++-- lib/filesystem/StandardFolder.php | 4 ++-- lib/filesystem/UnknownFolderType.php | 2 +- lib/filesystem/VirtualFolderType.php | 2 +- lib/models/FileRef.php | 2 +- 9 files changed, 11 insertions(+), 11 deletions(-) diff --git a/app/views/file/_file_aside.php b/app/views/file/_file_aside.php index bc71f1a..04c6735 100644 --- a/app/views/file/_file_aside.php +++ b/app/views/file/_file_aside.php @@ -16,7 +16,7 @@ getSize() ?> getSize(), false) : "-" ?> - getFolderType()->countDownloads($file->getFileRef(), true)): ?> + getFolderType()->countDownloads()): ?> getDownloads()) ?> diff --git a/app/views/files/index.php b/app/views/files/index.php index c14c0a9..0f5c566 100644 --- a/app/views/files/index.php +++ b/app/views/files/index.php @@ -15,7 +15,7 @@ } $show_downloads = Config::get()->DISPLAY_DOWNLOAD_COUNTER === 'always' - && $topFolder->countDownloads(display: true); + && $topFolder->countDownloads(); $vue_breadcrumbs = []; $folder = $topFolder; do { diff --git a/lib/filesystem/FolderType.php b/lib/filesystem/FolderType.php index 4c548bd..4b0501a 100644 --- a/lib/filesystem/FolderType.php +++ b/lib/filesystem/FolderType.php @@ -295,5 +295,5 @@ interface FolderType * If a specific file ref is passed, you may decide whether to count the * download for this file ref or not. */ - public function countDownloads(?FileRef $ref = null, bool $display = false): bool; + public function countDownloads(?FileRef $ref = null): bool; } diff --git a/lib/filesystem/InboxOutboxFolder.php b/lib/filesystem/InboxOutboxFolder.php index a07d67b..bab9253 100644 --- a/lib/filesystem/InboxOutboxFolder.php +++ b/lib/filesystem/InboxOutboxFolder.php @@ -314,7 +314,7 @@ class InboxOutboxFolder implements FolderType return ['description' => $this->description]; } - public function countDownloads(?FileRef $ref = null, bool $display = false): bool + public function countDownloads(?FileRef $ref = null): bool { return true; } diff --git a/lib/filesystem/PermissionEnabledFolder.php b/lib/filesystem/PermissionEnabledFolder.php index c1b3d71..032f699 100644 --- a/lib/filesystem/PermissionEnabledFolder.php +++ b/lib/filesystem/PermissionEnabledFolder.php @@ -161,9 +161,9 @@ class PermissionEnabledFolder extends StandardFolder ]; } - public function countDownloads(?FileRef $ref = null, bool $display = false): bool + public function countDownloads(?FileRef $ref = null): bool { return ($this->permission & $this->perms['r']) - && parent::countDownloads($ref, $display); + && parent::countDownloads($ref); } } diff --git a/lib/filesystem/StandardFolder.php b/lib/filesystem/StandardFolder.php index fa7f7b3..61642e9 100644 --- a/lib/filesystem/StandardFolder.php +++ b/lib/filesystem/StandardFolder.php @@ -552,9 +552,9 @@ class StandardFolder implements FolderType return ['description' => $this->description]; } - public function countDownloads(?FileRef $ref = null, bool $display = false): bool + public function countDownloads(?FileRef $ref = null): bool { - if (!$ref || $display) { + if (!$ref) { return true; } diff --git a/lib/filesystem/UnknownFolderType.php b/lib/filesystem/UnknownFolderType.php index a2d2fce..2cd7fd2 100644 --- a/lib/filesystem/UnknownFolderType.php +++ b/lib/filesystem/UnknownFolderType.php @@ -297,7 +297,7 @@ class UnknownFolderType implements FolderType return ['description' => $this->description]; } - public function countDownloads(?FileRef $ref = null, bool $display = false): bool + public function countDownloads(?FileRef $ref = null): bool { return true; } diff --git a/lib/filesystem/VirtualFolderType.php b/lib/filesystem/VirtualFolderType.php index 11d544c..0e2c2b4 100644 --- a/lib/filesystem/VirtualFolderType.php +++ b/lib/filesystem/VirtualFolderType.php @@ -323,7 +323,7 @@ class VirtualFolderType implements FolderType return ['description' => $this->description]; } - public function countDownloads(?FileRef $ref = null, bool $display = false): bool + public function countDownloads(?FileRef $ref = null): bool { return true; } diff --git a/lib/models/FileRef.php b/lib/models/FileRef.php index aba20ee..eeedf26 100644 --- a/lib/models/FileRef.php +++ b/lib/models/FileRef.php @@ -223,7 +223,7 @@ class FileRef extends SimpleORMap implements PrivacyObject, FeedbackRange */ public function incrementDownloadCounter() { - if (!$this->folder->getTypedFolder()->countDownloads($this, false)) { + if (!$this->folder->getTypedFolder()->countDownloads($this)) { return 0; } -- cgit v1.0