diff --git a/lib/functions/filedir/function.makeChownWithNewStats.php b/lib/functions/filedir/function.makeChownWithNewStats.php new file mode 100644 index 00000000..291101e6 --- /dev/null +++ b/lib/functions/filedir/function.makeChownWithNewStats.php @@ -0,0 +1,58 @@ + (2010-) + * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt + * @package Functions + * @version $Id$ + */ + +/** + * chowns either awstats or webalizer folder, + * either with webserver-user or - if fcgid + * is used - the customers name, #258 + * + * @param array $row array if panel_customers + * + * @return void + */ +function makeChownWithNewStats($row) +{ + global $settings; + + // get correct user + if($settings['system']['mod_fcgid'] == 1) + { + $user = $row['loginname']; + $group = $row['loginname']; + } + else + { + $user = $row['guid']; + $group = $row['guid']; + } + + // get correct directory + $dir = $row['documentroot']; + if($settings['system']['awstats_enabled'] == '1') + { + $dir .= '/awstats/'; + } else { + $dir .= '/webalizer/'; + } + + // only run chown if directory exists + if (file_exists($dir)) + { + // run chown + safe_exec('chown -R '.escapeshellarg($user).':'.escapeshellarg($group).' '.escapeshellarg(makeCorrectDir($dir))); + } +} diff --git a/scripts/jobs/cron_traffic.inc.functions.php b/scripts/jobs/cron_traffic.inc.functions.php index c0170025..c6968a47 100644 --- a/scripts/jobs/cron_traffic.inc.functions.php +++ b/scripts/jobs/cron_traffic.inc.functions.php @@ -17,48 +17,6 @@ * @version $Id$ */ -/** - * chowns either awstats or webalizer folder, - * either with webserver-user or - if fcgid - * is used - the customers name, #258 - * - * @param array $row array if panel_customers - * - * @return void - */ -function makeChownWithNewStats($row) -{ - global $settings; - - // get correct user - if($settings['system']['mod_fcgid'] == 1) - { - $user = $row['loginname']; - $group = $row['loginname']; - } - else - { - $user = $row['guid']; - $group = $row['guid']; - } - - // get correct directory - $dir = $row['documentroot']; - if($settings['system']['awstats_enabled'] == '1') - { - $dir .= '/awstats/'; - } else { - $dir .= '/webalizer/'; - } - - // only run chown if directory exists - if (file_exists($dir)) - { - // run chown - safe_exec('chown -R '.escapeshellarg($user).':'.escapeshellarg($group).' '.escapeshellarg(makeCorrectDir($dir))); - } -} - function awstatsDoSingleDomain($domain, $outputdir) { global $cronlog, $settings;