Skip to content

Commit 8fff80b

Browse files
committed
fixed fallback for older GoAccess versions
1 parent 94b093e commit 8fff80b

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

server/lib/classes/cron.d/150-goaccess.inc.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,9 @@ public function onRunJob() {
144144

145145
$goa_db_dir = $docroot.'/'.$web_folder.'/stats/.db/';
146146
$output_html = $docroot.'/'.$web_folder.'/stats/goaindex.html';
147-
if(!@is_dir($goa_db_dir)) $app->system->mkdirpath($goa_db_dir, 0755, $username, $groupname);
147+
if(!@is_dir($goa_db_dir)) $app->system->mkdirpath($goa_db_dir);
148148

149-
if(is_link('/var/log/ispconfig/httpd/'.$domain.'/yesterday-access.log')) unlink('/var/log/ispconfig/httpd/'.$domain.'/yesterday-access.log');
149+
if(is_link('/var/log/ispconfig/httpd/'.$domain.'/yesterday-access.log')) $app->system->unlink('/var/log/ispconfig/httpd/'.$domain.'/yesterday-access.log');
150150
symlink($logfile, '/var/log/ispconfig/httpd/'.$domain.'/yesterday-access.log');
151151

152152

@@ -207,8 +207,9 @@ public function onRunJob() {
207207
if(version_compare($goaccess_version,1.4) >= 0) {
208208
$app->system->exec_safe("LANG=? goaccess -f ? --config-file ? --restore --persist --db-path=? --output=?", $cust_lang, $logfile, $goaccess_conf, $goa_db_dir, $output_html);
209209
} else {
210-
$output = $app->system->system_safe('goaccess --help');
211-
if(preg_match('/keep-db-files/', $output)) {
210+
$output = $app->system->system_safe('goaccess --help 2>&1');
211+
preg_match('/keep-db-files/', $output, $match);
212+
if($match[0] == "keep-db-files") {
212213
$app->system->exec_safe("LANG=? goaccess -f ? --config-file ? --load-from-disk --keep-db-files --db-path=? --output=?", $cust_lang, $logfile, $goaccess_conf, $goa_db_dir, $output_html);
213214
} else {
214215
$app->log("Stats not generated. The GoAccess binary was not compiled with btree support. Please recompile/reinstall GoAccess with btree support, or install GoAccess version >= 1.4!", LOGLEVEL_ERROR);

server/plugins-available/apache2_plugin.inc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3017,7 +3017,7 @@ private function goaccess_update ($data, $web_config) {
30173017
}
30183018
}
30193019

3020-
if(!is_dir($data['new']['document_root']."/" . $web_folder . "/stats/")) $app->system->mkdirpath($data['new']['document_root']."/" . $web_folder . "/stats/.db");
3020+
if(!is_dir($data['new']['document_root']."/" . $web_folder . "/stats/.db")) $app->system->mkdirpath($data['new']['document_root'] . "/" . $web_folder . "/stats/.db");
30213021
$goaccess_conf = $data['new']['document_root'].'/log/goaccess.conf';
30223022

30233023
/*

server/plugins-available/nginx_plugin.inc.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2566,8 +2566,8 @@ private function goaccess_update ($data, $web_config) {
25662566
}
25672567
}
25682568

2569-
if(!is_dir($data['new']['document_root']."/" . $web_folder . "/stats/")) $app->system->mkdirpath($data['new']['document_root']."/" . $web_folder . "/stats/.db");
2570-
$goaccess_conf = $data['new']['document_root'].'/log/goaccess.conf';
2569+
if(!is_dir($data['new']['document_root']."/" . $web_folder . "/stats/.db")) $app->system->mkdirpath($data['new']['document_root'] . "/" . $web_folder . "/stats/.db");
2570+
$goaccess_conf = $data['new']['document_root'].'/log/goaccess.conf';
25712571

25722572
/*
25732573
In case that you use a different log format, you should use a custom goaccess.conf which you'll have to put into /usr/local/ispconfig/server/conf-custom/.

0 commit comments

Comments
 (0)