From 626ec513c3a81282cf2bb5e8158e8adfbeec1dff Mon Sep 17 00:00:00 2001 From: Herman van Rink Date: Sun, 27 Nov 2022 22:36:55 +0100 Subject: [PATCH 1/5] Unlimited quota is stored as -1, not zero, #6417 --- interface/lib/classes/quota_lib.inc.php | 2 +- interface/web/dashboard/dashlets/templates/databasequota.htm | 2 +- interface/web/dashboard/dashlets/templates/mailquota.htm | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/interface/lib/classes/quota_lib.inc.php b/interface/lib/classes/quota_lib.inc.php index b02cdea994..063d128b66 100644 --- a/interface/lib/classes/quota_lib.inc.php +++ b/interface/lib/classes/quota_lib.inc.php @@ -326,7 +326,7 @@ class quota_lib { if($used_ratio >= 0.8) $databases[$i]['display_colour'] = '#fd934f'; if($used_ratio >= 1) $databases[$i]['display_colour'] = '#cc0000'; - if($databases[$i]['database_quota'] == 0){ + if($databases[$i]['database_quota'] == -1) { $databases[$i]['database_quota'] = $app->lng('unlimited_txt'); } else { $databases[$i]['database_quota'] = $databases[$i]['database_quota'] . ' MB'; diff --git a/interface/web/dashboard/dashlets/templates/databasequota.htm b/interface/web/dashboard/dashlets/templates/databasequota.htm index 082dd1f8c0..48d6fa834c 100644 --- a/interface/web/dashboard/dashlets/templates/databasequota.htm +++ b/interface/web/dashboard/dashlets/templates/databasequota.htm @@ -14,7 +14,7 @@ {tmpl_var name='database_name'} {tmpl_var name='used'} {tmpl_var name='database_quota'} - {tmpl_if name="quota_raw" op="!=" value="0"} + {tmpl_if name="quota_raw" op="!=" value="-1"}
{tmpl_var name="used_percentage"}% {tmpl_var name='used'} {tmpl_var name='of_txt'} {tmpl_var name='database_quota'} diff --git a/interface/web/dashboard/dashlets/templates/mailquota.htm b/interface/web/dashboard/dashlets/templates/mailquota.htm index 9013c7ac3b..81a82f5349 100644 --- a/interface/web/dashboard/dashlets/templates/mailquota.htm +++ b/interface/web/dashboard/dashlets/templates/mailquota.htm @@ -16,7 +16,7 @@ {tmpl_var name='name'} {tmpl_var name='used'} {tmpl_var name='quota'} - {tmpl_if name="quota_raw" op="!=" value="0"} + {tmpl_if name="quota_raw" op="!=" value="-1"}
{tmpl_var name="used_percentage"}% {tmpl_var name='used'} {tmpl_var name='of_txt'} {tmpl_var name='quota'} -- GitLab From e11f336e42c2cef7901abc5d1327c7ac557d145f Mon Sep 17 00:00:00 2001 From: Herman van Rink Date: Sun, 27 Nov 2022 22:51:13 +0100 Subject: [PATCH 2/5] tabs --- interface/lib/classes/quota_lib.inc.php | 2 +- interface/web/dashboard/dashlets/templates/databasequota.htm | 2 +- interface/web/dashboard/dashlets/templates/mailquota.htm | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/interface/lib/classes/quota_lib.inc.php b/interface/lib/classes/quota_lib.inc.php index 063d128b66..7c5b388536 100644 --- a/interface/lib/classes/quota_lib.inc.php +++ b/interface/lib/classes/quota_lib.inc.php @@ -326,7 +326,7 @@ class quota_lib { if($used_ratio >= 0.8) $databases[$i]['display_colour'] = '#fd934f'; if($used_ratio >= 1) $databases[$i]['display_colour'] = '#cc0000'; - if($databases[$i]['database_quota'] == -1) { + if($databases[$i]['database_quota'] == -1) { $databases[$i]['database_quota'] = $app->lng('unlimited_txt'); } else { $databases[$i]['database_quota'] = $databases[$i]['database_quota'] . ' MB'; diff --git a/interface/web/dashboard/dashlets/templates/databasequota.htm b/interface/web/dashboard/dashlets/templates/databasequota.htm index 48d6fa834c..4e8db908bd 100644 --- a/interface/web/dashboard/dashlets/templates/databasequota.htm +++ b/interface/web/dashboard/dashlets/templates/databasequota.htm @@ -14,7 +14,7 @@ {tmpl_var name='database_name'} {tmpl_var name='used'} {tmpl_var name='database_quota'} - {tmpl_if name="quota_raw" op="!=" value="-1"} + {tmpl_if name="quota_raw" op="!=" value="-1"}
{tmpl_var name="used_percentage"}% {tmpl_var name='used'} {tmpl_var name='of_txt'} {tmpl_var name='database_quota'} diff --git a/interface/web/dashboard/dashlets/templates/mailquota.htm b/interface/web/dashboard/dashlets/templates/mailquota.htm index 81a82f5349..08834fa5ab 100644 --- a/interface/web/dashboard/dashlets/templates/mailquota.htm +++ b/interface/web/dashboard/dashlets/templates/mailquota.htm @@ -16,7 +16,7 @@ {tmpl_var name='name'} {tmpl_var name='used'} {tmpl_var name='quota'} - {tmpl_if name="quota_raw" op="!=" value="-1"} + {tmpl_if name="quota_raw" op="!=" value="-1"}
{tmpl_var name="used_percentage"}% {tmpl_var name='used'} {tmpl_var name='of_txt'} {tmpl_var name='quota'} -- GitLab From 2133a9886a45448d63001049b58e1c8f32f693c8 Mon Sep 17 00:00:00 2001 From: Herman van Rink Date: Mon, 5 Dec 2022 21:26:55 +0100 Subject: [PATCH 3/5] Revert unlimited quota check for email, dovecot forces this to be 0. --- interface/web/dashboard/dashlets/templates/mailquota.htm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/web/dashboard/dashlets/templates/mailquota.htm b/interface/web/dashboard/dashlets/templates/mailquota.htm index 08834fa5ab..9013c7ac3b 100644 --- a/interface/web/dashboard/dashlets/templates/mailquota.htm +++ b/interface/web/dashboard/dashlets/templates/mailquota.htm @@ -16,7 +16,7 @@ {tmpl_var name='name'} {tmpl_var name='used'} {tmpl_var name='quota'} - {tmpl_if name="quota_raw" op="!=" value="-1"} + {tmpl_if name="quota_raw" op="!=" value="0"}
{tmpl_var name="used_percentage"}% {tmpl_var name='used'} {tmpl_var name='of_txt'} {tmpl_var name='quota'} -- GitLab From 9648eaa80fbc00214feb570706d33c8b5b423585 Mon Sep 17 00:00:00 2001 From: Herman van Rink Date: Tue, 6 Dec 2022 22:55:46 +0100 Subject: [PATCH 4/5] -1 has no meaning for a mail_user quota, 0==unlimited and default. --- install/sql/incremental/upd_dev_collection.sql | 2 ++ install/sql/ispconfig3.sql | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/install/sql/incremental/upd_dev_collection.sql b/install/sql/incremental/upd_dev_collection.sql index e69de29bb2..c3d8c5b210 100644 --- a/install/sql/incremental/upd_dev_collection.sql +++ b/install/sql/incremental/upd_dev_collection.sql @@ -0,0 +1,2 @@ + +ALTER TABLE `mail_user` CHANGE `quota` `quota` BIGINT(20) NOT NULL DEFAULT '0'; diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql index cf340bda01..e9ed67c86a 100644 --- a/install/sql/ispconfig3.sql +++ b/install/sql/ispconfig3.sql @@ -1070,7 +1070,7 @@ CREATE TABLE `mail_user` ( `gid` int(11) NOT NULL default '5000', `maildir` varchar(255) NOT NULL default '', `maildir_format` varchar(255) NOT NULL default 'maildir', - `quota` bigint(20) NOT NULL default '-1', + `quota` bigint(20) NOT NULL default '0', `cc` text, `forward_in_lda` enum('n','y') NOT NULL default 'n', `sender_cc` varchar(255) NOT NULL default '', -- GitLab From b5b8a5853103f823785b1e32482db682a1deeb46 Mon Sep 17 00:00:00 2001 From: Herman van Rink Date: Tue, 6 Dec 2022 23:03:34 +0100 Subject: [PATCH 5/5] -1 has no meaning for a mail_user quota, 0==unlimited and default. --- interface/web/mail/form/mail_user.tform.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interface/web/mail/form/mail_user.tform.php b/interface/web/mail/form/mail_user.tform.php index 32e58686e2..f513aeb9d3 100644 --- a/interface/web/mail/form/mail_user.tform.php +++ b/interface/web/mail/form/mail_user.tform.php @@ -166,7 +166,7 @@ $form["tabs"]['mailuser'] = array( 'regex' => '/^([0-9]{1,})$/', 'errmsg'=> 'quota_error_value'), ), - 'default' => '-1', + 'default' => '0', 'value' => '', 'width' => '30', 'maxlength' => '255' -- GitLab