]> git.sur5r.net Git - bacula/bacula/blobdiff - gui/bacula-web/index.php
Update
[bacula/bacula] / gui / bacula-web / index.php
index cc13c78b4b9c0f31f7b788a5a86e5e23cb12fa82..1e7486358132bc98c83b123f6c5cce356dc45ce8 100644 (file)
@@ -15,6 +15,7 @@
 +-------------------------------------------------------------------------+ 
 */
 // Last Err: 
+session_start();
 require ("paths.php");
 require($smarty_path."Smarty.class.php");
 include "classes.inc";
@@ -32,6 +33,11 @@ $mode = $smarty->get_config_vars("mode");
 
 require("lang.php");
 
+//Assign dbs
+if ( count($dbSql->dbs) >1 ) {
+  $smarty->assign("dbs", $dbSql->dbs);
+  $smarty->assign("dbs_now", $_SESSION['DATABASE']);
+}
 
 // generaldata.tpl & last_run_report.tpl (last24bytes)
 $client = $dbSql->link->query("select count(*) from Client")
@@ -54,13 +60,16 @@ $tmp = $client->fetchRow();
 $smarty->assign('clientes_totales',$tmp[0]);
 
 $tmp = $last24bytes->fetchRow();
-if ( empty($tmp[0]) ) {                                                                                                                 // No data for last 24, search last 48
+/*if ( empty($tmp[0]) ) {                                                                                                                 // No data for last 24, search last 48
         if ( $dbSql->driver == "mysql" )
           $last24bytes = $dbSql->link->query("select sum(JobBytes) from Job where Endtime <= NOW() and UNIX_TIMESTAMP(EndTime) > UNIX_TIMESTAMP(NOW())-172800" );
         if ( $dbSql->driver == "pgsql")
-          $last24bytes = $dbSql->link->query("select sum(JobBytes) from Job where Endtime <= NOW() and EndTime > NOW()-172800" );
+          $last24bytes = $dbSql->link->query("select sum(JobBytes) from Job where Endtime <= NOW() and EndTime > NOW()-172800 * interval '1 second'" )
+            or die ("Error query: 4.1");
         $smarty->assign('when',"yesterday");
-}
+        $tmp = $last24bytes->fetchRow();        
+}*/
+
 $smarty->assign('bytes_totales',$tmp[0]);
 $smarty->assign('total_jobs', $tmp[1]);
 
@@ -72,6 +81,7 @@ $totalfiles->free();
 $last24bytes->free();
 
 
+
 // report_select.tpl & last_run_report.tpl
 $res = $dbSql->link->query("select Name from Job group by Name");
 $a_jobs = array();
@@ -130,7 +140,7 @@ else if ($mode == "Full" || $_GET['Full_popup'] == "yes" ){
                                 LEFT JOIN Pool ON Job.PoolId=Pool.PoolId where EndTime <= NOW() and UNIX_TIMESTAMP(EndTime) >UNIX_TIMESTAMP(NOW())-86400 
                                 order by elapsed ";                                                                                                     // Full report array
         if ( $dbSql->driver == "pgsql")
-                $query = "select Job.EndTime - Job.StartTime )
+                $query = "select (Job.EndTime - Job.StartTime )
                                 as elapsed,Job.Name,Job.StartTime,Job.EndTime,Job.Level,Pool.Name,Job.JobStatus from Job
                                 LEFT JOIN Pool ON Job.PoolId=Pool.PoolId where EndTime <= NOW() and EndTime > NOW() - 86400 * interval '1 second'
                                 order by elapsed ";