mirror of
https://github.com/postfixadmin/postfixadmin.git
synced 2024-09-19 19:22:14 +02:00
add patch for domain postcreation script; see https://sourceforge.net/tracker/index.php?func=detail&aid=2508593&group_id=191583&atid=937966
git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@516 a1433add-5e2c-0410-b055-b7f2511e0802
This commit is contained in:
parent
dbff1d5210
commit
723090d6d0
@ -306,6 +306,13 @@ $CONF['show_custom_colors']=array("lightgreen","lightblue");
|
||||
// prevent the web-server from executing external scripts.
|
||||
// $CONF['mailbox_postdeletion_script']='sudo -u courier /usr/local/bin/postfixadmin-mailbox-postdeletion.sh';
|
||||
|
||||
// Optional:
|
||||
// Script to run after creation of domains.
|
||||
// Note that this may fail if PHP is run in "safe mode", or if
|
||||
// operating system features (such as SELinux) or limitations
|
||||
// prevent the web-server from executing external scripts.
|
||||
$CONF['domain_postcreation_script']='sudo -u courier /usr/local/bin/postfixadmin-domain-postcreation.sh';
|
||||
|
||||
// Optional:
|
||||
// Script to run after deletion of domains.
|
||||
// Note that this may fail if PHP is run in "safe mode", or if
|
||||
|
@ -136,6 +136,10 @@ if ($_SERVER['REQUEST_METHOD'] == "POST")
|
||||
}
|
||||
$tMessage = $PALANG['pAdminCreate_domain_result_success'] . "<br />($fDomain)</br />";
|
||||
}
|
||||
if (!domain_postcreation($fDomain))
|
||||
{
|
||||
$tMessage = $PALANG['pAdminCreate_domain_error'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1804,6 +1804,42 @@ function mailbox_postdeletion($username,$domain)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
Called after a domain has been added in the DBMS.
|
||||
Returns: boolean.
|
||||
*/
|
||||
function domain_postcreation($domain)
|
||||
{
|
||||
global $CONF;
|
||||
$confpar='domain_postcreation_script';
|
||||
|
||||
if (!isset($CONF[$confpar]) || empty($CONF[$confpar]))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
if (empty($domain))
|
||||
{
|
||||
print '<p>Warning: empty domain parameter.</p>';
|
||||
return false;
|
||||
}
|
||||
|
||||
$cmdarg1=escapeshellarg($domain);
|
||||
$command=$CONF[$confpar]." $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.
|
||||
|
Loading…
Reference in New Issue
Block a user