aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJan-Hendrik Willms <tleilax+studip@gmail.com>2024-12-04 08:10:59 +0000
committerJan-Hendrik Willms <tleilax+studip@gmail.com>2024-12-04 08:10:59 +0000
commitf9932b02fee0a8bd89968632d211106bead8e481 (patch)
tree55668d2c61744ad1610013d7e6a2bb371afaf548 /lib
parent43df0bbc55deb807cd780517797f2a3772553929 (diff)
don't count own downloads and downloads for files in homework folders, fixes #4591
Closes #4591 Merge request studip/studip!3414
Diffstat (limited to 'lib')
-rw-r--r--lib/models/FileRef.php7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/models/FileRef.php b/lib/models/FileRef.php
index 6bffbf3..2a7f485 100644
--- a/lib/models/FileRef.php
+++ b/lib/models/FileRef.php
@@ -223,6 +223,13 @@ class FileRef extends SimpleORMap implements PrivacyObject, FeedbackRange
*/
public function incrementDownloadCounter()
{
+ if (
+ $this->user_id === User::findCurrent()->id
+ || $this->folder instanceof HomeworkFolder
+ ) {
+ return 0;
+ }
+
$this->downloads += 1;
if (!$this->isNew()) {
$where_query = join(' AND ' , $this->getWhereQuery());