- corrected awstats-statsfile-parsing and traffic-calculation, refs #58
This commit is contained in:
@@ -77,26 +77,28 @@ function awstatsDoSingleDomain($domain, $outputdir)
|
|||||||
$count_bdw = false;
|
$count_bdw = false;
|
||||||
foreach($content_array as $line)
|
foreach($content_array as $line)
|
||||||
{
|
{
|
||||||
if(trim($line) == '') {
|
if(trim($line) == '' // skip empty lines
|
||||||
|
|| substr(trim($line), 0, 1) == '#' // skip comments
|
||||||
|
) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$parts = explode(' ', $line);
|
$parts = explode(' ', $line);
|
||||||
|
|
||||||
if(isset($line[0])
|
if(isset($parts[0])
|
||||||
&& strtoupper($line[0]) == 'BEGIN_DOMAIN'
|
&& strtoupper($parts[0]) == 'BEGIN_DOMAIN'
|
||||||
) {
|
) {
|
||||||
$count_bdw = true;
|
$count_bdw = true;
|
||||||
}
|
}
|
||||||
elseif(isset($line[0])
|
|
||||||
&& strtoupper($line[0]) == 'END_DOMAIN'
|
|
||||||
) {
|
|
||||||
$count_bdw = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($count_bdw) {
|
if ($count_bdw) {
|
||||||
if (isset($line[3])) {
|
if(isset($parts[0])
|
||||||
$returnval += floatval($line[3]);
|
&& strtoupper($parts[0]) == 'END_DOMAIN'
|
||||||
|
) {
|
||||||
|
$count_bdw = false;
|
||||||
|
break;
|
||||||
|
} elseif (isset($parts[3])) {
|
||||||
|
$returnval += floatval($parts[3]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user