Pour #1350
This commit is contained in:
parent
bc0af080fc
commit
e695678a4c
|
@ -610,6 +610,7 @@ src/functions.sh -text
|
||||||
src/functions_dns.sh -text
|
src/functions_dns.sh -text
|
||||||
src/functions_hosting.sh -text
|
src/functions_hosting.sh -text
|
||||||
src/inotify_update_domains.sh -text
|
src/inotify_update_domains.sh -text
|
||||||
|
src/mail_dodelete.php -text
|
||||||
src/mem_add -text
|
src/mem_add -text
|
||||||
src/mem_del -text
|
src/mem_del -text
|
||||||
src/popimap-log-login.sh -text
|
src/popimap-log-login.sh -text
|
||||||
|
|
|
@ -405,6 +405,16 @@ ORDER BY
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// return the alternc account's ID of the mail_id
|
||||||
|
function get_account_by_mail_id($mail_id) {
|
||||||
|
global $db,$err;
|
||||||
|
$db->query("select compte as uid from domaines d, address a where a.domain_id = d.id and a.id = $mail_id");
|
||||||
|
if ( !$db->next_record()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return $db->f('uid');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ----------------------------------------------------------------- */
|
/* ----------------------------------------------------------------- */
|
||||||
/** Function used to delete a mail from the db
|
/** Function used to delete a mail from the db
|
||||||
|
@ -429,6 +439,9 @@ ORDER BY
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$mailinfos=$this->get_details($mail_id);
|
||||||
|
$hooks->invoke('hook_mail_delete', array($mail_id, $mailinfos['address'].'@'.$mailinfos['domain'] ));
|
||||||
|
|
||||||
// Search for that address:
|
// Search for that address:
|
||||||
$db->query("SELECT a.id, a.type, a.mail_action, m.mail_action AS mailbox_action, NOT ISNULL(m.id) AS islocal FROM address a LEFT JOIN mailbox m ON m.address_id=a.id WHERE a.id='$mail_id';");
|
$db->query("SELECT a.id, a.type, a.mail_action, m.mail_action AS mailbox_action, NOT ISNULL(m.id) AS islocal FROM address a LEFT JOIN mailbox m ON m.address_id=a.id WHERE a.id='$mail_id';");
|
||||||
if (!$db->next_record()) {
|
if (!$db->next_record()) {
|
||||||
|
|
|
@ -65,6 +65,22 @@ class m_roundcube {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* ----------------------------------------------------------------- */
|
||||||
|
/** Hook called when an email is REALLY deleted (by the cron, not just in the panel)
|
||||||
|
* @param mail_id integer the ID of the mail in the AlternC database
|
||||||
|
* @param fullmail string the deleted mail himself in the form of john@domain.tld
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
function hook_mail_delete_for_real($mail_id, $fullmail) {
|
||||||
|
// FIXME do something !
|
||||||
|
// Include Roundcube configuration
|
||||||
|
// Delete from the roundcube configuration
|
||||||
|
// Use cleandb.sh filled by roundcube ?
|
||||||
|
printvar($mail_id);
|
||||||
|
printvar($fullmail);
|
||||||
|
}
|
||||||
|
|
||||||
} /* Class Roundcube */
|
} /* Class Roundcube */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
# Purpose of file: Makefile des binaires de /usr/lib/alternc
|
# Purpose of file: Makefile des binaires de /usr/lib/alternc
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
SCRIPTS=sqlbackup.sh quota_init quota_delete update_domains.sh slave_dns sendmail spoolsize.php fixperms.sh alternc-dboptimize export_account.php cron_users_doit.sh cron_users.sh compress_logs.sh delete_logs.sh quota-warning.sh update_mails.sh alternc_add_policy_dovecot rebuild_all_webconf.sh courier-dovecot-migrate.pl popimap-log-login.sh mem_add mem_del quota_edit quota_get du.pl update_quota_mail.sh inotify_update_domains.sh functions.sh functions_hosting.sh functions_dns.sh
|
SCRIPTS=sqlbackup.sh quota_init quota_delete update_domains.sh slave_dns sendmail spoolsize.php fixperms.sh alternc-dboptimize export_account.php cron_users_doit.sh cron_users.sh compress_logs.sh delete_logs.sh quota-warning.sh update_mails.sh alternc_add_policy_dovecot rebuild_all_webconf.sh courier-dovecot-migrate.pl popimap-log-login.sh mem_add mem_del quota_edit quota_get du.pl update_quota_mail.sh inotify_update_domains.sh functions.sh functions_hosting.sh functions_dns.sh mail_dodelete.php
|
||||||
BIN=$(DESTDIR)/usr/lib/alternc/
|
BIN=$(DESTDIR)/usr/lib/alternc/
|
||||||
|
|
||||||
install:
|
install:
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
#!/usr/bin/php -q
|
||||||
|
<?php
|
||||||
|
// Launch the hooks for a real deletion of the mail whose ID is in parameters
|
||||||
|
|
||||||
|
$mail_id = @intval($argv[1]);
|
||||||
|
if (empty($mail_id) ) {
|
||||||
|
die('You must specified a valid mail id (integer)');
|
||||||
|
}
|
||||||
|
|
||||||
|
require_once("/var/alternc/bureau/class/config_nochk.php");
|
||||||
|
|
||||||
|
// Wich account should I be ?
|
||||||
|
$uid=$mail->get_account_by_mail_id($mail_id);
|
||||||
|
|
||||||
|
// Ok, so be it
|
||||||
|
$mem->su($uid);
|
||||||
|
|
||||||
|
// Get the mails informations
|
||||||
|
$mailinfos=$mail->get_details($mail_id);
|
||||||
|
// AND CALL THE HOOKS
|
||||||
|
$hooks->invoke('hook_mail_delete_for_real', array($mail_id, $mailinfos['address'].'@'.$mailinfos['domain'] ));
|
||||||
|
|
||||||
|
// Bye bye
|
||||||
|
|
||||||
|
echo "\n\n";
|
||||||
|
|
||||||
|
?>
|
|
@ -43,6 +43,7 @@ echo $$ > "$LOCK_FILE"
|
||||||
# If process is interrupted, the row isn't deleted. We have to force it by reseting mail_action to 'DELETE'
|
# If process is interrupted, the row isn't deleted. We have to force it by reseting mail_action to 'DELETE'
|
||||||
mysql_query "SELECT id, quote(replace(path,'!','\\!')) FROM mailbox WHERE mail_action='DELETE';"|while read id path ; do
|
mysql_query "SELECT id, quote(replace(path,'!','\\!')) FROM mailbox WHERE mail_action='DELETE';"|while read id path ; do
|
||||||
mysql_query "UPDATE mailbox set mail_action='DELETING' WHERE id=$id;"
|
mysql_query "UPDATE mailbox set mail_action='DELETING' WHERE id=$id;"
|
||||||
|
/usr/lib/alternc/mail_dodelete.php "$id"
|
||||||
# Check there is no instruction of changing directory, and check the first part of the string
|
# Check there is no instruction of changing directory, and check the first part of the string
|
||||||
if [[ "$path" =~ '../' || "$path" =~ '/..' || ! "'$ALTERNC_MAIL_LOC" == "${path:0:$((${#ALTERNC_MAIL_LOC}+1))}" ]] ; then
|
if [[ "$path" =~ '../' || "$path" =~ '/..' || ! "'$ALTERNC_MAIL_LOC" == "${path:0:$((${#ALTERNC_MAIL_LOC}+1))}" ]] ; then
|
||||||
# The path will be empty for mailman addresses
|
# The path will be empty for mailman addresses
|
||||||
|
|
Loading…
Reference in New Issue