From 6fd7f8ab2a2fab7cc4ee2b70499b5c6143b33466 Mon Sep 17 00:00:00 2001 From: Akhil Date: Wed, 28 Feb 2024 23:52:00 +0530 Subject: [PATCH 1/3] Add patch to add mail quota usage to free_space computation --- Dockerfile | 2 +- patches/014-add-mail-usage.patch | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index c2c1c287..aae56e8a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -142,7 +142,7 @@ RUN cd ${BASE_DIR} && patch -p0 < ${TMP_PATCH_DIR}/009-help-links.patch RUN patch -u ${BASE_DIR}/lib/private/Updater.php -i ${TMP_PATCH_DIR}/010-disable-app-store-upgrade.patch RUN cd ${BASE_DIR} && patch -p0 < ${TMP_PATCH_DIR}/011-privacy-settings.patch RUN patch -u ${BASE_DIR}/lib/private/Authentication/Token/PublicKeyTokenProvider.php -i ${TMP_PATCH_DIR}/013-revert-token-password-update.patch -RUN patch -u ${BASE_DIR}/lib/private/legacy/OC_Helper.php -i ${TMP_PATCH_DIR}/014-add-mail-usage.patch +RUN cd ${BASE_DIR} && patch -p0 < ${TMP_PATCH_DIR}/014-add-mail-usage.patch RUN cd ${BASE_DIR} && patch -p0 < ${TMP_PATCH_DIR}/015-email-mail-template.patch RUN patch -u ${BASE_DIR}/core/Command/User/Setting.php -i ${TMP_PATCH_DIR}/018-occ-user-setting.patch RUN patch -u ${BASE_DIR}/apps/files/js/files.js -i ${TMP_PATCH_DIR}/021-repeated-storage-dialog-fix.patch diff --git a/patches/014-add-mail-usage.patch b/patches/014-add-mail-usage.patch index cd4cf4a0..716a2236 100644 --- a/patches/014-add-mail-usage.patch +++ b/patches/014-add-mail-usage.patch @@ -22,3 +22,16 @@ $ownerDisplayName = ''; $owner = \OC::$server->getUserManager()->get($ownerId); if ($owner) { +--- lib/private/Files/Storage/Wrapper/Quota.php 2024-02-28 23:45:03.136041704 +0530 ++++ lib/private/Files/Storage/Wrapper/Quota-new.php 2024-02-28 23:49:24.518192286 +0530 +@@ -117,7 +117,9 @@ + return FileInfo::SPACE_NOT_COMPUTED; + } else { + $free = $this->storage->free_space($path); +- $quotaFree = max($this->getQuota() - $used, 0); ++ $ownerId = $this->storage->getUser()->getUID(); ++ $mailQuotaUsage = (int) \OC::$server->getConfig()->getUserValue($ownerId, 'ecloud-accounts', 'mailQuotaUsage', 0); ++ $quotaFree = max($this->getQuota() - $used - $mailQuotaUsage, 0); + // if free space is known + $free = $free >= 0 ? min($free, $quotaFree) : $quotaFree; + return $free; -- GitLab From 123affbb9689ce1923201795ce7e6a25b4ba3651 Mon Sep 17 00:00:00 2001 From: Akhil Date: Fri, 1 Mar 2024 13:50:23 +0530 Subject: [PATCH 2/3] Add also negative value check --- patches/014-add-mail-usage.patch | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/patches/014-add-mail-usage.patch b/patches/014-add-mail-usage.patch index 716a2236..ca86e28f 100644 --- a/patches/014-add-mail-usage.patch +++ b/patches/014-add-mail-usage.patch @@ -24,13 +24,14 @@ if ($owner) { --- lib/private/Files/Storage/Wrapper/Quota.php 2024-02-28 23:45:03.136041704 +0530 +++ lib/private/Files/Storage/Wrapper/Quota-new.php 2024-02-28 23:49:24.518192286 +0530 -@@ -117,7 +117,9 @@ +@@ -117,7 +117,10 @@ return FileInfo::SPACE_NOT_COMPUTED; } else { $free = $this->storage->free_space($path); - $quotaFree = max($this->getQuota() - $used, 0); + $ownerId = $this->storage->getUser()->getUID(); + $mailQuotaUsage = (int) \OC::$server->getConfig()->getUserValue($ownerId, 'ecloud-accounts', 'mailQuotaUsage', 0); ++ $mailQuotaUsage = max($mailQuotaUsage, 0); // to avoid negative mail quota usage value + $quotaFree = max($this->getQuota() - $used - $mailQuotaUsage, 0); // if free space is known $free = $free >= 0 ? min($free, $quotaFree) : $quotaFree; -- GitLab From db65a924044b59ae1017be108ad80b98f413ed39 Mon Sep 17 00:00:00 2001 From: Akhil Date: Fri, 1 Mar 2024 13:52:51 +0530 Subject: [PATCH 3/3] Bump version number --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index aae56e8a..b8b7abe7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,7 +16,7 @@ ARG USER_MIGRATION_JOB_ID="608716" ARG MEMORIES_VERSION="6.1.5" ARG DROP_ACCOUNT_VERSION="2.3.2" -RUN sed -i 's/26,0,8,2/26,0,8,25/' ${BASE_DIR}/version.php +RUN sed -i 's/26,0,8,2/26,0,8,26/' ${BASE_DIR}/version.php COPY custom_entrypoint.sh / RUN chmod +x /custom_entrypoint.sh RUN mkdir -p /var/www/skeleton/Documents && mkdir -p /var/www/skeleton/Images -- GitLab