Remove `downloads` and `lastDownloadTime`
authorAlexander Ebert <ebert@woltlab.com>
Fri, 3 May 2024 13:30:53 +0000 (15:30 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Sat, 8 Jun 2024 10:19:39 +0000 (12:19 +0200)
These have been meaningless metrics for most of the time and also do not play nicely with the efficient distribution of files.

ts/WoltLabSuite/Core/Component/File/Upload.ts
wcfsetup/install/files/acp/templates/attachmentList.tpl
wcfsetup/install/files/js/WoltLabSuite/Core/Component/File/Upload.js
wcfsetup/install/files/lib/acp/page/AttachmentListPage.class.php
wcfsetup/install/files/lib/data/attachment/Attachment.class.php
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml

index 03479303766d03ec3d6789dd94d96d035e5665b0..00f57b33f9ea778dba4d4d0f8e7ec2c3bbc185ca 100644 (file)
@@ -9,6 +9,7 @@ import {
 import { generateThumbnails } from "WoltLabSuite/Core/Api/Files/GenerateThumbnails";
 import ImageResizer from "WoltLabSuite/Core/Image/Resizer";
 import { AttachmentData } from "../Ckeditor/Attachment";
+import { innerError } from "WoltLabSuite/Core/Dom/Util";
 
 export type CkeditorDropEvent = {
   file: File;
@@ -184,7 +185,7 @@ function validateFile(element: WoltlabCoreFileUploadElement, file: File): boolea
     }
   }
 
-  // TODO: show an error message
+  innerError(element, `TODO: the file extension of '${file.name}' is not allowed`);
 
   return false;
 }
index 03c1c44f709b118ff2683dc77b877b43fa57782f..b5a71d5d763d133b2f09fd1c6729bf7853a74a91 100644 (file)
@@ -95,8 +95,6 @@
                                        <th class="columnTitle columnFilename{if $sortField == 'filename'} active {@$sortOrder}{/if}"><a href="{link controller='AttachmentList'}pageNo={@$pageNo}&sortField=filename&sortOrder={if $sortField == 'filename' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{@$linkParameters}{/link}">{lang}wcf.attachment.filename{/lang}</a></th>
                                        <th class="columnDate columnUploadTime{if $sortField == 'uploadTime'} active {@$sortOrder}{/if}"><a href="{link controller='AttachmentList'}pageNo={@$pageNo}&sortField=uploadTime&sortOrder={if $sortField == 'uploadTime' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{@$linkParameters}{/link}">{lang}wcf.attachment.uploadTime{/lang}</a></th>
                                        <th class="columnDigits columnFilesize{if $sortField == 'filesize'} active {@$sortOrder}{/if}"><a href="{link controller='AttachmentList'}pageNo={@$pageNo}&sortField=filesize&sortOrder={if $sortField == 'filesize' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{@$linkParameters}{/link}">{lang}wcf.attachment.filesize{/lang}</a></th>
-                                       <th class="columnDigits columnDownloads{if $sortField == 'downloads'} active {@$sortOrder}{/if}"><a href="{link controller='AttachmentList'}pageNo={@$pageNo}&sortField=downloads&sortOrder={if $sortField == 'downloads' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{@$linkParameters}{/link}">{lang}wcf.attachment.downloads{/lang}</a></th>
-                                       <th class="columnDate columnLastDownloadTime{if $sortField == 'lastDownloadTime'} active {@$sortOrder}{/if}"><a href="{link controller='AttachmentList'}pageNo={@$pageNo}&sortField=lastDownloadTime&sortOrder={if $sortField == 'lastDownloadTime' && $sortOrder == 'ASC'}DESC{else}ASC{/if}{@$linkParameters}{/link}">{lang}wcf.attachment.lastDownloadTime{/lang}</a></th>
                                        
                                        {event name='columnHeads'}
                                </tr>
                                                </td>
                                                <td class="columnDate columnUploadTime">{@$attachment->uploadTime|time}</td>
                                                <td class="columnDigits columnFilesize">{@$attachment->filesize|filesize}</td>
-                                               <td class="columnDigits columnDownloads">{#$attachment->downloads}</td>
-                                               <td class="columnDate columnLastDownloadTime">{if $attachment->lastDownloadTime}{@$attachment->lastDownloadTime|time}{/if}</td>
                                                
                                                {event name='columns'}
                                        </tr>
index 2c1395fd687ca8f3d1add74df6ddceebc6a4f914..d7bde8c01f823ed35052f5660468b685ce8712a0 100644 (file)
@@ -1,4 +1,4 @@
-define(["require", "exports", "tslib", "WoltLabSuite/Core/Helper/Selector", "WoltLabSuite/Core/Api/Files/Upload", "WoltLabSuite/Core/Api/Files/Chunk/Chunk", "WoltLabSuite/Core/Api/Files/GenerateThumbnails", "WoltLabSuite/Core/Image/Resizer"], function (require, exports, tslib_1, Selector_1, Upload_1, Chunk_1, GenerateThumbnails_1, Resizer_1) {
+define(["require", "exports", "tslib", "WoltLabSuite/Core/Helper/Selector", "WoltLabSuite/Core/Api/Files/Upload", "WoltLabSuite/Core/Api/Files/Chunk/Chunk", "WoltLabSuite/Core/Api/Files/GenerateThumbnails", "WoltLabSuite/Core/Image/Resizer", "WoltLabSuite/Core/Dom/Util"], function (require, exports, tslib_1, Selector_1, Upload_1, Chunk_1, GenerateThumbnails_1, Resizer_1, Util_1) {
     "use strict";
     Object.defineProperty(exports, "__esModule", { value: true });
     exports.setup = void 0;
@@ -116,7 +116,7 @@ define(["require", "exports", "tslib", "WoltLabSuite/Core/Helper/Selector", "Wol
                 return true;
             }
         }
-        // TODO: show an error message
+        (0, Util_1.innerError)(element, `TODO: the file extension of '${file.name}' is not allowed`);
         return false;
     }
     function setup() {
index 4bd75017b937ad3cc1da056ec51b3078f419baa9..71b4ebf810caf3d9401c6d57d152eaaf7db1c62b 100644 (file)
@@ -43,7 +43,7 @@ class AttachmentListPage extends SortablePage
     /**
      * @inheritDoc
      */
-    public $validSortFields = ['attachmentID', 'filename', 'filesize', 'downloads', 'uploadTime', 'lastDownloadTime'];
+    public $validSortFields = ['attachmentID', 'filename', 'filesize', 'uploadTime'];
 
     /**
      * @inheritDoc
index de414d1b7f511e0e74ab44475bbb61334cd4ef0d..0313d1631853312ced0241a906c09dc5af2a36ec 100644 (file)
@@ -40,8 +40,6 @@ use wcf\util\FileUtil;
  * @property-read   int $thumbnailSize  size of the thumbnail file for the attachment if `$isImage` is `1`, otherwise `0`
  * @property-read   int $thumbnailWidth width of the thumbnail file for the attachment if `$isImage` is `1`, otherwise `0`
  * @property-read   int $thumbnailHeight    height of the thumbnail file for the attachment if `$isImage` is `1`, otherwise `0`
- * @property-read   int $downloads      number of times the attachment has been downloaded
- * @property-read   int $lastDownloadTime   timestamp at which the attachment has been downloaded the last time
  * @property-read   int $uploadTime     timestamp at which the attachment has been uploaded
  * @property-read   int $showOrder      position of the attachment in relation to the other attachment to the same message
  * @property-read int|null $fileID
@@ -384,6 +382,16 @@ class Attachment extends DatabaseObject implements ILinkableObject, IRouteContro
     #[\Override]
     public function __get($name)
     {
+        // Deprecated attributes that are no longer supported.
+        $value = match ($name) {
+            'downloads' => 0,
+            'lastDownloadTime' => 0,
+            default => null,
+        };
+        if ($value !== null) {
+            return $value;
+        }
+
         $file = $this->getFile();
         if ($file === null) {
             return parent::__get($name);
index 1bee3768f0d72b5772e7978ff0a4a43c5e337342..e133002bdf40edcc5b3d8fe04208960529b7164c 100644 (file)
@@ -3351,8 +3351,6 @@ Erlaubte Dateiendungen: {', '|implode:$attachmentHandler->getFormattedAllowedExt
                <item name="wcf.attachment.filename"><![CDATA[Dateiname]]></item>
                <item name="wcf.attachment.uploadTime"><![CDATA[Hochgeladen]]></item>
                <item name="wcf.attachment.filesize"><![CDATA[Größe]]></item>
-               <item name="wcf.attachment.downloads"><![CDATA[Downloads]]></item>
-               <item name="wcf.attachment.lastDownloadTime"><![CDATA[Letzter Download]]></item>
                <item name="wcf.attachment.fileType"><![CDATA[Dateityp]]></item>
                <item name="wcf.attachment.dragAndDrop.dropHere"><![CDATA[Hierhin ziehen und loslassen, um Dateien hochzuladen]]></item>
                <item name="wcf.attachment.dragAndDrop.dropNow"><![CDATA[Jetzt loslassen, um Dateien hochzuladen]]></item>
index b28ae479eb06245dcb186c7ec2de6fd936d08f85..b662b327ef609d5dfe63746ae2b3fdcb63392a8b 100644 (file)
@@ -3276,8 +3276,6 @@ Allowed extensions: {', '|implode:$attachmentHandler->getFormattedAllowedExtensi
                <item name="wcf.attachment.filename"><![CDATA[Filename]]></item>
                <item name="wcf.attachment.uploadTime"><![CDATA[Upload Time]]></item>
                <item name="wcf.attachment.filesize"><![CDATA[File Size]]></item>
-               <item name="wcf.attachment.downloads"><![CDATA[Downloads]]></item>
-               <item name="wcf.attachment.lastDownloadTime"><![CDATA[Last Download]]></item>
                <item name="wcf.attachment.fileType"><![CDATA[Type]]></item>
                <item name="wcf.attachment.dragAndDrop.dropHere"><![CDATA[Drag and Drop here to upload]]></item>
                <item name="wcf.attachment.dragAndDrop.dropNow"><![CDATA[Drop now to upload]]></item>