From 5756d8c590907632af98871b80909398451d99b5 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 23 Dec 2024 14:35:44 +0100 Subject: [PATCH] Retrieve the total size of attachments from `wcf1_file` See https://www.woltlab.com/community/thread/310063-fehlerhafte-berechnung-der-gesamtgr%C3%B6%C3%9Fe-aller-dateianh%C3%A4nge/ --- .../attachment/AdministrativeAttachmentList.class.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/wcfsetup/install/files/lib/data/attachment/AdministrativeAttachmentList.class.php b/wcfsetup/install/files/lib/data/attachment/AdministrativeAttachmentList.class.php index 3aea4be7ab..87751e18d0 100644 --- a/wcfsetup/install/files/lib/data/attachment/AdministrativeAttachmentList.class.php +++ b/wcfsetup/install/files/lib/data/attachment/AdministrativeAttachmentList.class.php @@ -92,11 +92,13 @@ class AdministrativeAttachmentList extends AttachmentList public function getStats() { $sql = "SELECT COUNT(*) AS count, - COALESCE(SUM(attachment.filesize), 0) AS size, + COALESCE(SUM(file.fileSize), 0) AS size, COALESCE(SUM(downloads), 0) AS downloads - FROM wcf" . WCF_N . "_attachment attachment + FROM wcf1_attachment attachment + LEFT JOIN wcf1_file file + ON (file.fileID = attachment.fileID) " . $this->getConditionBuilder(); - $statement = WCF::getDB()->prepareStatement($sql); + $statement = WCF::getDB()->prepare($sql); $statement->execute($this->getConditionBuilder()->getParameters()); return $statement->fetchArray(); -- 2.20.1