Ehm... this new piece of code Code: // Spamassassin directory anlegen if(!is_dir($web_path."/user/".$user_username."/.spamassassin")) { mkdir($web_path."/user/".$user_username."/.spamassassin", 0700); $mod->log->caselog("chown ".$user_username.":web".$web_doc_id." ".$web_path."/user/" .$user_username."/.spamassassin"); } if(!is_link($web_path."/user/".$user_username."/.spamassassin/user_prefs")) { symlink($web_path."/user/".$user_username."/.user_prefs",$web_path."/user/".$user_us ername."/.spamassassin/user_prefs"); } I don't think this also works correctly the "admin user" where the homedir is not /home/www/webXX/user/webXX_user/ but only /home/www/webXX/
Why did you do that? I like your software, and I mean no disrespect at all. By why put a feature/hack in there that does not apply to all the cases (here: users). I now know its behavior but either do it completely or just leave it would be my way to do it...
Oh well but instead of complaining why don't you just add code similar to this to your own from above Code: if($user["user_admin"]) { @unlink($web_path."/.spamassassin"); symlink($web_path."/user/".$user_username."/.spamassassin/", $web_path."/.spamassassin"); }
The faeture is experimental, ISPConfig 2.2.16 had to be released instantly due to a bug in Clamav, so there was no time for further testing it and I do not add any additional code that I'am not able to test extensively.
Its neither a bug nor a hack. Its a experimental function in 2.2.16 to implement links for spamd for non admin users.
No. Even if you use this function, there are no problems. What jmroth pointed out is, that the function is just implemented for normal users and not administrators. I agree with him that this was not a good solution to implement this for users only.
My previous snippet doesn't work! (unlink doesnt delete (empty) directories!) I have added recursive delete to the file class (i hate using "exec") Code: /** * Delete a file, or a folder and its contents * * @author Aidan Lister <[email protected]> * @version 1.0.3 * @link http://aidanlister.com/repos/v/function.rmdirr.php * @param string $dirname Directory to delete * @return bool Returns TRUE on success, FALSE on failure */ function rmdirr($dirname) { // Sanity check if (!file_exists($dirname)) { return false; } // Simple delete for a file if (is_file($dirname) || is_link($dirname)) { return unlink($dirname); } // Loop through the folder $dir = dir($dirname); while (false !== $entry = $dir->read()) { // Skip pointers if ($entry == '.' || $entry == '..') { continue; } // Recurse $this->rmdirr($dirname . DIRECTORY_SEPARATOR . $entry); } // Clean up $dir->close(); return rmdir($dirname); } Then I have added to config.lib.php around lines 745 (user insert) and 930 (user update) Code: // Spamassassin directory anlegen if(!is_dir($web_path."/user/".$user_username."/.spamassassin")) { mkdir($web_path."/user/".$user_username."/.spamassassin", 0700); $mod->log->caselog("chown ".$user_username.":web".$web_doc_id." ".$web_path\ ."/user/".$user_username."/.spamassassin"); } if(!is_link($web_path."/user/".$user_username."/.spamassassin/user_prefs")) { symlink($web_path."/user/".$user_username."/.user_prefs", $web_path."/user/".$user_username."/.spamassassin/user_prefs"); } + if($user["user_admin"]) { + $mod->file->rmdirr($web_path."/.spamassassin"); + symlink($web_path."/user/".$user_username."/.spamassassin/", + $web_path."/.spamassassin"); + } Maybe one could put that in an extra function, as it is completely the same twice. Not sure how you handle code reuse in ispconfig
There was another unhandled case when user_prefs already existed but was not a link... What follows is the new updated code around lines 741 and 928 Code: if(!is_link($web_path."/user/".$user_username."/.spamassassin/user_prefs")) { if (is_file($web_path."/user/".$user_username."/.spamassassin/user_prefs")) @unlink($web_path."/user/".$user_username."/.spamassassin/user_prefs"); symlink($web_path."/user/".$user_username."/.user_prefs",$web_path."/user/".$user_username."/.spamassassin/user_prefs"); } if($user["user_admin"]) { $mod->file->rmdirr($web_path."/.spamassassin"); symlink($web_path."/user/".$user_username."/.spamassassin/", $web_path."/.spamassassin"); }