From 7fe908c50c8dbc5cc05f571dbe11d66141caacd4 Mon Sep 17 00:00:00 2001 From: Marius Cramer <m.cramer@pixcept.de> Date: Thu, 14 Nov 2013 09:01:22 -0500 Subject: [PATCH] Cleaning up code to match coding guidelines --- helper_scripts/recreate_webalizer_stats.php | 44 ++++++++++++++++++++++---------------------- 1 files changed, 22 insertions(+), 22 deletions(-) diff --git a/helper_scripts/recreate_webalizer_stats.php b/helper_scripts/recreate_webalizer_stats.php index 2663bc2..fbaef38 100644 --- a/helper_scripts/recreate_webalizer_stats.php +++ b/helper_scripts/recreate_webalizer_stats.php @@ -1,39 +1,39 @@ <?php -####################################################################################################### +//###################################################################################################### // Re-Create webalizer statistics -####################################################################################################### +//###################################################################################################### $sql = "SELECT domain_id, domain, document_root FROM web_domain WHERE server_id = ".$conf["server_id"]; $records = $app->db->queryAllRecords($sql); foreach($records as $rec) { -$domain = escapeshellcmd($rec["domain"]); -$logdir = escapeshellcmd($rec["document_root"].'/log'); -$statsdir = escapeshellcmd($rec["document_root"].'/web/stats'); -$webalizer = '/usr/bin/webalizer'; + $domain = escapeshellcmd($rec["domain"]); + $logdir = escapeshellcmd($rec["document_root"].'/log'); + $statsdir = escapeshellcmd($rec["document_root"].'/web/stats'); + $webalizer = '/usr/bin/webalizer'; -$webalizer_conf_main = '/etc/webalizer/webalizer.conf'; -$webalizer_conf = escapeshellcmd($rec["document_root"].'/log/webalizer.conf'); -exec("rm -rf $webalizer_conf"); -if(!@is_file($webalizer_conf)) { -exec("cp $webalizer_conf_main $webalizer_conf"); + $webalizer_conf_main = '/etc/webalizer/webalizer.conf'; + $webalizer_conf = escapeshellcmd($rec["document_root"].'/log/webalizer.conf'); + exec("rm -rf $webalizer_conf"); + if(!@is_file($webalizer_conf)) { + exec("cp $webalizer_conf_main $webalizer_conf"); -setConfigVar($webalizer_conf, 'Incremental', 'yes'); -setConfigVar($webalizer_conf, 'IncrementalName', $logdir.'/webalizer.current'); -setConfigVar($webalizer_conf, 'HistoryName', $logdir.'/webalizer.hist'); -} + setConfigVar($webalizer_conf, 'Incremental', 'yes'); + setConfigVar($webalizer_conf, 'IncrementalName', $logdir.'/webalizer.current'); + setConfigVar($webalizer_conf, 'HistoryName', $logdir.'/webalizer.hist'); + } -if(!@is_dir($statsdir)) mkdir($statsdir); + if(!@is_dir($statsdir)) mkdir($statsdir); -echo "Remove stats dir $statsdir ...\n"; -exec("rm -rf $statsdir/*"); + echo "Remove stats dir $statsdir ...\n"; + exec("rm -rf $statsdir/*"); -echo "Re-Create stats for $domain...\n"; -exec("for logfile in $logdir/*access*; do\n$webalizer -c $webalizer_conf -n $domain -s $domain -r $domain -q -T -p -o $statsdir ".'$logfile'."\ndone"); -echo "done.\n"; + echo "Re-Create stats for $domain...\n"; + exec("for logfile in $logdir/*access*; do\n$webalizer -c $webalizer_conf -n $domain -s $domain -r $domain -q -T -p -o $statsdir ".'$logfile'."\ndone"); + echo "done.\n"; } die("finished.\n"); -?> \ No newline at end of file +?> -- Gitblit v1.9.1