| GNU General Public License for more details. |
+-------------------------------------------------------------------------+
*/
- session_start();\r
- include_once( 'config/global.inc.php' );
-\r
- $dbSql = new Bweb();\r
-\r
- $backupjob_name = "";
- $backupjob_bytes = 0;
- $backupjob_files = 0;
-\r
- $days = array();
- $days_stored_bytes = array();
- $days_stored_files = array();
-
- // ===============================================================
- // Get Backup Job name from GET or POST\r
- // ===============================================================
- if( isset( $_POST["backupjob_name"] ) )\r
- $backupjob_name = $_POST["backupjob_name"];\r
- elseif( isset( $_GET["backupjob_name"] ) )\r
- $backupjob_name = $_GET["backupjob_name"];\r
- else\r
- die( "Please specify a backup job name " );\r
-\r
- // Generate Backup Job report period string
- $backupjob_period = "From " . date( "Y-m-d", (NOW-WEEK) ) . " to " . date( "Y-m-d", NOW );
-
- // Calculate total bytes for this period
- $backupjob_bytes = $dbSql->getStoredBytes( LAST_WEEK, NOW, $backupjob_name );
- $backupjob_bytes = CUtils::Get_Human_Size( $backupjob_bytes );
-
- $backupjob_files = $dbSql->getStoredFiles( LAST_WEEK, NOW, $backupjob_name );
- $backupjob_files = number_format( $backupjob_files, 0, '.', "'");
-
- // Get the last 7 days interval (start and end)\r
- $days = CTimeUtils::getLastDaysIntervals( 7 );
-
- // ===============================================================
- // Last 7 days stored Bytes graph\r
- // ===============================================================
- $graph = new CGraph( "graph2.png" );
-\r
- foreach( $days as $day ) {
- $stored_bytes = $dbSql->getStoredBytes( $day['start'], $day['end'], $backupjob_name);
- $stored_bytes = CUtils::Get_Human_Size( $stored_bytes, 1, 'GB', false );
- $days_stored_bytes[] = array( date("m-d", $day['start']), $stored_bytes );
- }
-
- $graph->SetData( $days_stored_bytes, 'bars', 'text-data' );\r
- $graph->SetGraphSize( 400, 230 );\r
- $graph->SetYTitle( "GB" );
-\r
- $graph->Render();\r
- $dbSql->tpl->assign('graph_stored_bytes', $graph->Get_Image_file() );
- \r
- // ===============================================================
- // Getting last 7 days stored files graph\r
- // ===============================================================
- $graph = new CGraph("graph3.png" );
- \r
- foreach( $days as $day ) {
- $stored_files = $dbSql->getStoredFiles( $day['start'], $day['end'], $backupjob_name);
- $days_stored_files[] = array( date("m-d", $day['start']), $stored_files );
- }
-\r
- $graph->SetData( $days_stored_files, 'bars', 'text-data' );\r
- $graph->SetGraphSize( 400, 230 );\r
- $graph->SetYTitle( "Files" );
-\r
- $graph->Render();\r
- $dbSql->tpl->assign('graph_stored_files', $graph->Get_Image_file() );
-\r
- // Last 10 jobs\r
- $query = "SELECT JobId, Level, JobFiles, JobBytes, JobStatus, StartTime, EndTime, Name ";
- $query .= "FROM Job ";\r
- $query .= "WHERE Name = '$backupjob_name' ";\r
- $query .= "ORDER BY EndTime DESC ";\r
- $query .= "LIMIT 10 ";\r
- \r
- $jobs = array();\r
- $joblevel = array( 'I' => 'Incr', 'D' => 'Diff', 'F' => 'Full' );\r
- $result = $dbSql->db_link->query( $query );\r
- \r
- if( ! PEAR::isError( $result ) )\r
- {\r
- while( $job = $result->fetchRow() )
- {
- // Job level description
- $job['joblevel'] = $joblevel[ $job['level'] ];
-
- // Job execution execution time
- $job['elapsedtime'] = CTimeUtils::Get_Elapsed_Time( $job['starttime'], $job['endtime'] );
-
- // odd and even row
- if( count($jobs) % 2)
- $job['row_class'] = 'odd';
-
- // Job bytes more easy to read
- $job['jobbytes'] = CUtils::Get_Human_Size( $job['jobbytes'] );
- $job['jobfiles'] = number_format($job['jobfiles'], 0 , '.', "'");
-
- $jobs[] = $job;
- }
- }else\r
- $dbSql->TriggerDBError("Unable to get last jobs from catalog", $result);
- \r
- $dbSql->tpl->assign('jobs', $jobs );
- $dbSql->tpl->assign('backupjob_name', $backupjob_name );
- $dbSql->tpl->assign('backupjob_period', $backupjob_period );
- $dbSql->tpl->assign('backupjob_bytes', $backupjob_bytes );
- $dbSql->tpl->assign('backupjob_files', $backupjob_files );
- \r
- // Process and display the template \r
- $dbSql->tpl->display('backupjob-report.tpl');
- \r
+ session_start();
+ include_once( 'config/global.inc.php' );
+
+ $dbSql = new Bweb();
+
+ $backupjob_name = "";
+ $backupjob_bytes = 0;
+ $backupjob_files = 0;
+
+ $days = array();
+ $days_stored_bytes = array();
+ $days_stored_files = array();
+
+ // ===============================================================
+ // Get Backup Job name from GET or POST
+ // ===============================================================
+ if( isset( $_POST["backupjob_name"] ) )
+ $backupjob_name = $_POST["backupjob_name"];
+ elseif( isset( $_GET["backupjob_name"] ) )
+ $backupjob_name = $_GET["backupjob_name"];
+ else
+ die( "Please specify a backup job name " );
+
+ // Generate Backup Job report period string
+ $backupjob_period = "From " . date( "Y-m-d", (NOW-WEEK) ) . " to " . date( "Y-m-d", NOW );
+
+ // Calculate total bytes for this period
+ $backupjob_bytes = $dbSql->getStoredBytes( LAST_WEEK, NOW, $backupjob_name );
+ $backupjob_bytes = CUtils::Get_Human_Size( $backupjob_bytes );
+
+ $backupjob_files = $dbSql->getStoredFiles( LAST_WEEK, NOW, $backupjob_name );
+ $backupjob_files = number_format( $backupjob_files, 0, '.', "'");
+
+ // Get the last 7 days interval (start and end)
+ $days = CTimeUtils::getLastDaysIntervals( 7 );
+
+ // ===============================================================
+ // Last 7 days stored Bytes graph
+ // ===============================================================
+ $graph = new CGraph( "graph2.png" );
+
+ foreach( $days as $day ) {
+ $stored_bytes = $dbSql->getStoredBytes( $day['start'], $day['end'], $backupjob_name);
+ $stored_bytes = CUtils::Get_Human_Size( $stored_bytes, 1, 'GB', false );
+ $days_stored_bytes[] = array( date("m-d", $day['start']), $stored_bytes );
+ }
+
+ $graph->SetData( $days_stored_bytes, 'bars', 'text-data' );
+ $graph->SetGraphSize( 400, 230 );
+ $graph->SetYTitle( "GB" );
+
+ $graph->Render();
+ $dbSql->tpl->assign('graph_stored_bytes', $graph->Get_Image_file() );
+
+ // ===============================================================
+ // Getting last 7 days stored files graph
+ // ===============================================================
+ $graph = new CGraph("graph3.png" );
+
+ foreach( $days as $day ) {
+ $stored_files = $dbSql->getStoredFiles( $day['start'], $day['end'], $backupjob_name);
+ $days_stored_files[] = array( date("m-d", $day['start']), $stored_files );
+ }
+
+ $graph->SetData( $days_stored_files, 'bars', 'text-data' );
+ $graph->SetGraphSize( 400, 230 );
+ $graph->SetYTitle( "Files" );
+
+ $graph->Render();
+ $dbSql->tpl->assign('graph_stored_files', $graph->Get_Image_file() );
+
+ // Last 10 jobs
+ $query = "SELECT JobId, Level, JobFiles, JobBytes, JobStatus, StartTime, EndTime, Name ";
+ $query .= "FROM Job ";
+ $query .= "WHERE Name = '$backupjob_name' ";
+ $query .= "ORDER BY EndTime DESC ";
+ $query .= "LIMIT 10 ";
+
+ $jobs = array();
+ $joblevel = array( 'I' => 'Incr', 'D' => 'Diff', 'F' => 'Full' );
+
+ try {
+ $result = $dbSql->db_link->runQuery( $query );
+
+ foreach( $result->fetchAll() as $job )
+ {
+ // Job level description
+ $job['joblevel'] = $joblevel[ $job['level'] ];
+
+ // Job execution execution time
+ $job['elapsedtime'] = CTimeUtils::Get_Elapsed_Time( $job['starttime'], $job['endtime'] );
+
+ // odd and even row
+ if( count($jobs) % 2)
+ $job['row_class'] = 'odd';
+
+ // Job bytes more easy to read
+ $job['jobbytes'] = CUtils::Get_Human_Size( $job['jobbytes'] );
+ $job['jobfiles'] = number_format($job['jobfiles'], 0 , '.', "'");
+
+ $jobs[] = $job;
+ } // end while
+ }catch(PDOExceptin $e) {
+ CDBError::raiseError($e);
+ }
+
+ $dbSql->tpl->assign('jobs', $jobs );
+ $dbSql->tpl->assign('backupjob_name', $backupjob_name );
+ $dbSql->tpl->assign('backupjob_period', $backupjob_period );
+ $dbSql->tpl->assign('backupjob_bytes', $backupjob_bytes );
+ $dbSql->tpl->assign('backupjob_files', $backupjob_files );
+
+ // Process and display the template
+ $dbSql->tpl->display('backupjob-report.tpl');
+
?>\r