From: Davide Franco Date: Sat, 9 Jul 2011 15:01:07 +0000 (+0200) Subject: bacula-web: Improved code for last n days timestamp intervals generation X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=92889f12eabf6c553991e85ae2a26f2b715159fd;p=bacula%2Fbacula bacula-web: Improved code for last n days timestamp intervals generation --- diff --git a/gui/bacula-web/backupjob-report.php b/gui/bacula-web/backupjob-report.php index fc58c915af..9b7d5fc6da 100644 --- a/gui/bacula-web/backupjob-report.php +++ b/gui/bacula-web/backupjob-report.php @@ -47,10 +47,7 @@ $backupjob_files = $dbSql->getStoredFiles( LAST_WEEK, NOW, $backupjob_name ); // 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); - } + $days = CTimeUtils::getLastDaysIntervals( 7 ); // =============================================================== // Last 7 days stored Bytes graph diff --git a/gui/bacula-web/index.php b/gui/bacula-web/index.php index 9b3ab978ff..63e464d1d9 100644 --- a/gui/bacula-web/index.php +++ b/gui/bacula-web/index.php @@ -81,13 +81,7 @@ $graph->Render(); $dbSql->tpl->assign('graph_pools', $graph->Get_Image_file() ); // Last 7 days stored Bytes graph -$days = array(); - -for( $c = 6 ; $c >= 0 ; $c-- ) { - $today = NOW - ($c * DAY); - $days[] = CTimeUtils::get_Day_Intervals($today); -} - +$days = CTimeUtils::getLastDaysIntervals( 7 ); foreach( $days as $day ) { $stored_bytes = $dbSql->getStoredBytes( $day['start'], $day['end']); $stored_bytes = CUtils::Get_Human_Size( $stored_bytes, 1, 'GB', false );