Skip to content

Commit aaedeeb

Browse files
committed
nginx_plugin: delete statistic generator configuration files if they have been changed to something else
1 parent 1fa9dee commit aaedeeb

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

server/plugins-available/nginx_plugin.inc.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1939,6 +1939,16 @@ function update($event_name, $data) {
19391939
$this->goaccess_update($data, $web_config);
19401940
}
19411941

1942+
//* Remove the GoAccess configuration file
1943+
if($data['old']['stats_type'] == 'goaccess') {
1944+
$this->goaccess_delete($data, $web_config);
1945+
}
1946+
1947+
//* Remove the Webalizer configuration file
1948+
if($data['old']['stats_type'] == 'webalizer') {
1949+
$this->webalizer_delete($data, $web_config);
1950+
}
1951+
19421952
//* Remove Stats-Folder when Statistics set to none
19431953
if($data['new']['stats_type'] == '' && ($data['new']['type'] == 'vhost' || $data['new']['type'] == 'vhostsubdomain' || $data['new']['type'] == 'vhostalias')) {
19441954
$app->file->removeDirectory($data['new']['document_root'].'/web/stats');
@@ -2653,6 +2663,18 @@ private function goaccess_delete ($data, $web_config) {
26532663
}
26542664
}
26552665

2666+
//* Delete the Webalizer configuration file
2667+
private function webalizer_delete ($data, $web_config) {
2668+
global $app;
2669+
2670+
$webalizer_conf = $data['old']['document_root'] . "/log/webalizer.conf";
2671+
2672+
if ( @is_file($webalizer_conf) ) {
2673+
$app->system->unlink($webalizer_conf);
2674+
$app->log('Removed Webalizer config file: '.$webalizer_conf, LOGLEVEL_DEBUG);
2675+
}
2676+
}
2677+
26562678
//* Update the awstats configuration file
26572679
private function awstats_update ($data, $web_config) {
26582680
global $app;

0 commit comments

Comments
 (0)