]> git.sur5r.net Git - bacula/bacula/commitdiff
bacula-web: php code cleanup
authorDavide Franco <bacula-dev@dflc.ch>
Thu, 7 Jul 2011 21:36:33 +0000 (23:36 +0200)
committerEric Bollengier <eric@eb.homelinux.org>
Tue, 2 Aug 2011 09:56:22 +0000 (11:56 +0200)
gui/bacula-web/backupjob-report.php

index 06a88824234952f4c1f7e0836e7276f397145f7d..1fe0974ebca58bb0ca1fdbabc11f5a4b2f87836b 100644 (file)
   else\r
        die( "Please specify a backup job name " );\r
 \r
+  // 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)\r
   for( $c = 6 ; $c >= 0 ; $c-- ) {\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", (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 ) {
-       $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 );
   }
\r
-  // Calculate total bytes for this period\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
   $graph->SetYTitle( "GB" );