Skip to content

Commit 1fa9dee

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

File tree

1 file changed

+28
-6
lines changed

1 file changed

+28
-6
lines changed

server/plugins-available/apache2_plugin.inc.php

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1925,6 +1925,21 @@ function update($event_name, $data) {
19251925
$app->file->removeDirectory($data['new']['document_root'].'/web/stats');
19261926
}
19271927

1928+
//* Remove the AWstats configuration file
1929+
if($data['old']['stats_type'] == 'awstats') {
1930+
$this->awstats_delete($data, $web_config);
1931+
}
1932+
1933+
//* Remove the GoAccess configuration file
1934+
if($data['old']['stats_type'] == 'goaccess') {
1935+
$this->goaccess_delete($data, $web_config);
1936+
}
1937+
1938+
//* Remove the Webalizer configuration file
1939+
if($data['old']['stats_type'] == 'webalizer') {
1940+
$this->webalizer_delete($data, $web_config);
1941+
}
1942+
19281943
$this->php_fpm_pool_update($data, $web_config, $pool_dir, $pool_name, $socket_dir, $web_folder);
19291944
$this->hhvm_update($data, $web_config);
19301945

@@ -2328,16 +2343,11 @@ function delete($event_name, $data) {
23282343

23292344
}
23302345

2331-
//* Remove the awstats configuration file
2346+
//* Remove the AWstats configuration file
23322347
if($data['old']['stats_type'] == 'awstats') {
23332348
$this->awstats_delete($data, $web_config);
23342349
}
23352350

2336-
//* Remove the GoAccess configuration file
2337-
if($data['old']['stats_type'] == 'goaccess') {
2338-
$this->goaccess_delete($data, $web_config);
2339-
}
2340-
23412351
if($data['old']['type'] == 'vhostsubdomain' || $data['old']['type'] == 'vhostalias') {
23422352
$app->system->web_folder_protection($parent_web_document_root, true);
23432353
}
@@ -3128,6 +3138,18 @@ private function goaccess_delete ($data, $web_config) {
31283138
}
31293139
}
31303140

3141+
//* Delete the Webalizer configuration file
3142+
private function webalizer_delete ($data, $web_config) {
3143+
global $app;
3144+
3145+
$webalizer_conf = $data['old']['document_root'] . "/log/webalizer.conf";
3146+
3147+
if ( @is_file($webalizer_conf) ) {
3148+
$app->system->unlink($webalizer_conf);
3149+
$app->log('Removed Webalizer config file: '.$webalizer_conf, LOGLEVEL_DEBUG);
3150+
}
3151+
}
3152+
31313153
private function hhvm_update($data, $web_config) {
31323154
global $app, $conf;
31333155

0 commit comments

Comments
 (0)