syntaxer run

git-svn-id: http://www.observium.org/svn/observer/trunk@2974 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2012-04-06 15:19:43 +00:00
parent c95f4db6b8
commit e68cc3246e
3 changed files with 9 additions and 11 deletions

View File

@@ -13,7 +13,6 @@ if (isset($options['r'])) { echo("Clearing history table.\n"); mysql_query("TRUN
foreach (dbFetchRows("SELECT * FROM `bills` ORDER BY `bill_id`") as $bill)
{
echo(str_pad($bill['bill_id']." ".$bill['bill_name'], 30)." \n");
$i=0;
@@ -32,9 +31,8 @@ foreach (dbFetchRows("SELECT * FROM `bills` ORDER BY `bill_id`") as $bill)
$date_updated = str_replace("-", "", str_replace(":", "", str_replace(" ", "", $check['updated'])));
if($period > 0 && $dateto > $date_updated)
if ($period > 0 && $dateto > $date_updated)
{
$rate_data = getRates($bill['bill_id'],$datefrom,$dateto);
$rate_95th = $rate_data['rate_95th'];
$dir_95th = $rate_data['dir_95th'];
@@ -51,20 +49,20 @@ foreach (dbFetchRows("SELECT * FROM `bills` ORDER BY `bill_id`") as $bill)
$overuse = $used - $allowed;
$overuse = (($overuse <= 0) ? "0" : $overuse);
$percent = round(($rate_data['rate_95th'] / $bill['bill_cdr']) * 100,2);
} elseif ($bill['bill_type'] == "quota") {
$type = "Quota";
$allowed = $bill['bill_quota'];
$used = $rate_data['total_data'];
$allowed_text = format_bytes_billing($allowed);
$used_text = format_bytes_billing($used);
$used_text = format_bytes_billing($used);
$overuse = $used - $allowed;
$overuse = (($overuse <= 0) ? "0" : $overuse);
$percent = round(($rate_data['total_data'] / $bill['bill_quota']) * 100,2);
}
echo(strftime("%x @ %X", strtotime($datefrom))." to ".strftime("%x @ %X", strtotime($dateto))." ".str_pad($type,8)." ".str_pad($allowed_text,10)." ".str_pad($used_text,10)." ".$percent."%");
if($i == '0')
if ($i == '0')
{
$update = array('rate_95th' => $rate_data['rate_95th'],
'rate_95th_in' => $rate_data['rate_95th_in'],
@@ -82,8 +80,8 @@ foreach (dbFetchRows("SELECT * FROM `bills` ORDER BY `bill_id`") as $bill)
echo(" Updated! ");
}
if ($check['bill_id'] == $bill['bill_id']) {
if ($check['bill_id'] == $bill['bill_id'])
{
$update = array('rate_95th' => $rate_data['rate_95th'],
'rate_95th_in' => $rate_data['rate_95th_in'],
'rate_95th_out' => $rate_data['rate_95th_out'],
@@ -101,7 +99,6 @@ foreach (dbFetchRows("SELECT * FROM `bills` ORDER BY `bill_id`") as $bill)
dbUpdate($update, 'bill_history', '`bill_hist_id` = ?', array($check['bill_hist_id']));
echo(" Updated history! ");
} else {
$update = array('rate_95th' => $rate_data['rate_95th'],
'rate_95th_in' => $rate_data['rate_95th_in'],
@@ -120,7 +117,7 @@ foreach (dbFetchRows("SELECT * FROM `bills` ORDER BY `bill_id`") as $bill)
'bill_used' => $used,
'bill_overuse' => $overuse,
'bill_percent' => $percent,
'bill_datefrom' => $datefrom,
'bill_datefrom' => $datefrom,
'bill_dateto' => $dateto,
'bill_id' => $bill['bill_id'] );
dbInsert($update, 'bill_history');

View File

@@ -1,5 +1,6 @@
#!/usr/bin/env php
<?php
include("includes/defaults.inc.php");
include("config.php");
include("includes/functions.php");

View File

@@ -1,4 +1,4 @@
<?
<?php
$ds_in = "inutil";
$ds_out = "oututil";