]> git.sur5r.net Git - bacula/bacula/blobdiff - gui/bacula-web/bweb.inc.php
bacula-web: Internal code improvments
[bacula/bacula] / gui / bacula-web / bweb.inc.php
index 4cb078990d25072d68c67a3d74271cfff922076d..9e425595b5ccfca0d93d243e1ff13cc133136e3f 100644 (file)
@@ -560,5 +560,29 @@ class Bweb extends DB {
                        }
                }
                
+               public function GetStoredBytes( $delay = LAST_DAY )
+               {
+                       $query = "SELECT SUM(JobBytes) as stored_bytes FROM Job ";
+                       
+                       // Interval calculation
+                       $end_date   = mktime();
+                       $start_date = $end_date - $delay;
+                       
+                       $start_date = date( "Y-m-d H:m:s", $start_date );
+                       $end_date   = date( "Y-m-d H:m:s", $end_date );
+                       
+                       if( $delay != ALL ) {
+                               $query .= "WHERE EndTime BETWEEN '$start_date' AND '$end_date'";
+                       }
+                       
+                       $result = $this->db_link->query( $query );
+                       
+                       if( PEAR::isError( $result ) ) {
+                               die( "Unable to get Job Bytes from catalog" );
+                       }else{
+                               return $result->fetchRow( DB_FETCHMODE_ASSOC );
+                       }
+               }
+               
 } // end class Bweb
 ?>