Skip to content

Commit b0ebbde

Browse files
committed
Fixed: FS#1124 - Traffic quota on some systems not working
1 parent 694f1e5 commit b0ebbde

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

server/cron_daily.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ function setConfigVar( $filename, $varName, $varValue ) {
251251
foreach($records as $rec) {
252252

253253
$web_traffic_quota = $rec['traffic_quota'];
254-
$domain = $rec['web_domain'];
254+
$domain = $rec['domain'];
255255

256256
// get the client
257257
/*
@@ -264,20 +264,20 @@ function setConfigVar( $filename, $varName, $varValue ) {
264264
*/
265265

266266
//* get the traffic
267-
$tmp = $app->db->query("SELECT traffic_bytes FROM web_traffic WHERE traffic_date like '$current_month%' AND hostname = '$domain'");
267+
$tmp = $app->db->queryOneRecord("SELECT traffic_bytes FROM web_traffic WHERE traffic_date like '$current_month%' AND hostname = '$domain'");
268268
$web_traffic = $tmp['traffic_bytes']/1024/1024;
269269

270270
//* Website is over quota, we will disable it
271271
/*if( ($web_traffic_quota > 0 && $web_traffic > $web_traffic_quota) ||
272272
($client_traffic_quota > 0 && $web_traffic > $client_traffic_quota) ||
273273
($reseller_traffic_quota > 0 && $web_traffic > $reseller_traffic_quota)) {*/
274274
if($web_traffic_quota > 0 && $web_traffic > $web_traffic_quota) {
275-
$app->db->datalogUpdate('web_domain', "traffic_quota_lock = 'y',active = 'n'", 'domain_id', $rec['domain_id']);
275+
$app->dbmaster->datalogUpdate('web_domain', "traffic_quota_lock = 'y',active = 'n'", 'domain_id', $rec['domain_id']);
276276
$app->log("Traffic quota for ".$rec['domain_id']." Exceeded. Disabling website.",LOGLEVEL_DEBUG);
277277
} else {
278278
//* unlock the website, if traffic is lower then quota
279279
if($rec['traffic_quota_lock'] == 'y') {
280-
$app->db->datalogUpdate('web_domain', "traffic_quota_lock = 'n',active = 'y'", 'domain_id', $rec['domain_id']);
280+
$app->dbmaster->datalogUpdate('web_domain', "traffic_quota_lock = 'n',active = 'y'", 'domain_id', $rec['domain_id']);
281281
$app->log("Traffic quota for ".$rec['domain_id']." ok again. Enabling website.",LOGLEVEL_DEBUG);
282282
}
283283
}

0 commit comments

Comments
 (0)