}
}
+ 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
?>
<?php
+ // Intervalles in secondes
define( 'LAST_DAY', 86400 );
define( 'LAST_WEEK', 604800 );
define( 'LAST_MONTH', 2678400 );
+ define( 'ALL', -1 );
?>
}
$totalfiles->free();
+ /*
switch( $dbSql->driver )
{
case 'mysql':
$smarty->assign('total_jobs', $tmp[1]);
$last24bytes->free();
- }
+ }*/
// Database size
$smarty->assign('database_size', $dbSql->GetDbSize());
-// Total bytes stored
-$bytes_stored = $dbSql->db_link->getOne("select SUM(VolBytes) from Media") or die ("Failed to get Total stored Bytes from catalog");
-$smarty->assign('bytes_stored', $dbSql->human_file_size($bytes_stored) );
+// Overall stored bytes
+$result = $dbSql->GetStoredBytes( ALL );
+$smarty->assign('stored_bytes', $dbSql->human_file_size($result['stored_bytes']) );
+
+// Total stored bytes since last 24 hours
+$result = $dbSql->GetStoredBytes( LAST_DAY );
+$smarty->assign('bytes_totales', $dbSql->human_file_size($result['stored_bytes']) );
// Number of clients
$nb_clients = $dbSql->Get_Nb_Clients();
$graph->SetData( $data, 'pie', 'text-data-single' );
$graph->SetGraphSize( 400, 230 );
-
$graph->Render();
$smarty->assign('graph_pools', $graph->Get_Image_file() );
<td class="label">{t}Clients{/t}</td> <td class="info">{$clientes_totales}</td>
</tr>
<tr>
- <td class="label">{t}Total bytes stored{/t}</td> <td class="info">{$bytes_stored}</td>
+ <td class="label">{t}Total bytes stored{/t}</td> <td class="info">{$stored_bytes}</td>
</tr>
<tr>
<td class="label">{t}Total files{/t}</td> <td class="info">{$files_totales} file(s)</td>