Commit c40524c4 authored by Florian Schaal's avatar Florian Schaal
Browse files

purge trash and junk (Implements #5634)

parent 20e52c33
......@@ -20,3 +20,6 @@ UPDATE `dns_ssl_ca` SET `ca_name` = 'Sectigo / Comodo CA' WHERE `ca_issue` = 'co
-- default php-fpm to ondemand mode
ALTER TABLE `web_domain` ALTER pm SET DEFAULT 'ondemand';
ALTER TABLE `mail_user`
ADD `purge_trash_days` INT NOT NULL DEFAULT '0' AFTER `move_junk`,
ADD `purge_junk_days` INT NOT NULL DEFAULT '0' AFTER `purge_trash_days`;
......@@ -1047,6 +1047,8 @@ CREATE TABLE `mail_user` (
`autoresponder_subject` varchar(255) NOT NULL default 'Out of office reply',
`autoresponder_text` mediumtext NULL,
`move_junk` enum('n','y') NOT NULL default 'n',
`purge_trash_days` INT NOT NULL DEFAULT '0',
`purge_junk_days` INT NOT NULL DEFAULT '0',
`custom_mailfilter` mediumtext,
`postfix` enum('n','y') NOT NULL default 'y',
`greylisting` enum('n','y' ) NOT NULL DEFAULT 'n',
......
......@@ -406,6 +406,20 @@ if ($global_config['mail']['mailbox_show_mail_filter_tab'] === 'y') {
'default' => 'n',
'value' => array(0 => 'n', 1 => 'y')
),
'purge_trash_days' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'validators' => array (
),
'default' => '0',
),
'purge_junk_days' => array (
'datatype' => 'VARCHAR',
'formtype' => 'TEXT',
'validators' => array (
),
'default' => '0',
),
//#################################
// END Datatable fields
//#################################
......
......@@ -62,4 +62,8 @@ $wb['sender_cc_txt'] = 'Send outgoing BCC to';
$wb['sender_cc_error_isemail'] = 'The -Send outgoing copy to- field does not contain a valid email address';
$wb['sender_cc_note_txt'] = '(Separate multiple email addresses with commas)';
$wb['password_click_to_set_txt'] = 'Click to set';
$wb['purge_trash_days_txt'] = 'Purge Trash automatically after X days';
$wb['tooltip_purge_trash_days_txt'] = '0 = disabled';
$wb['purge_junk_days_txt'] = 'Purge Junk automatically after X days';
$wb['tooltip_purge_junk_days_txt'] = '0 = disabled';
?>
......@@ -62,4 +62,8 @@ $wb['weekly_backup_txt'] = 'Weekly';
$wb['monthly_backup_txt'] = 'Monthly';
$wb['sender_cc_note_txt'] = '(Separate multiple email addresses with commas)';
$wb['password_click_to_set_txt'] = 'Click to set';
$wb['purge_trash_days_txt'] = 'Purge Trash automatically after X days';
$wb['tooltip_purge_trash_days_txt'] = '0 = disabled';
$wb['purge_junk_days_txt'] = 'Purge Junk automatically after X days';
$wb['tooltip_purge_junk_days_txt'] = '0 = disabled';
?>
......@@ -62,4 +62,8 @@ $wb['monthly_backup_txt'] = 'Mensal';
$wb['email_error_isascii'] = 'Por favor, não use caracteres especiais para a senha. Isto poderá causar problemas no cliente de e-mail.';
$wb['cc_note_txt'] = '(separar múltiplos endereços de e-mails com vírgulas)';
$wb['sender_cc_note_txt'] = '(separar múltiplos endereços de e-mails com vírgulas)';
$wb['purge_trash_days_txt'] = 'Purge Trash automatically after X days';
$wb['tooltip_purge_trash_days_txt'] = '0 = disabled';
$wb['purge_junk_days_txt'] = 'Purge Junk automatically after X days';
$wb['tooltip_purge_junk_days_txt'] = '0 = disabled';
?>
......@@ -62,4 +62,8 @@ $wb['weekly_backup_txt'] = 'Weekly';
$wb['monthly_backup_txt'] = 'Monthly';
$wb['sender_cc_note_txt'] = '(Separate multiple email addresses with commas)';
$wb['password_click_to_set_txt'] = 'Click to set';
$wb['purge_trash_days_txt'] = 'Purge Trash automatically after X days';
$wb['tooltip_purge_trash_days_txt'] = '0 = disabled';
$wb['purge_junk_days_txt'] = 'Purge Junk automatically after X days';
$wb['tooltip_purge_junk_days_txt'] = '0 = disabled';
?>
......@@ -62,4 +62,8 @@ $wb['weekly_backup_txt'] = 'Týdenní';
$wb['monthly_backup_txt'] = 'Měsíční';
$wb['sender_cc_note_txt'] = '(Při posílání kopií na více e-mailových adres, oddělte čárkami.) ';
$wb['password_click_to_set_txt'] = 'Pro nastavení klikni zde';
$wb['purge_trash_days_txt'] = 'Purge Trash automatically after X days';
$wb['tooltip_purge_trash_days_txt'] = '0 = disabled';
$wb['purge_junk_days_txt'] = 'Purge Junk automatically after X days';
$wb['tooltip_purge_junk_days_txt'] = '0 = disabled';
?>
......@@ -62,4 +62,8 @@ $wb['sender_cc_txt'] = 'Kopie ausgehender Emails senden an (BCC)';
$wb['sender_cc_error_isemail'] = '-Kopie ausgehender Emails senden an- Feld enthält keine gültige Emailadresse';
$wb['sender_cc_note_txt'] = '(Mehrere E-Mail-Adressen mit Kommas trennen)';
$wb['password_click_to_set_txt'] = 'Click to set';
$wb['purge_trash_days_txt'] = 'Purge Trash automatically after X days';
$wb['tooltip_purge_trash_days_txt'] = '0 = disabled';
$wb['purge_junk_days_txt'] = 'Purge Junk automatically after X days';
$wb['tooltip_purge_junk_days_txt'] = '0 = disabled';
?>
......@@ -62,4 +62,8 @@ $wb['daily_backup_txt'] = 'Daily';
$wb['weekly_backup_txt'] = 'Weekly';
$wb['monthly_backup_txt'] = 'Monthly';
$wb['sender_cc_note_txt'] = '(Separate multiple email addresses with commas)';
$wb['purge_trash_days_txt'] = 'Purge Trash automatically after X days';
$wb['tooltip_purge_trash_days_txt'] = '0 = disabled';
$wb['purge_junk_days_txt'] = 'Purge Junk automatically after X days';
$wb['tooltip_purge_junk_days_txt'] = '0 = disabled';
?>
......@@ -62,4 +62,8 @@ $wb['weekly_backup_txt'] = 'Weekly';
$wb['monthly_backup_txt'] = 'Monthly';
$wb['sender_cc_note_txt'] = '(Separate multiple email addresses with commas)';
$wb['password_click_to_set_txt'] = 'Click to set';
$wb['purge_trash_days_txt'] = 'Purge Trash automatically after X days';
$wb['tooltip_purge_trash_days_txt'] = '0 = disabled';
$wb['purge_junk_days_txt'] = 'Purge Junk automatically after X days';
$wb['tooltip_purge_junk_days_txt'] = '0 = disabled';
?>
......@@ -62,4 +62,8 @@ $wb['monthly_backup_txt'] = 'Monthly';
$wb['email_error_isascii'] = 'Please do not use special unicode characters for your password. This could lead to problems with your mail client.';
$wb['cc_note_txt'] = '(Separate multiple email addresses with commas)';
$wb['sender_cc_note_txt'] = '(Separate multiple email addresses with commas)';
$wb['purge_trash_days_txt'] = 'Purge Trash automatically after X days';
$wb['tooltip_purge_trash_days_txt'] = '0 = disabled';
$wb['purge_junk_days_txt'] = 'Purge Junk automatically after X days';
$wb['tooltip_purge_junk_days_txt'] = '0 = disabled';
?>
......@@ -62,4 +62,8 @@ $wb['sender_cc_txt'] = 'Enviar copia saliente a';
$wb['server_id_txt'] = 'id_del_servidor';
$wb['weekly_backup_txt'] = 'Semanalmente';
$wb['password_click_to_set_txt'] = 'Click to set';
$wb['purge_trash_days_txt'] = 'Purge Trash automatically after X days';
$wb['tooltip_purge_trash_days_txt'] = '0 = disabled';
$wb['purge_junk_days_txt'] = 'Purge Junk automatically after X days';
$wb['tooltip_purge_junk_days_txt'] = '0 = disabled';
?>
......@@ -62,4 +62,8 @@ $wb['sender_cc_txt'] = 'Send outgoing BCC to';
$wb['sender_cc_error_isemail'] = 'The -Send outgoing copy to- field does not contain a valid email address';
$wb['sender_cc_note_txt'] = '(Separate multiple email addresses with commas)';
$wb['password_click_to_set_txt'] = 'Click to set';
$wb['purge_trash_days_txt'] = 'Purge Trash automatically after X days';
$wb['tooltip_purge_trash_days_txt'] = '0 = disabled';
$wb['purge_junk_days_txt'] = 'Purge Junk automatically after X days';
$wb['tooltip_purge_junk_days_txt'] = '0 = disabled';
?>
......@@ -62,4 +62,8 @@ $wb['weekly_backup_txt'] = 'Hebdomadaire';
$wb['monthly_backup_txt'] = 'Mensuel';
$wb['sender_cc_note_txt'] = '(Séparer les adresses e-mail multiples par des virgules)';
$wb['password_click_to_set_txt'] = 'Cliquez pour définir';
$wb['purge_trash_days_txt'] = 'Purge Trash automatically after X days';
$wb['tooltip_purge_trash_days_txt'] = '0 = disabled';
$wb['purge_junk_days_txt'] = 'Purge Junk automatically after X days';
$wb['tooltip_purge_junk_days_txt'] = '0 = disabled';
?>
......@@ -62,4 +62,8 @@ $wb['repeat_password_txt'] = 'Repeat Password';
$wb['password_mismatch_txt'] = 'The passwords do not match.';
$wb['password_match_txt'] = 'The passwords do match.';
$wb['sender_cc_note_txt'] = '(Separate multiple email addresses with commas)';
$wb['purge_trash_days_txt'] = 'Purge Trash automatically after X days';
$wb['tooltip_purge_trash_days_txt'] = '0 = disabled';
$wb['purge_junk_days_txt'] = 'Purge Junk automatically after X days';
$wb['tooltip_purge_junk_days_txt'] = '0 = disabled';
?>
......@@ -62,4 +62,8 @@ $wb['autoresponder_start_date_is_required'] = 'Start date must be set when Autor
$wb['sender_cc_txt'] = 'Send outgoing BCC to';
$wb['sender_cc_error_isemail'] = 'The -Send outgoing copy to- field does not contain a valid email address';
$wb['sender_cc_note_txt'] = '(Separate multiple email addresses with commas)';
$wb['purge_trash_days_txt'] = 'Purge Trash automatically after X days';
$wb['tooltip_purge_trash_days_txt'] = '0 = disabled';
$wb['purge_junk_days_txt'] = 'Purge Junk automatically after X days';
$wb['tooltip_purge_junk_days_txt'] = '0 = disabled';
?>
......@@ -62,4 +62,8 @@ $wb['autoresponder_start_date_is_required'] = 'Start date must be set when Autor
$wb['sender_cc_txt'] = 'Send outgoing BCC to';
$wb['sender_cc_error_isemail'] = 'The -Send outgoing copy to- field does not contain a valid email address';
$wb['sender_cc_note_txt'] = '(Separate multiple email addresses with commas)';
$wb['purge_trash_days_txt'] = 'Purge Trash automatically after X days';
$wb['tooltip_purge_trash_days_txt'] = '0 = disabled';
$wb['purge_junk_days_txt'] = 'Purge Junk automatically after X days';
$wb['tooltip_purge_junk_days_txt'] = '0 = disabled';
?>
......@@ -62,4 +62,8 @@ $wb['daily_backup_txt'] = 'Daily';
$wb['weekly_backup_txt'] = 'Weekly';
$wb['monthly_backup_txt'] = 'Monthly';
$wb['sender_cc_note_txt'] = '(Separate multiple email addresses with commas)';
$wb['purge_trash_days_txt'] = 'Purge Trash automatically after X days';
$wb['tooltip_purge_trash_days_txt'] = '0 = disabled';
$wb['purge_junk_days_txt'] = 'Purge Junk automatically after X days';
$wb['tooltip_purge_junk_days_txt'] = '0 = disabled';
?>
......@@ -62,4 +62,8 @@ $wb['autoresponder_start_date_is_required'] = 'Start date must be set when Autor
$wb['sender_cc_txt'] = 'Send outgoing BCC to';
$wb['sender_cc_error_isemail'] = 'The -Send outgoing copy to- field does not contain a valid email address';
$wb['sender_cc_note_txt'] = '(Separate multiple email addresses with commas)';
$wb['purge_trash_days_txt'] = 'Purge Trash automatically after X days';
$wb['tooltip_purge_trash_days_txt'] = '0 = disabled';
$wb['purge_junk_days_txt'] = 'Purge Junk automatically after X days';
$wb['tooltip_purge_junk_days_txt'] = '0 = disabled';
?>
......@@ -61,4 +61,8 @@ $wb['autoresponder_start_date_is_required'] = 'Een startdatun is vereist voor he
$wb['sender_cc_txt'] = 'Stuur uitgaande kopie aan';
$wb['sender_cc_error_isemail'] = 'Het \\"Stuur uitgaande kopie aan\\" veld bevat geen geldig e-mail adres';
$wb['sender_cc_note_txt'] = '(Meerdere e-mail adressen scheiden met een komma)';
$wb['purge_trash_days_txt'] = 'Purge Trash automatically after X days';
$wb['tooltip_purge_trash_days_txt'] = '0 = disabled';
$wb['purge_junk_days_txt'] = 'Purge Junk automatically after X days';
$wb['tooltip_purge_junk_days_txt'] = '0 = disabled';
?>
......@@ -62,4 +62,8 @@ $wb['autoresponder_start_date_is_required'] = 'Start date must be set when Autor
$wb['sender_cc_txt'] = 'Send outgoing BCC to';
$wb['sender_cc_error_isemail'] = 'The -Send outgoing copy to- field does not contain a valid email address';
$wb['sender_cc_note_txt'] = '(Separate multiple email addresses with commas)';
$wb['purge_trash_days_txt'] = 'Purge Trash automatically after X days';
$wb['tooltip_purge_trash_days_txt'] = '0 = disabled';
$wb['purge_junk_days_txt'] = 'Purge Junk automatically after X days';
$wb['tooltip_purge_junk_days_txt'] = '0 = disabled';
?>
......@@ -62,4 +62,8 @@ $wb['autoresponder_start_date_is_required'] = 'Start date must be set when Autor
$wb['sender_cc_txt'] = 'Send outgoing BCC to';
$wb['sender_cc_error_isemail'] = 'The -Send outgoing copy to- field does not contain a valid email address';
$wb['sender_cc_note_txt'] = '(Separate multiple email addresses with commas)';
$wb['purge_trash_days_txt'] = 'Purge Trash automatically after X days';
$wb['tooltip_purge_trash_days_txt'] = '0 = disabled';
$wb['purge_junk_days_txt'] = 'Purge Junk automatically after X days';
$wb['tooltip_purge_junk_days_txt'] = '0 = disabled';
?>
......@@ -62,4 +62,8 @@ $wb['autoresponder_start_date_is_required'] = 'Start date must be set when Autor
$wb['sender_cc_txt'] = 'Send outgoing BCC to';
$wb['sender_cc_error_isemail'] = 'The -Send outgoing copy to- field does not contain a valid email address';
$wb['sender_cc_note_txt'] = '(Separate multiple email addresses with commas)';
$wb['purge_trash_days_txt'] = 'Purge Trash automatically after X days';
$wb['tooltip_purge_trash_days_txt'] = '0 = disabled';
$wb['purge_junk_days_txt'] = 'Purge Junk automatically after X days';
$wb['tooltip_purge_junk_days_txt'] = '0 = disabled';
?>
......@@ -62,4 +62,8 @@ $wb['autoresponder_start_date_is_required'] = 'Дата начала должн
$wb['sender_cc_txt'] = 'Отправка исходящей копии на';
$wb['sender_cc_error_isemail'] = 'Поле -Отправка исходящей копии на- не содержит действительный адрес электронной почты';
$wb['sender_cc_note_txt'] = '(Разделите несколько адресов электронной почты запятыми)';
$wb['purge_trash_days_txt'] = 'Purge Trash automatically after X days';
$wb['tooltip_purge_trash_days_txt'] = '0 = disabled';
$wb['purge_junk_days_txt'] = 'Purge Junk automatically after X days';
$wb['tooltip_purge_junk_days_txt'] = '0 = disabled';
?>
......@@ -62,4 +62,8 @@ $wb['autoresponder_start_date_is_required'] = 'Start date must be set when Autor
$wb['sender_cc_txt'] = 'Send outgoing BCC to';
$wb['sender_cc_error_isemail'] = 'The -Send outgoing copy to- field does not contain a valid email address';
$wb['sender_cc_note_txt'] = '(Separate multiple email addresses with commas)';
$wb['purge_trash_days_txt'] = 'Purge Trash automatically after X days';
$wb['tooltip_purge_trash_days_txt'] = '0 = disabled';
$wb['purge_junk_days_txt'] = 'Purge Junk automatically after X days';
$wb['tooltip_purge_junk_days_txt'] = '0 = disabled';
?>
......@@ -62,4 +62,8 @@ $wb['autoresponder_start_date_is_required'] = 'Start date must be set when Autor
$wb['sender_cc_txt'] = 'Send outgoing BCC to';
$wb['sender_cc_error_isemail'] = 'The -Send outgoing copy to- field does not contain a valid email address';
$wb['sender_cc_note_txt'] = '(Separate multiple email addresses with commas)';
$wb['purge_trash_days_txt'] = 'Purge Trash automatically after X days';
$wb['tooltip_purge_trash_days_txt'] = '0 = disabled';
$wb['purge_junk_days_txt'] = 'Purge Junk automatically after X days';
$wb['tooltip_purge_junk_days_txt'] = '0 = disabled';
?>
......@@ -62,4 +62,8 @@ $wb['monthly_backup_txt'] = 'Aylık';
$wb['email_error_isascii'] = 'E-posta istemcinizde sorun yaşamamak için lütfen parolanızda dile özel unikod karakterler kullanmayın.';
$wb['cc_note_txt'] = '(Birden çok e-posta adresini virgül ile ayırarak yazın)';
$wb['sender_cc_note_txt'] = '(Birden çok e-posta adresini virgül ile ayırarak yazın)';
$wb['purge_trash_days_txt'] = 'Purge Trash automatically after X days';
$wb['tooltip_purge_trash_days_txt'] = '0 = disabled';
$wb['purge_junk_days_txt'] = 'Purge Junk automatically after X days';
$wb['tooltip_purge_junk_days_txt'] = '0 = disabled';
?>
<div class="form-group">
<label class="col-sm-3 control-label">{tmpl_var name='move_junk_txt'}</label>
<div class="col-sm-9">
{tmpl_var name='move_junk'}
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">{tmpl_var name='move_junk_txt'}</label>
<div class="col-sm-9">{tmpl_var name='move_junk'}</div>
</div>
{tmpl_var name='filter_records'}
<div class="form-group">
<label for="purge_trash_days" class="col-sm-3 control-label">{tmpl_var name='purge_trash_days_txt'}</label>
<div class="col-sm-9">
<div class="input-group">
<tmpl_if name="show_config_info">
<input type="text" name="purge_trash_days" id="purge_trash_days" value="{tmpl_var name='purge_trash_days'}" class="form-control" data-toggle="tooltip" title="{tmpl_var name='tooltip_purge_trash_days_txt'}">
<tmpl_else>
<input type="text" name="purge_trash_days" id="purge_trash_days" value="{tmpl_var name='purge_trash_days'}" class="form-control">
</tmpl_if>
</div>
</div>
</div>
<input type="hidden" name="id" value="{tmpl_var name='id'}">
<div class="form-group">
<label for="purge_junk_days" class="col-sm-3 control-label">{tmpl_var name='purge_junk_days_txt'}</label>
<div class="col-sm-9">
<div class="input-group">
<tmpl_if name="show_config_info">
<input type="text" name="purge_junk_days" id="purge_junk_days" value="{tmpl_var name='purge_junk_days'}" class="form-control" data-toggle="tooltip" title="{tmpl_var name='tooltip_purge_junk_days_txt'}">
<tmpl_else>
<input type="text" name="purge_junk_days" id="purge_junk_days" value="{tmpl_var name='purge_junk_days'}" class="form-control">
</tmpl_if>
</div>
</div>
</div>
{tmpl_var name='filter_records'}
<div class="clear"><div class="right">
<button class="btn btn-default formbutton-success" type="button" value="{tmpl_var name='btn_save_txt'}" data-submit-form="pageForm" data-form-action="mail/mail_user_edit.php">{tmpl_var name='btn_save_txt'}</button>
<button class="btn btn-default formbutton-default" type="button" value="{tmpl_var name='btn_cancel_txt'}" data-load-content="mail/mail_user_list.php">{tmpl_var name='btn_cancel_txt'}</button>
</div></div>
<input type="hidden" name="id" value="{tmpl_var name='id'}">
<div class="clear"><div class="right">
<button class="btn btn-default formbutton-success" type="button" value="{tmpl_var name='btn_save_txt'}" data-submit-form="pageForm" data-form-action="mail/mail_user_edit.php">{tmpl_var name='btn_save_txt'}</button>
<button class="btn btn-default formbutton-default" type="button" value="{tmpl_var name='btn_cancel_txt'}" data-load-content="mail/mail_user_list.php">{tmpl_var name='btn_cancel_txt'}</button>
</div></div>
<?php
/*
Copyright (c) 2020, Florian Schaal, schaal @it UG
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of ISPConfig nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
class cronjob_clean_mailboxes extends cronjob {
// should run before quota notify and backup
// quota notify and backup is both '0 0 * * *'
// job schedule
protected $_schedule = '00 22 * * *';
/* this function is optional if it contains no custom code */
public function onPrepare() {
global $app;
parent::onPrepare();
}
/* this function is optional if it contains no custom code */
public function onBeforeRun() {
global $app;
return parent::onBeforeRun();
}
public function onRunJob() {
global $app, $conf;
$trash_names=array('Trash', 'Papierkorb', 'Deleted Items', 'Deleted Messages', 'INBOX.Trash', 'INBOX.Papierkorb', 'INBOX.Deleted Messages');
$junk_names=array('Junk', 'Junk Email', 'SPAM', 'INBOX.SPAM');
$purge_cmd = 'doveadm expunge -u ? mailbox ? sentbefore ';
$server_id = intval($conf['server_id']);
$records = $app->db->queryAllRecords("SELECT email, maildir, purge_trash_days, purge_junk_days FROM mail_user WHERE maildir_format = 'maildir' AND disableimap = 'n' AND server_id = ? AND (purge_trash_days > 0 OR purge_junk_days > 0)", $server_id);
if(is_array($records) && !empty($records)) {
foreach($records as $email) {
if($email['purge_trash_days'] > 0) {
foreach($trash_names as $trash) {
if(is_dir($email['maildir'].'/Maildir/.'.$trash)) {
$app->system->exec_safe($purge_cmd.intval($email['purge_trash_days']).'d', $email['email'], $trash);
}
}
}
if($email['purge_junk_days'] > 0) {
foreach($junk_names as $junk) {
if(is_dir($email['maildir'].'/Maildir/.'.$junk)) {
$app->system->exec_safe($purge_cmd.intval($email['purge_junk_days']).'d', $email['email'], $junk);
}
}
}
}
}
parent::onRunJob();
}
/* this function is optional if it contains no custom code */
public function onAfterRun() {
global $app;
parent::onAfterRun();
}
}
?>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment