\r
// Get the last 7 days interval (start and end)\r
for( $c = 6 ; $c >= 0 ; $c-- ) {\r
- $today = ( mktime() - ($c * LAST_DAY) );\r
- array_push( $days, array( 'start' => date( "Y-m-d 00:00:00", $today ), 'end' => date( "Y-m-d 23:59:00", $today ) ) );\r
+ $today = NOW - ($c * DAY);
+ $days[] = CTimeUtils::get_Day_Intervals($today);
}\r
// Generate Backup Job report period string\r
- $backupjob_period = "From " . date( "Y-m-d", mktime()-LAST_WEEK ) . " to " . date( "Y-m-d", mktime() );\r
+ $backupjob_period = "From " . date( "Y-m-d", (NOW-WEEK) ) . " to " . date( "Y-m-d", NOW );
// ===============================================================
// Last 7 days stored Bytes graph\r
// ===============================================================
$graph = new CGraph( "graph2.png" );
\r
- foreach( $days as $day )\r
- array_push( $days_stored_bytes, $dbSql->GetStoredBytesByJob( $backupjob_name, $day['start'], $day['end'] ) );\r
+ foreach( $days as $day ) {
+ $stored_bytes = CUtils::Get_Human_Size( $dbSql->getStoredBytes( $day['start'], $day['end'], $backupjob_name), 1, 'GB', false );
+ $days_stored_bytes[] = array( date("m-d", $day['start']), $stored_bytes );
+ }
\r
// Calculate total bytes for this period\r
- foreach( $days_stored_bytes as $day )\r
- $backupjob_bytes += $day[1];\r
+ $backupjob_bytes = $dbSql->getStoredBytes( LAST_WEEK, NOW, $backupjob_name );
+ $backupjob_bytes = CUtils::Get_Human_Size( $backupjob_bytes );
\r
$graph->SetData( $days_stored_bytes, 'bars', 'text-data' );\r
$graph->SetGraphSize( 400, 230 );\r