webalizer

Custom webalizer.conf for each ISPConfig site

I needed custom configuration for each site to exclude the domain which would otherwise show up in the webalizer referrer report.

I patched "/root/ispconfig/scripts/shell/webalizer.php" with the below diff for ispconfig-2.2.21.

--- webalizer.php.orig  2008-02-27 13:39:38.000000000 -0600
+++ webalizer.php   ;    2008-02-27 14:26:03.000000000 -0600
@@ -86,6 +86,9 @@
               $web_path = $web_home . "/$webname/web";
               $stats_path = $web_path . "/stats";
               $logfile = $web_home . "/$webname/log/web.log";
+             // Begin: addition by wizap
+             $webalizer_conf = $web_home."/".$webname."/webalizer.conf";
+             // End: by wizap
               $web_user = fileowner($web_path);
               $web_group = filegroup($web_path);

@@ -144,7 +147,14 @@
                   } else {
                     $web_real_name = $web_data["web_domain"];
                   }
-                  $message .= exec("webalizer -n $web_real_name -s $web_real_name -r $web_real_name -q -T -o $stats_path -c /root/ispconfig/scripts/shell/webalizer.conf $logfile")."\n";
+                 // Begin: addition by wizap
+                 if(@is_file($webalizer_conf)) {
+                       $message .= exec("webalizer -n $web_real_name -s $web_real_name -r $web_real_name -q -T -o $stats_path -c $webalizer_conf $logfile")."\n";
+                 }
+                 else {
+                       $message .= exec("webalizer -n $web_real_name -s $web_real_name -r $web_real_name -q -T -o $stats_path -c /root/ispconfig/scripts/shell/webalizer.conf $logfile")."\n";
+                 }
+                 // End: by wizap
               }

               exec("chown -R $web_user:$web_group $stats_path &> /dev/null");
@@ -249,4 +259,4 @@
   }
}
//////////////// LOGSIZE ENDE ////////////////
\ No newline at end of file
+?>

So, now it will detect if there is a custom webalizer.conf file in the sites root directory and include it instead of the default. You can simply copy over the default webalizer.conf file to the site root and add the site name to the HideReferrer section:

HideReferrer        <domain.tld>

Comment