You've already forked postfixadmin
mirror of
https://github.com/postfixadmin/postfixadmin.git
synced 2025-08-09 05:02:44 +03:00
functions.inc.php, DomainHandler, MailboxHandler:
- move mailbox_postdeletion() to MailboxHandler - move domain_postcreation() and domain_postdeletion() to DomainHandler - adopt those functions for usage inside the *Handler (replace print with $this->errormsg etc.) git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1579 a1433add-5e2c-0410-b055-b7f2511e0802
This commit is contained in:
@@ -1606,104 +1606,6 @@ function table_by_key ($table_key) {
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Called after a mailbox has been deleted in the DBMS.
|
||||
Returns: boolean.
|
||||
*/
|
||||
function mailbox_postdeletion($username,$domain) {
|
||||
$cmd = Config::read('mailbox_postdeletion_script');
|
||||
|
||||
if ( empty($cmd) ) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (empty($username) || empty($domain)) {
|
||||
print '<p>Warning: empty username and/or domain parameter.</p>';
|
||||
return false;
|
||||
}
|
||||
|
||||
$cmdarg1=escapeshellarg($username);
|
||||
$cmdarg2=escapeshellarg($domain);
|
||||
$command = "$cmd $cmdarg1 $cmdarg2";
|
||||
$retval=0;
|
||||
$output=array();
|
||||
$firstline='';
|
||||
$firstline=exec($command,$output,$retval);
|
||||
if (0!=$retval) {
|
||||
error_log("Running $command yielded return value=$retval, first line of output=$firstline");
|
||||
print '<p>WARNING: Problems running mailbox postdeletion script!</p>';
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
Called after a domain has been added in the DBMS.
|
||||
Returns: boolean.
|
||||
*/
|
||||
# TODO: move to DomainHandler
|
||||
# TODO: replace "print" with $this->errormsg (or infomsg?)
|
||||
function domain_postcreation($domain) {
|
||||
$script=Config::read('domain_postcreation_script');
|
||||
|
||||
if (empty($script)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (empty($domain)) {
|
||||
print '<p>Warning: empty domain parameter.</p>';
|
||||
return false;
|
||||
}
|
||||
|
||||
$cmdarg1=escapeshellarg($domain);
|
||||
$command= "$script $cmdarg1";
|
||||
$retval=0;
|
||||
$output=array();
|
||||
$firstline='';
|
||||
$firstline=exec($command,$output,$retval);
|
||||
if (0!=$retval) {
|
||||
error_log("Running $command yielded return value=$retval, first line of output=$firstline");
|
||||
print '<p>WARNING: Problems running domain postcreation script!</p>';
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
Called after a domain has been deleted in the DBMS.
|
||||
Returns: boolean.
|
||||
*/
|
||||
# TODO: move to DomainHandler (after moving the delete code there)
|
||||
# TODO: replace "print" with $this->errormsg (or infomsg?)
|
||||
function domain_postdeletion($domain) {
|
||||
$script=Config::read('domain_postdeletion_script');
|
||||
|
||||
if (empty($script)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (empty($domain)) {
|
||||
print '<p>Warning: empty domain parameter.</p>';
|
||||
return false;
|
||||
}
|
||||
|
||||
$cmdarg1=escapeshellarg($domain);
|
||||
$command= "$script $cmdarg1";
|
||||
$retval=0;
|
||||
$output=array();
|
||||
$firstline='';
|
||||
$firstline=exec($command,$output,$retval);
|
||||
if (0!=$retval) {
|
||||
error_log("Running $command yielded return value=$retval, first line of output=$firstline");
|
||||
print '<p>WARNING: Problems running domain postdeletion script!</p>';
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
Called after an alias_domain has been deleted in the DBMS.
|
||||
Returns: boolean.
|
||||
|
Reference in New Issue
Block a user