aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+studip@gmail.com>2025-01-14 11:30:09 +0100
committerJan-Hendrik Willms <tleilax+studip@gmail.com>2025-01-14 11:30:09 +0100
commitebcaaecdd9ee78567052e1423e35b846bef32eb1 (patch)
treef7b5b9369da8cd089620f3894aa93655deb9e051
parent5fa6f166d4d8f6a3a36d2e4a5e7c6d47f5e486d1 (diff)
adjustments according to review
-rw-r--r--app/views/file/_file_aside.php2
-rw-r--r--app/views/files/index.php2
-rw-r--r--lib/filesystem/FolderType.php2
-rw-r--r--lib/filesystem/InboxOutboxFolder.php2
-rw-r--r--lib/filesystem/PermissionEnabledFolder.php4
-rw-r--r--lib/filesystem/StandardFolder.php4
-rw-r--r--lib/filesystem/UnknownFolderType.php2
-rw-r--r--lib/filesystem/VirtualFolderType.php2
-rw-r--r--lib/models/FileRef.php2
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 @@
<? $size = $file->getSize() ?>
<td><?= $size !== null ? relSize($file->getSize(), false) : "-" ?></td>
</tr>
- <? if ($file->getFolderType()->countDownloads($file->getFileRef(), true)): ?>
+ <? if ($file->getFolderType()->countDownloads()): ?>
<tr>
<td><?= _('Downloads') ?></td>
<td><?= htmlReady($file->getDownloads()) ?></td>
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;
}