SF.net SVN: postfixadmin:[826] trunk
Brought to you by:
christian_boltz,
gingerdog
From: <chr...@us...> - 2010-05-17 21:32:27
|
Revision: 826 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=826&view=rev Author: christian_boltz Date: 2010-05-17 21:32:21 +0000 (Mon, 17 May 2010) Log Message: ----------- - move maildir_name_hook example function to config.inc.php - write to error_log if imap folder creation fails Modified Paths: -------------- trunk/config.inc.php trunk/functions.inc.php Modified: trunk/config.inc.php =================================================================== --- trunk/config.inc.php 2010-05-17 20:52:20 UTC (rev 825) +++ trunk/config.inc.php 2010-05-17 21:32:21 UTC (rev 826) @@ -150,10 +150,34 @@ // If you want to define your own function to generate a maildir path set this to the name of the function. // Notes: // - this configuration directive will override both domain_path and domain_in_mailbox -// - the maildir_name_hook() function example is present in functions.inc.php comments +// - the maildir_name_hook() function example is present below, commented out // - if the function does not exist the program will default to the above domain_path and domain_in_mailbox settings $CONF['maildir_name_hook'] = 'NO'; +/* + maildir_name_hook example function + + Called by create-mailbox.php if $CONF['maildir_name_hook'] == '<name_of_the_function>' + - allows for customized maildir paths determined by a custom function + - the example below will prepend a single-character directory to the + beginning of the maildir, splitting domains more or less evenly over + 36 directories for improved filesystem performance with large numbers + of domains. + + Returns: maildir path + ie. I/example.com/user/ +*/ +/* +function maildir_name_hook($domain, $user) { + $chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + + $dir_index = hexdec(substr(md5($domain), 28)) % strlen($chars); + $dir = substr($chars, $dir_index, 1); + return sprintf("%s/%s/%s/", $dir, $domain, $user); +} +*/ + + // Default Domain Values // Specify your default values below. Quota in MB. $CONF['aliases'] = '10'; Modified: trunk/functions.inc.php =================================================================== --- trunk/functions.inc.php 2010-05-17 20:52:20 UTC (rev 825) +++ trunk/functions.inc.php 2010-05-17 21:32:21 UTC (rev 826) @@ -2113,6 +2113,7 @@ $f='{'.$s_host.'}'.$s_prefix.$f; $res=imap_createmailbox($i,$f); if (!$res) { + error_log('Could not create IMAP folder $f: '.imap_last_error()); @imap_close($i); return FALSE; } @@ -2372,29 +2373,6 @@ } } -+/* - maildir_name_hook - - Called by create-mailbox.php if $CONF['maildir_name_hook'] == 'YES' - - allows for customized maildir paths determined by a custom function - - the below example will return append a single-character directory to the - beginning of the maildir, splitting domains more or less evenly over - 36 directories for improved filesystem performance with large numbers - of domains. - - Returns: maildir path - ie. I/example.com/user/ - */ -/* -function maildir_name_hook($domain, $user) { - $chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - - $dir_index = hexdec(substr(md5($domain), 28)) % strlen($chars); - $dir = substr($chars, $dir_index, 1); - return sprintf("%s/%s/%s/", $dir, $domain, $user); -} - */ - $table_admin = table_by_key ('admin'); $table_alias = table_by_key ('alias'); $table_alias_domain = table_by_key ('alias_domain'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |