From 8f95bd278db45b302b0c6f2d8e1a941853d1e857 Mon Sep 17 00:00:00 2001 From: Davide Franco Date: Thu, 7 Jul 2011 23:36:33 +0200 Subject: [PATCH] bacula-web: php code cleanup --- gui/bacula-web/backupjob-report.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/gui/bacula-web/backupjob-report.php b/gui/bacula-web/backupjob-report.php index 06a8882423..1fe0974ebc 100644 --- a/gui/bacula-web/backupjob-report.php +++ b/gui/bacula-web/backupjob-report.php @@ -37,29 +37,30 @@ else die( "Please specify a backup job name " ); + // Generate Backup Job report period string + $backupjob_period = "From " . date( "Y-m-d", (NOW-WEEK) ) . " to " . date( "Y-m-d", NOW ); + + // Calculate total bytes for this period + $backupjob_bytes = $dbSql->getStoredBytes( LAST_WEEK, NOW, $backupjob_name ); + $backupjob_bytes = CUtils::Get_Human_Size( $backupjob_bytes ); + // Get the last 7 days interval (start and end) for( $c = 6 ; $c >= 0 ; $c-- ) { $today = NOW - ($c * DAY); $days[] = CTimeUtils::get_Day_Intervals($today); } - // Generate Backup Job report period string - $backupjob_period = "From " . date( "Y-m-d", (NOW-WEEK) ) . " to " . date( "Y-m-d", NOW ); - // =============================================================== // Last 7 days stored Bytes graph // =============================================================== $graph = new CGraph( "graph2.png" ); foreach( $days as $day ) { - $stored_bytes = CUtils::Get_Human_Size( $dbSql->getStoredBytes( $day['start'], $day['end'], $backupjob_name), 1, 'GB', false ); + $stored_bytes = $dbSql->getStoredBytes( $day['start'], $day['end'], $backupjob_name); + $stored_bytes = CUtils::Get_Human_Size( $stored_bytes, 1, 'GB', false ); $days_stored_bytes[] = array( date("m-d", $day['start']), $stored_bytes ); } - - // Calculate total bytes for this period - $backupjob_bytes = $dbSql->getStoredBytes( LAST_WEEK, NOW, $backupjob_name ); - $backupjob_bytes = CUtils::Get_Human_Size( $backupjob_bytes ); - + $graph->SetData( $days_stored_bytes, 'bars', 'text-data' ); $graph->SetGraphSize( 400, 230 ); $graph->SetYTitle( "GB" ); -- 2.39.5