From 8f174e26970fb2b3721e3e41c3bfea9b818aa9e6 Mon Sep 17 00:00:00 2001 From: Davide Franco Date: Mon, 14 Feb 2011 14:37:41 +0100 Subject: [PATCH] bacula-web: New function GetStoredFilesByJob() in bweb.inc.php - This function return how many files were backed up for one job during an interval --- gui/bacula-web/bweb.inc.php | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/gui/bacula-web/bweb.inc.php b/gui/bacula-web/bweb.inc.php index 5d7f5d467a..05c35ee54e 100644 --- a/gui/bacula-web/bweb.inc.php +++ b/gui/bacula-web/bweb.inc.php @@ -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 . '
'; + + 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 ?> -- 2.39.5