SF.net SVN: postfixadmin:[516] trunk
Brought to you by:
christian_boltz,
gingerdog
From: <Gin...@us...> - 2009-01-15 11:19:57
|
Revision: 516 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=516&view=rev Author: GingerDog Date: 2009-01-15 11:19:51 +0000 (Thu, 15 Jan 2009) Log Message: ----------- add patch for domain postcreation script; see https://sourceforge.net/tracker/index.php?func=detail&aid=2508593&group_id=191583&atid=937966 Modified Paths: -------------- trunk/config.inc.php trunk/create-domain.php trunk/functions.inc.php Modified: trunk/config.inc.php =================================================================== --- trunk/config.inc.php 2009-01-14 16:03:50 UTC (rev 515) +++ trunk/config.inc.php 2009-01-15 11:19:51 UTC (rev 516) @@ -307,6 +307,13 @@ // $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 // operating system features (such as SELinux) or limitations Modified: trunk/create-domain.php =================================================================== --- trunk/create-domain.php 2009-01-14 16:03:50 UTC (rev 515) +++ trunk/create-domain.php 2009-01-15 11:19:51 UTC (rev 516) @@ -136,6 +136,10 @@ } $tMessage = $PALANG['pAdminCreate_domain_result_success'] . "<br />($fDomain)</br />"; } + if (!domain_postcreation($fDomain)) + { + $tMessage = $PALANG['pAdminCreate_domain_error']; + } } } Modified: trunk/functions.inc.php =================================================================== --- trunk/functions.inc.php 2009-01-14 16:03:50 UTC (rev 515) +++ trunk/functions.inc.php 2009-01-15 11:19:51 UTC (rev 516) @@ -1805,6 +1805,42 @@ } /* + 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. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |