Skip to content

Commit 59df847

Browse files
author
Marius Burkard
committed
Merge branch 'rhel-pureftpd-logfile' into 'develop'
Check for different pure-ftpd log file locations (fixes FTP stats for EPEL/RHEL) Closes #6378 See merge request ispconfig/ispconfig3!1625
2 parents 5bbec2b + 242b70c commit 59df847

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

interface/web/sites/templates/ftp_sites_stats_list.htm

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ <h1><tmpl_var name="list_head_txt"></h1>
3030
<tmpl_loop name="records">
3131
<tr>
3232
<td><a target="_blank" href="http://{tmpl_var name="domain"}/stats">{tmpl_var name="domain"}</a></td>
33-
<td><a href="#" data-load-content="sites/web_<tmpl_if name='type' op='==' value='vhostsubdomain'>vhost_sub</tmpl_if><tmpl_if name='type' op='==' value='vhostalias'>vhost_alias</tmpl_if>domain_edit.php?id={tmpl_var name='id'}">{tmpl_var name="this_month_in"}/{tmpl_var name="this_month_out"}</a></td>
34-
<td><a href="#" data-load-content="sites/web_<tmpl_if name='type' op='==' value='vhostsubdomain'>vhost_sub</tmpl_if><tmpl_if name='type' op='==' value='vhostalias'>vhost_alias</tmpl_if>domain_edit.php?id={tmpl_var name='id'}">{tmpl_var name="last_month_in"}/{tmpl_var name="last_month_out"}</a></td>
35-
<td><a href="#" data-load-content="sites/web_<tmpl_if name='type' op='==' value='vhostsubdomain'>vhost_sub</tmpl_if><tmpl_if name='type' op='==' value='vhostalias'>vhost_alias</tmpl_if>domain_edit.php?id={tmpl_var name='id'}">{tmpl_var name="this_year_in"}/{tmpl_var name="this_year_out"}</a></td>
36-
<td><a href="#" data-load-content="sites/web_<tmpl_if name='type' op='==' value='vhostsubdomain'>vhost_sub</tmpl_if><tmpl_if name='type' op='==' value='vhostalias'>vhost_alias</tmpl_if>domain_edit.php?id={tmpl_var name='id'}">{tmpl_var name="last_year_in"}/{tmpl_var name="last_year_out"}</a></td>
33+
<td><a href="#" data-load-content="sites/web_vhost_domain_edit.php?id={tmpl_var name='id'}&type={tmpl_var name='vhostdomain_type'}">{tmpl_var name="this_month_in"}/{tmpl_var name="this_month_out"}</a></td>
34+
<td><a href="#" data-load-content="sites/web_vhost_domain_edit.php?id={tmpl_var name='id'}&type={tmpl_var name='vhostdomain_type'}">{tmpl_var name="last_month_in"}/{tmpl_var name="last_month_out"}</a></td>
35+
<td><a href="#" data-load-content="sites/web_vhost_domain_edit.php?id={tmpl_var name='id'}&type={tmpl_var name='vhostdomain_type'}">{tmpl_var name="this_year_in"}/{tmpl_var name="this_year_out"}</a></td>
36+
<td><a href="#" data-load-content="sites/web_vhost_domain_edit.php?id={tmpl_var name='id'}&type={tmpl_var name='vhostdomain_type'}">{tmpl_var name="last_year_in"}/{tmpl_var name="last_year_out"}</a></td>
3737
<td class="text-right"></td>
3838
</tr>
3939
</tmpl_loop>

server/lib/classes/cron.d/200-ftplogfiles.inc.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,17 @@ public function onRunJob() {
3232
// Make the ftp logfiles directories world readable to enable ftp access
3333
//######################################################################################################
3434

35-
if(is_dir('/var/log/pure-ftpd/')) exec('chmod +r /var/log/pure-ftpd/*');
35+
$logfile = null;
36+
37+
if(is_dir('/var/log/pure-ftpd/')) {
38+
exec('chmod +r /var/log/pure-ftpd/*');
39+
$logfile="/var/log/pure-ftpd/transfer.log.1";
40+
} elseif(is_file('/var/log/pureftpd.log')) {
41+
$logfile="/var/log/pureftpd.log";
42+
} else {
43+
$app->log("The pure-ftpd log file could not be found.", LOGLEVEL_DEBUG);
44+
return false;
45+
}
3646

3747
//######################################################################################################
3848
// Manage and compress ftp logfiles and create traffic statistics
@@ -71,7 +81,7 @@ function add_ftp_traffic(&$traffic_array, $parsed_line)
7181
}
7282
}
7383

74-
$fp = @fopen('/var/log/pure-ftpd/transfer.log.1', 'r');
84+
$fp = @fopen($logfile, 'r');
7585
$ftp_traffic = array();
7686

7787
if ($fp) {

0 commit comments

Comments
 (0)