- fix loop-in-loop effect when calculating traffic with awstats, fixes #246
This commit is contained in:
@@ -144,7 +144,7 @@ function awstatsDoSingleDomain($domain, $outputdir)
|
|||||||
return $returnval;
|
return $returnval;
|
||||||
}
|
}
|
||||||
|
|
||||||
function callAwstatsGetTraffic($domain, $outputdir, $caption, $usersdomainlist)
|
function callAwstatsGetTraffic($customerid, $outputdir, $usersdomainlist)
|
||||||
{
|
{
|
||||||
global $settings, $db, $cronlog;
|
global $settings, $db, $cronlog;
|
||||||
$returnval = 0;
|
$returnval = 0;
|
||||||
@@ -169,7 +169,6 @@ function callAwstatsGetTraffic($domain, $outputdir, $caption, $usersdomainlist)
|
|||||||
* a sane value for our panel_traffic and to remain the whole stats
|
* a sane value for our panel_traffic and to remain the whole stats
|
||||||
* (awstats overwrites the customers .html stats-files)
|
* (awstats overwrites the customers .html stats-files)
|
||||||
*/
|
*/
|
||||||
$customerid = getCustomerIdByDomain($domain);
|
|
||||||
|
|
||||||
if($customerid !== false)
|
if($customerid !== false)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -165,11 +165,7 @@ while($row = $db->fetch_array($result))
|
|||||||
unset($domainlist[$row['customerid']][$domainid]);
|
unset($domainlist[$row['customerid']][$domainid]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($settings['system']['awstats_enabled'] == '1')
|
if($settings['system']['awstats_enabled'] == '0')
|
||||||
{
|
|
||||||
$httptraffic+= floatval(callAwstatsGetTraffic($domain, $row['documentroot'] . '/awstats/', $domain, $domainlist[$row['customerid']]));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
$httptraffic+= floatval(callWebalizerGetTraffic($row['loginname'] . '-' . $domain, $row['documentroot'] . '/webalizer/' . $domain . '/', $domain, $domainlist[$row['customerid']]));
|
$httptraffic+= floatval(callWebalizerGetTraffic($row['loginname'] . '-' . $domain, $row['documentroot'] . '/webalizer/' . $domain . '/', $domain, $domainlist[$row['customerid']]));
|
||||||
}
|
}
|
||||||
@@ -183,9 +179,13 @@ while($row = $db->fetch_array($result))
|
|||||||
safeSQLLogfile($domainlist[$row['customerid']], $row['loginname']);
|
safeSQLLogfile($domainlist[$row['customerid']], $row['loginname']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// callAwstatsGetTraffic is called ONLY HERE and
|
||||||
|
// *not* also in the special-logfiles-loop, because the function
|
||||||
|
// will iterate through all customer-domains and the awstats-configs
|
||||||
|
// know the logfile-name, #246
|
||||||
if($settings['system']['awstats_enabled'] == '1')
|
if($settings['system']['awstats_enabled'] == '1')
|
||||||
{
|
{
|
||||||
$httptraffic+= floatval(callAwstatsGetTraffic($caption, $row['documentroot'] . '/awstats/', $caption, $domainlist[$row['customerid']]));
|
$httptraffic+= floatval(callAwstatsGetTraffic($row['customerid'], $row['documentroot'] . '/awstats/', $domainlist[$row['customerid']]));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user