diff --git a/data/web/css/site/debug.css b/data/web/css/site/debug.css index 89eaf41a..9b45f028 100644 --- a/data/web/css/site/debug.css +++ b/data/web/css/site/debug.css @@ -44,4 +44,14 @@ tbody { .container-indicator { width: 15px; height: 15px; -} \ No newline at end of file +} +.disk_space { + margin-top: 20px; +} +.progress-bar-committed { + background-color: #B6E1F2; +} +.usage-info { + display: inline-block; + margin-right: 5px; +} diff --git a/data/web/debug.php b/data/web/debug.php index 67417bc2..09bd44b5 100644 --- a/data/web/debug.php +++ b/data/web/debug.php @@ -43,6 +43,10 @@ else { 'system', 'task' => 'df', 'dir' => '/var/vmail'); $vmail_df = explode(',', json_decode(docker('post', 'dovecot-mailcow', 'exec', $exec_fields), true)); + $domainQuota = round(domain_admin('total_quota')/1024); + $quotaPercent1 = round(($domainQuota/substr($vmail_df[3], 0, -1))*100); + $quotaPercent2 = round((($domainQuota-substr($vmail_df[2], 0, -1))/substr($vmail_df[3], 0, -1))*100); + $quotaPercent2 = ($quotaPercent2+substr($vmail_df[4], 0, -1)>100) ? 100-substr($vmail_df[4], 0, -1) : $quotaPercent2; //handling overcommitment ?>
@@ -53,12 +57,15 @@ else {

/var/vmail on

-

/ ()

+

B

+
+

  B ()

+

  GB (%)

@@ -344,7 +351,6 @@ $lang_admin = json_encode($lang['admin']); echo "var lang = ". $lang_admin . ";\n"; echo "var csrf_token = '". $_SESSION['CSRF']['TOKEN'] . "';\n"; echo "var log_pagination_size = '". $LOG_PAGINATION_SIZE . "';\n"; - ?> execute(array(':username' => $username)); $num_results[] = count($stmt->fetchAll(PDO::FETCH_ASSOC)); - + $stmt = $pdo->prepare("SELECT `username` FROM `admin` WHERE `username` = :username"); $stmt->execute(array(':username' => $username)); $num_results[] = count($stmt->fetchAll(PDO::FETCH_ASSOC)); - + $stmt = $pdo->prepare("SELECT `username` FROM `domain_admins` WHERE `username` = :username"); $stmt->execute(array(':username' => $username)); @@ -373,7 +373,7 @@ function domain_admin($_action, $_data = null) { } $stmt = $pdo->query("SELECT DISTINCT `username` - FROM `domain_admins` + FROM `domain_admins` WHERE `username` IN ( SELECT `username` FROM `admin` WHERE `superadmin`!='1' @@ -409,7 +409,7 @@ function domain_admin($_action, $_data = null) { ':domain_admin' => $_data )); $row = $stmt->fetch(PDO::FETCH_ASSOC); - if (empty($row)) { + if (empty($row)) { return false; } $domainadmindata['username'] = $row['username']; @@ -444,5 +444,18 @@ function domain_admin($_action, $_data = null) { return $domainadmindata; break; + case 'total_quota': + if ($_SESSION['mailcow_cc_role'] != "admin") { + $_SESSION['return'][] = array( + 'type' => 'danger', + 'log' => array(__FUNCTION__, $_action, $_data_log), + 'msg' => 'access_denied' + ); + return false; + } + $stmt = $pdo->query("SELECT SUM(`quota`) AS `quota` FROM `domain`"); + $row = $stmt->fetch(PDO::FETCH_ASSOC); + return $row['quota']; + break; } } diff --git a/data/web/lang/lang.de.php b/data/web/lang/lang.de.php index 1f671b3d..e0f859a1 100644 --- a/data/web/lang/lang.de.php +++ b/data/web/lang/lang.de.php @@ -150,7 +150,7 @@ $lang['success']['resource_removed'] = 'Ressource %s wurde entfernt'; $lang['warning']['cannot_delete_self'] = 'Kann derzeit eingeloggten Benutzer nicht entfernen'; $lang['warning']['no_active_admin'] = 'Kann letzten aktiven Administrator nicht deaktivieren'; $lang['danger']['max_quota_in_use'] = 'Mailbox Speicherplatzlimit muss größer oder gleich %d MiB sein'; -$lang['danger']['domain_quota_m_in_use'] = 'Domain Speicherplatzlimit muss größer oder gleich %d MiB sein'; +$lang['danger']['domain_quota_m_in_use'] = 'Domain-Speicherplatzlimit muss größer oder gleich %d MiB sein'; $lang['danger']['mailboxes_in_use'] = 'Maximale Anzahl an Mailboxen muss größer oder gleich %d sein'; $lang['danger']['aliases_in_use'] = 'Maximale Anzahl an Aliassen muss größer oder gleich %d sein'; $lang['danger']['sender_acl_invalid'] = 'Sender ACL %s ist ungültig'; @@ -375,7 +375,7 @@ $lang['edit']['mailbox'] = 'Mailbox bearbeiten'; $lang['edit']['description'] = 'Beschreibung'; $lang['edit']['max_aliases'] = 'Max. Aliasse'; $lang['edit']['max_quota'] = 'Max. Größe per Mailbox (MiB)'; -$lang['edit']['domain_quota'] = 'Domain Speicherplatz gesamt (MiB)'; +$lang['edit']['domain_quota'] = 'Domain-Speicherplatz gesamt (MiB)'; $lang['edit']['backup_mx_options'] = 'Backup MX Optionen'; $lang['edit']['relay_domain'] = 'Diese Domain relayen'; $lang['edit']['relay_all'] = 'Alle Empfänger-Adressen relayen'; @@ -474,7 +474,7 @@ $lang['add']['description'] = 'Beschreibung'; $lang['add']['max_aliases'] = 'Max. mögliche Aliasse'; $lang['add']['max_mailboxes'] = 'Max. mögliche Mailboxen'; $lang['add']['mailbox_quota_m'] = 'Max. Speicherplatz pro Mailbox (MiB)'; -$lang['add']['domain_quota_m'] = 'Domain Speicherplatz gesamt (MiB)'; +$lang['add']['domain_quota_m'] = 'Domain-Speicherplatz gesamt (MiB)'; $lang['add']['backup_mx_options'] = 'Backup MX Optionen'; $lang['add']['relay_all'] = 'Alle Empfänger-Adressen relayen'; $lang['add']['relay_domain'] = 'Relay Domain'; @@ -545,7 +545,7 @@ $lang['tfa']['confirm_totp_token'] = "Bitte bestätigen Sie die Änderung durch $lang['admin']['rspamd-com_settings'] = 'Rspamd docs - Ein Name wird automatisch generiert. Beispielinhalte zur Einsicht stehen nachstehend bereit.'; - + $lang['admin']['no_new_rows'] = 'Keine weiteren Zeilen vorhanden'; $lang['admin']['additional_rows'] = ' zusätzliche Zeilen geladen'; // parses to 'n additional rows were added' $lang['admin']['private_key'] = 'Private Key'; @@ -791,6 +791,13 @@ $lang['debug']['solr_last_modified'] = 'Zuletzt geändert'; $lang['debug']['solr_size'] = 'Größe'; $lang['debug']['solr_docs'] = 'Dokumente'; +$lang['debug']['disk_usage'] = 'Festplattenauslastung'; +$lang['debug']['containers_info'] = "Container-Informationen"; + +$lang['debug']['disk_space'] = "Verfügbarer Speicherplatz:"; +$lang['debug']['disk_used'] = "Von Mailboxen belegter Speicherplatz:"; +$lang['debug']['total_quota'] = "Zugewiesener Domain-Speicherplatz:"; + $lang['quarantine']['release_body'] = "Die ursprüngliche Nachricht wurde als EML-Datei im Anhang hinterlegt."; $lang['danger']['release_send_failed'] = "Die Nachricht konnte nicht versendet werden: %s"; $lang['quarantine']['release_subject'] = "Potentiell schädliche Nachricht aus Quarantäne: %s"; diff --git a/data/web/lang/lang.en.php b/data/web/lang/lang.en.php index ec0d2019..be7033db 100644 --- a/data/web/lang/lang.en.php +++ b/data/web/lang/lang.en.php @@ -820,6 +820,10 @@ $lang['debug']['disk_usage'] = 'Disk usage'; $lang['debug']['containers_info'] = "Container information"; $lang['debug']['restart_container'] = 'Restart'; +$lang['debug']['disk_space'] = "Available disk space:"; +$lang['debug']['disk_used'] = "Disk space occupied by mailboxes:"; +$lang['debug']['total_quota'] = "Total amount of assigned domain quota:"; + $lang['quarantine']['release_body'] = "We have attached your message as eml file to this message."; $lang['danger']['release_send_failed'] = "Message could not be released: %s"; $lang['quarantine']['release_subject'] = "Potentially damaging quarantine item %s"; @@ -915,4 +919,3 @@ $lang['mailbox']['alias_domain_backupmx'] = 'Alias domain inactive for relay dom $lang['danger']['extra_acl_invalid'] = 'External sender address "%s" is invalid'; $lang['danger']['extra_acl_invalid_domain'] = 'External sender "%s" uses an invalid domain'; -