From: Davide Franco Date: Thu, 7 Jul 2011 21:36:33 +0000 (+0200) Subject: bacula-web: php code cleanup X-Git-Tag: Release-5.2.1~222 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=5faef02181a3c318f34d513112b595f0cae1747c;p=bacula%2Fbacula bacula-web: php code cleanup --- 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" );