[Web] Allow to set max_age for quarantine items

master
andryyy 2019-06-01 21:22:14 +02:00
parent 5f8dd69a2d
commit 176f2a3f34
No known key found for this signature in database
GPG Key ID: 8EC34FF2794E25EF
4 changed files with 16 additions and 2 deletions

View File

@ -621,18 +621,24 @@ $tfa_data = get_tfa();
<?php $q_data = quarantine('settings');?>
<form class="form" data-id="quarantine" role="form" method="post">
<div class="row">
<div class="col-sm-6">
<div class="col-sm-4">
<div class="form-group">
<label for="retention_size"><?=$lang['admin']['quarantine_retention_size'];?></label>
<input type="number" class="form-control" name="retention_size" value="<?=$q_data['retention_size'];?>" placeholder="0" required>
</div>
</div>
<div class="col-sm-6">
<div class="col-sm-4">
<div class="form-group">
<label for="max_size"><?=$lang['admin']['quarantine_max_size'];?></label>
<input type="number" class="form-control" name="max_size" value="<?=$q_data['max_size'];?>" placeholder="0" required>
</div>
</div>
<div class="col-sm-4">
<div class="form-group">
<label for="max_age"><?=$lang['admin']['quarantine_max_age'];?></label>
<input type="number" class="form-control" name="max_age" value="<?=$q_data['max_age'];?>" min="1" required>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">

View File

@ -296,13 +296,18 @@ function quarantine($_action, $_data = null) {
$release_format = 'raw';
}
$max_size = $_data['max_size'];
$max_age = intval($_data['max_age']);
$subject = $_data['subject'];
$sender = $_data['sender'];
$html = $_data['html_tmpl'];
if ($max_age <= 0) {
$max_age = 365;
}
$exclude_domains = (array)$_data['exclude_domains'];
try {
$redis->Set('Q_RETENTION_SIZE', intval($retention_size));
$redis->Set('Q_MAX_SIZE', intval($max_size));
$redis->Set('Q_MAX_AGE', $max_age);
$redis->Set('Q_EXCLUDE_DOMAINS', json_encode($exclude_domains));
$redis->Set('Q_RELEASE_FORMAT', $release_format);
$redis->Set('Q_SENDER', $sender);
@ -647,6 +652,7 @@ function quarantine($_action, $_data = null) {
$settings['exclude_domains'] = json_decode($redis->Get('Q_EXCLUDE_DOMAINS'), true);
}
$settings['max_size'] = $redis->Get('Q_MAX_SIZE');
$settings['max_age'] = $redis->Get('Q_MAX_AGE');
$settings['retention_size'] = $redis->Get('Q_RETENTION_SIZE');
$settings['release_format'] = $redis->Get('Q_RELEASE_FORMAT');
$settings['subject'] = $redis->Get('Q_SUBJ');

View File

@ -650,6 +650,7 @@ $lang['admin']['active_rspamd_settings_map'] = "Derzeit aktive Settings Map";
$lang['admin']['quota_notifications_info'] = "Quota Benachrichtigungen werden an Mailboxen versendet, die 80 respektive 95 Prozent der zur Verfügung stehenden Quota überschreiten.";
$lang['admin']['quarantine_retention_size'] = "Rückhaltungen pro Mailbox:<br><small>0 bedeutet <b>inaktiv</b>.</small>";
$lang['admin']['quarantine_max_size'] = "Maximale Größe in MiB (größere Elemente werden verworfen):<br><small>0 bedeutet <b>nicht</b> unlimitert.</small>";
$lang['admin']['quarantine_max_age'] = "Maximales Alter in Tagen<br><small>Wert muss größer oder gleich 1 Tag sein.</small>";
$lang['admin']['quarantine_exclude_domains'] = "Domains und Alias-Domains ausschließen";
$lang['admin']['quarantine_notification_sender'] = "Benachrichtigungs-E-Mail Absender";
$lang['admin']['quota_notification_sender'] = "Benachrichtigungs-E-Mail Absender";

View File

@ -687,6 +687,7 @@ $lang['admin']['active_rspamd_settings_map'] = "Active settings map";
$lang['admin']['quota_notifications_info'] = "Quota notications are sent to users once when crossing 80% and once when crossing 95% usage.";
$lang['admin']['quarantine_retention_size'] = "Retentions per mailbox:<br><small>0 indicates <b>inactive</b>.</small>";
$lang['admin']['quarantine_max_size'] = "Maximum size in MiB (larger elements are discarded):<br><small>0 does <b>not</b> indicate unlimited.</small>";
$lang['admin']['quarantine_max_age'] = "Maximum age in days<br><small>Value must be equal to or greater than 1 day.</small>";
$lang['admin']['quarantine_exclude_domains'] = "Exclude domains and alias-domains";
$lang['admin']['quarantine_release_format'] = "Format of released items";
$lang['admin']['quarantine_release_format_raw'] = "Unmodified original";