]> git.sur5r.net Git - bacula/bacula/commitdiff
bacula-web: New function GetStoredFilesByJob() in bweb.inc.php
authorDavide Franco <bacula-dev@dflc.ch>
Mon, 14 Feb 2011 13:37:41 +0000 (14:37 +0100)
committerKern Sibbald <kern@sibbald.com>
Sat, 20 Apr 2013 12:43:38 +0000 (14:43 +0200)
 - This function return how many files were backed up for one job during an interval

gui/bacula-web/bweb.inc.php

index 5d7f5d467aa9751ab23c0439718c7362389537e3..05c35ee54e787ad4cae4d5d6332ca2fc27490e2d 100644 (file)
@@ -667,5 +667,36 @@ class Bweb extends DB {
                                return array( $day, $stored_bytes );
                        }                       
                }
+               
+               public function GetStoredFilesByJob( $jobname, $start_date, $end_date )
+               {
+                       $query  = "SELECT SUM(JobFiles) as stored_files, EndTime FROM Job ";
+                       $query .= "WHERE ( EndTime BETWEEN '$start_date' AND '$end_date' ) AND ";
+                       $query .= "Name = '$jobname'";
+                       
+                       $result = $this->db_link->query( $query );
+                       
+                       //echo $query . '<br />';
+                       
+                       if( PEAR::isError( $result ) ) {
+                               die( "Unable to get Job Files from catalog" );
+                       }else{
+                               $stored_bytes = 0;
+                               $tmp = $result->fetchRow( DB_FETCHMODE_ASSOC );
+                               var_dump( $tmp );
+                               $day = date( "D d", strtotime($end_date) );
+                               
+                               /*
+                               if( isset( $tmp['stored_bytes'] ) ) {
+                                       $hbytes = $this->human_file_size( $tmp['stored_files'], 3, 'GB');
+                                       $hbytes = explode( " ", $hbytes );
+                                       $stored_bytes = $hbytes[0];
+                               }
+                               */
+                               
+                               return array( $day, $stored_bytes );
+                       }                       
+               }
+
 } // end class Bweb
 ?>