2011-03-07 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_db.php, godmode/admin_access_logs.php: changes for the interval operator in PostgreSQL. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4064 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
ebcde11846
commit
67d1a8ca13
|
@ -1,3 +1,8 @@
|
|||
2011-03-07 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* include/functions_db.php, godmode/admin_access_logs.php: changes for the
|
||||
interval operator in PostgreSQL.
|
||||
|
||||
2011-03-07 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
|
||||
|
||||
* pandoradb.oracle.sql: Added to repository. Creation script with some
|
||||
|
|
|
@ -103,7 +103,14 @@ if ($filter_ip != '') {
|
|||
}
|
||||
|
||||
if ($filter_hours_old != 0) {
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$filter .= ' AND fecha >= DATE_ADD(NOW(), INTERVAL -' . $filter_hours_old . ' HOUR)';
|
||||
break;
|
||||
case "postgresql":
|
||||
$filter .= ' AND fecha >= DATE_ADD(NOW(), INTERVAL - \'' . $filter_hours_old . ' HOUR \')';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$sql = "SELECT COUNT(*) FROM tsesion " . $filter;
|
||||
|
|
|
@ -3081,7 +3081,16 @@ function __ ($string /*, variable arguments */) {
|
|||
* @return int The number of servers alive.
|
||||
*/
|
||||
function check_server_status () {
|
||||
global $config;
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$sql = "SELECT COUNT(id_server) FROM tserver WHERE status = 1 AND keepalive > NOW() - INTERVAL 15 MINUTE";
|
||||
break;
|
||||
case "postgresql":
|
||||
$sql = "SELECT COUNT(id_server) FROM tserver WHERE status = 1 AND keepalive > NOW() - INTERVAL '15 MINUTE'";
|
||||
break;
|
||||
}
|
||||
$status = (int) get_db_sql ($sql); //Cast as int will assure a number value
|
||||
// This function should just ack of server down, not set it down.
|
||||
return $status;
|
||||
|
|
Loading…
Reference in New Issue