+ public function GetPoolsStatistics( $pools )
+ {
+ foreach( $pools as $pool_name => $pool ) {
+ //var_dump( $pool );
+ $query = "SELECT COUNT(*) AS nb_vol FROM Media WHERE PoolId = '$pool'";
+ //echo $query . '<br />';
+ //echo 'Pool name ' . $pool_name . '<br />';
+ $result = $this->db_link->query( $query );
+
+ if( PEAR::isError( $result ) ) {
+ die("Unable to get volume number from catalog");
+ }else{
+ $nb_vol = $result->fetchRow(DB_FETCHMODE_ASSOC);
+ return array( $pool_name, $nb_vol['nb_vol'] );
+ }
+ }
+ }
+
+ public function GetStoredFiles()
+ {
+ $nbfiles = 0;
+ $query = "SELECT COUNT(FilenameId) AS nbfiles FROM Filename";
+ $result = $this->db_link->query( $query );
+
+ if( !PEAR::isError($result) ) {
+ $nbfiles = $result->fetchRow(DB_FETCHMODE_ASSOC);
+ $nbfiles = $nbfiles['nbfiles'];
+ }else{
+ die("Unable to get protected files from catalog");
+ }
+ return $nbfiles;
+ }
+
+ 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:i:s", $start_date );
+ $end_date = date( "Y-m-d H:i: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 );
+ }
+ }
+
+ public function GetStoredBytesByInterval( $start_date, $end_date )