Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 126754 | Differences between
and this patch

Collapse All | Expand All

(-)../bacula-web/index.php (-4 / +7 lines)
Lines 60-72 Link Here
60
$smarty->assign('clientes_totales',$tmp[0]);
60
$smarty->assign('clientes_totales',$tmp[0]);
61
61
62
$tmp = $last24bytes->fetchRow();
62
$tmp = $last24bytes->fetchRow();
63
if ( empty($tmp[0]) ) {                                                                                                                 // No data for last 24, search last 48
63
/*if ( empty($tmp[0]) ) {                                                                                                                 // No data for last 24, search last 48
64
        if ( $dbSql->driver == "mysql" )
64
        if ( $dbSql->driver == "mysql" )
65
          $last24bytes = $dbSql->link->query("select sum(JobBytes) from Job where Endtime <= NOW() and UNIX_TIMESTAMP(EndTime) > UNIX_TIMESTAMP(NOW())-172800" );
65
          $last24bytes = $dbSql->link->query("select sum(JobBytes) from Job where Endtime <= NOW() and UNIX_TIMESTAMP(EndTime) > UNIX_TIMESTAMP(NOW())-172800" );
66
        if ( $dbSql->driver == "pgsql")
66
        if ( $dbSql->driver == "pgsql")
67
          $last24bytes = $dbSql->link->query("select sum(JobBytes) from Job where Endtime <= NOW() and EndTime > NOW()-172800" );
67
          $last24bytes = $dbSql->link->query("select sum(JobBytes) from Job where Endtime <= NOW() and EndTime > NOW()-172800 * interval '1 second'" )
68
            or die ("Error query: 4.1");
68
        $smarty->assign('when',"yesterday");
69
        $smarty->assign('when',"yesterday");
69
}
70
        $tmp = $last24bytes->fetchRow();        
71
}*/
72
70
$smarty->assign('bytes_totales',$tmp[0]);
73
$smarty->assign('bytes_totales',$tmp[0]);
71
$smarty->assign('total_jobs', $tmp[1]);
74
$smarty->assign('total_jobs', $tmp[1]);
72
75
Lines 136-142 Link Here
136
                                LEFT JOIN Pool ON Job.PoolId=Pool.PoolId where EndTime <= NOW() and UNIX_TIMESTAMP(EndTime) >UNIX_TIMESTAMP(NOW())-86400 
140
                                LEFT JOIN Pool ON Job.PoolId=Pool.PoolId where EndTime <= NOW() and UNIX_TIMESTAMP(EndTime) >UNIX_TIMESTAMP(NOW())-86400 
137
                                order by elapsed ";                                                                                                     // Full report array
141
                                order by elapsed ";                                                                                                     // Full report array
138
        if ( $dbSql->driver == "pgsql")
142
        if ( $dbSql->driver == "pgsql")
139
                $query = "select Job.EndTime - Job.StartTime )
143
                $query = "select (Job.EndTime - Job.StartTime )
140
                                as elapsed,Job.Name,Job.StartTime,Job.EndTime,Job.Level,Pool.Name,Job.JobStatus from Job
144
                                as elapsed,Job.Name,Job.StartTime,Job.EndTime,Job.Level,Pool.Name,Job.JobStatus from Job
141
                                LEFT JOIN Pool ON Job.PoolId=Pool.PoolId where EndTime <= NOW() and EndTime > NOW() - 86400 * interval '1 second'
145
                                LEFT JOIN Pool ON Job.PoolId=Pool.PoolId where EndTime <= NOW() and EndTime > NOW() - 86400 * interval '1 second'
142
                                order by elapsed ";
146
                                order by elapsed ";
(-)../bacula-web/classes.inc (-13 / +21 lines)
Lines 35-40 Link Here
35
        var $EndDate;
35
        var $EndDate;
36
        var $driver;
36
        var $driver;
37
	var $dbs;
37
	var $dbs;
38
	var $dbs_name;
38
39
39
40
40
41
Lines 70-76 Link Here
70
                $this->dsn['username'] = $conf->get(CONFIG_FILE,$sec,"login");
71
                $this->dsn['username'] = $conf->get(CONFIG_FILE,$sec,"login");
71
                $this->dsn['password'] = $conf->get(CONFIG_FILE,$sec,"pass");
72
                $this->dsn['password'] = $conf->get(CONFIG_FILE,$sec,"pass");
72
                $this->dsn['database'] = $conf->get(CONFIG_FILE,$sec,"db_name");
73
                $this->dsn['database'] = $conf->get(CONFIG_FILE,$sec,"db_name");
73
                $this->dsn['phptype'] = $conf->get(CONFIG_FILE,$sec,"db_type");   // mysql, (sqlite, pgsql) -->> Yet not checked
74
                $this->dsn['phptype'] = $conf->get(CONFIG_FILE,$sec,"db_type");   // mysql, pgsql
74
                if (  $conf->get(CONFIG_FILE,$sec,"db_port") )
75
                if (  $conf->get(CONFIG_FILE,$sec,"db_port") )
75
                        $this->dsn[port] = $conf->get(CONFIG_FILE,$sec,"db_port");
76
                        $this->dsn[port] = $conf->get(CONFIG_FILE,$sec,"db_port");
76
                        
77
                        
Lines 80-85 Link Here
80
                    die($this->link->getMessage());
81
                    die($this->link->getMessage());
81
                $this->driver = $this->dsn[phptype];                            
82
                $this->driver = $this->dsn[phptype];                            
82
                register_shutdown_function(array(&$this,'close'));
83
                register_shutdown_function(array(&$this,'close'));
84
		$this->dbs_name = $this->dsn['database'];
83
	}
85
	}
84
                
86
                
85
        function close() {
87
        function close() {
Lines 155-162 Link Here
155
                                return 0;
155
                                return 0;
156
                }
156
                }
157
                else if ( $this->driver == "pgsql") {
157
                else if ( $this->driver == "pgsql") {
158
                        $dbsize = $this->link->query("select database_size('bacula')")
158
                        $dbsize = $this->link->query("select pg_database_size('$this->dbs_name')")
159
                                or die ("classes.inc: Error query: 4");
159
                                or die ("classes.inc: Error query: 4");
160
                       if (PEAR::isError($dbsize))
161
                           die($dbsize->getMessage());
160
                        if ( $dbsize->numRows() ) {
162
                        if ( $dbsize->numRows() ) {
161
                                while ( $res = $dbsize->fetchRow() )
163
                                while ( $res = $dbsize->fetchRow() )
162
                                        $database_size += $res[0]; 
164
                                        $database_size += $res[0]; 
Lines 221-227 Link Here
221
                        $graph->SetXDataLabelAngle(90);
225
                        $graph->SetXDataLabelAngle(90);
222
                else
226
                else
223
                        $graph->SetXDataLabelAngle(0);
227
                        $graph->SetXDataLabelAngle(0);
224
//              $graph->SetNumXTicks(10);
228
		$graph->SetNumXTicks(1);
225
//              $graph->SetXDataLabelPos('none');
229
//              $graph->SetXDataLabelPos('none');
226
//              $graph->SetXTickLabelPos('plotdown');
230
//              $graph->SetXTickLabelPos('plotdown');
227
                
231
                
Lines 373-379 Link Here
373
                                        $result->free();
377
                                        $result->free();
374
                                        break;
378
                                        break;
375
                                case BACULA_TYPE_BYTES_ENDTIME_ALLJOBS:  // Special: Generic graph from all clientes.
379
                                case BACULA_TYPE_BYTES_ENDTIME_ALLJOBS:  // Special: Generic graph from all clientes.
376
                                        $i = -1;                         // Counter of number of jobs of one cliente. SP: Contador del nmero de jobs totales de un cliente.
380
                                        $i = -1;                         // Counter of number of jobs of one client. SP: Contador del nmero de jobs totales de un cliente.
377
                                        $i2 = 0;                         // Counter of number of keys of array. SP: Contador del nmero de valores del array.
381
                                        $i2 = 0;                         // Counter of number of keys of array. SP: Contador del nmero de valores del array.
378
                                        
382
                                        
379
                                        if ($DB_bacula->driver == "mysql") {
383
                                        if ($DB_bacula->driver == "mysql") {
Lines 383-394 Link Here
383
                                                        or die ("classes.inc: Error at query: 8");
387
                                                        or die ("classes.inc: Error at query: 8");
384
					}
388
					}
385
                                        else if ($DB_bacula->driver == "pgsql") {
389
                                        else if ($DB_bacula->driver == "pgsql") {
386
						$res = $DB_bacula->link->query("select Name from Job where EndTime > now() - interval '$this->elapsed seconds'  group by Name order by Name desc")
390
						$res = $DB_bacula->link->query("select Name from Job where EndTime > now() - 1*interval'$this->elapsed s'  group by Name order by Name desc")
387
							or die ("classes.inc: Error at query: 8");
391
							or die ("classes.inc: Error at query: 8");
388
                                                $resdata = $DB_bacula->link->query("select date(EndTime) from Job where EndTime > NOW() - interval '$this->elapsed seconds' group by EndTime order by EndTime")
392
                                                $resdata = $DB_bacula->link->query("select to_char(EndTime,'YY-MM-DD') from Job where EndTime > NOW() - 1*interval'$this->elapsed s'  group by EndTime order by EndTime")
389
                                                        or die ("classes.inc: Error at query: 9");
393
                                                        or die ("classes.inc: Error at query: 9");
390
					}
394
					}
391
                                        
395
                                        
396
					if (PEAR::isError($resdata))
397
						die("classes.inc: Error at query: 9.1<br>".$resdata->getMessage());
392
                                        while ( $tmpdata = $res->fetchRow() )
398
                                        while ( $tmpdata = $res->fetchRow() )
393
                                                array_push($this->clientes,$tmpdata[0]);
399
                                                array_push($this->clientes,$tmpdata[0]);
394
                                                
400
                                                
Lines 405-417 Link Here
405
                                                $count++;
411
                                                $count++;
406
                                                array_push($spr,$tmpdata[0]);
412
                                                array_push($spr,$tmpdata[0]);
407
                                                if ($DB_bacula->driver == "mysql")
413
                                                if ($DB_bacula->driver == "mysql")
408
                                                        $result = $DB_bacula->link->query("select date_format(EndTime,\"%Y-%m-%d\"),SUM(JobBytes),Name,count(Name) as Nname from Job WHERE EndTime like '$tmpdata[0]%' group by Name order by Name desc")
414
                                                        $result = $DB_bacula->link->query("select date_format(EndTime,\"%Y-%m-%d\"),SUM(JobBytes) as sum,Name as name,count(Name) as Nname from Job WHERE EndTime like '$tmpdata[0]%' group by Name order by Name desc")
409
                                                                or die ("classes.inc: Error at query: 10");
415
                                                                or die ("classes.inc: Error at query: 10");
410
                                                else if ($DB_bacula->driver == "pgsql")
416
                                                else if ($DB_bacula->driver == "pgsql") {
411
                                                        $result = $DB_bacula->link->query("select date(EndTime),SUM(JobBytes),Name,count(Name) as Nname from Job WHERE EndTime like '$tmpdata[0]%' group by EndTime,Name order by Name desc")
417
							$query = "select to_char(EndTime,'YY-MM-DD'),SUM(JobBytes) as sum,Name,count(Name) as Nname from Job WHERE EndTime like '%$tmpdata[0]%' group by EndTime,Name order by Name desc";
418
                                                        $result = $DB_bacula->link->query($query)
412
                                                                or die ("classes.inc: Error at query: 11");
419
                                                                or die ("classes.inc: Error at query: 11");
420
						}
413
                                                while ( $row = $result->fetchRow(DB_FETCHMODE_ASSOC) ) {
421
                                                while ( $row = $result->fetchRow(DB_FETCHMODE_ASSOC) ) {
414
                                                        $spr2 = array_merge($spr2,array($row["Name"]=>$row["SUM(JobBytes)"]));
422
                                                        $spr2 = array_merge($spr2,array($row["name"]=>$row["sum"]));
415
                                                        $i = $result->numRows();
423
                                                        $i = $result->numRows();
416
                                                }
424
                                                }
417
425
Lines 421-427 Link Here
421
//                                              echo "</pre>";
429
//                                              echo "</pre>";
422
                                                
430
                                                
423
                                                reset ($this->clientes);        
431
                                                reset ($this->clientes);        
424
												do { 
432
						do {
425
                                                        if ( $spr2[current($this->clientes)] != NULL)
433
                                                        if ( $spr2[current($this->clientes)] != NULL)
426
                                                                array_push($spr,$spr2[current($this->clientes)]);
434
                                                                array_push($spr,$spr2[current($this->clientes)]);
427
                                                        else
435
                                                        else
Lines 437-443 Link Here
437
                                                $spr = array();
445
                                                $spr = array();
438
                                                $spr2 = array();
446
                                                $spr2 = array();
439
                                        }
447
                                        }
440
                                
448
441
                                        for ( $i = 0; $i < count($whole_result); $i++ ) {  // To equal the arrays so that the graph is not unsquared. SP:Igualamos las matrices para que la gr�ica no se descuadre
449
                                        for ( $i = 0; $i < count($whole_result); $i++ ) {  // To equal the arrays so that the graph is not unsquared. SP:Igualamos las matrices para que la gr�ica no se descuadre
442
                                                $tmp = count($whole_result[$i]);
450
                                                $tmp = count($whole_result[$i]);
443
                                                if ( $i2 < $tmp )                // Estupidez?. Check this code later...
451
                                                if ( $i2 < $tmp )                // Estupidez?. Check this code later...
Lines 463-469 Link Here
463
471
464
472
465
473
466
        //Conversi� de la fecha a Mysql-format para Smarty.           THE SAME FUNCTION AT 2 CLASSES. THIS WAY IS BUGGY. TO SOLVE LATER.
474
        //Convert date from mysql to smarty.           THE SAME FUNCTION AT 2 CLASSES. THIS WAY IS BUGGY. TO SOLVE LATER.
467
        function PrepareDate($StartDateMonth,$StartDateDay,$StartDateYear,$EndDateMonth,$EndDateDay,$EndDateYear){
475
        function PrepareDate($StartDateMonth,$StartDateDay,$StartDateYear,$EndDateMonth,$EndDateDay,$EndDateYear){
468
        
476
        
469
                $this->StartDate = $StartDateYear."-".$StartDateMonth."-".$StartDateDay." 00:00:00";
477
                $this->StartDate = $StartDateYear."-".$StartDateMonth."-".$StartDateDay." 00:00:00";
(-)../bacula-web/templates/volumes.tpl (-1 / +1 lines)
Lines 23-29 Link Here
23
                                        <td background="images/bg5.png" class=tbl_pool_inter_2>{t}Volume Bytes{/t}</td>
23
                                        <td background="images/bg5.png" class=tbl_pool_inter_2>{t}Volume Bytes{/t}</td>
24
                                        <td background="images/bg5.png" class=tbl_pool_inter_2>{t}Media Type{/t}</td>
24
                                        <td background="images/bg5.png" class=tbl_pool_inter_2>{t}Media Type{/t}</td>
25
                                        <td background="images/bg5.png" class=tbl_pool_inter_2>{t}When expire?{/t}</td>
25
                                        <td background="images/bg5.png" class=tbl_pool_inter_2>{t}When expire?{/t}</td>
26
                                        <td background="images/bg5.png" class=tbl_pool_inter_2>{t}Last Written{/t}                                      
26
                                        <td background="images/bg5.png" class=tbl_pool_inter_2>{t}Last Written{/t}</td>                                      
27
                                        <td background="images/bg5.png" class=tbl_pool_inter_3>{t}Volume Status{/t}</td>
27
                                        <td background="images/bg5.png" class=tbl_pool_inter_3>{t}Volume Status{/t}</td>
28
                                </tr>
28
                                </tr>
29
                        {/if}
29
                        {/if}

Return to bug 126754