2011-05-17 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/graphs/fgraph.php include/config_process.php include/functions_agents.php operation/agentes/status_monitor.php operation/agentes/estado_agente.php: Several corrections over sql queries for Oracle DBMS. * godmode/db/db_info.php: Added include to functions_fsgraph.php git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4363 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
8116e4b51e
commit
194478e887
|
@ -1,3 +1,14 @@
|
||||||
|
2011-05-17 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
|
||||||
|
|
||||||
|
* include/graphs/fgraph.php
|
||||||
|
include/config_process.php
|
||||||
|
include/functions_agents.php
|
||||||
|
operation/agentes/status_monitor.php
|
||||||
|
operation/agentes/estado_agente.php: Several corrections
|
||||||
|
over sql queries for Oracle DBMS.
|
||||||
|
* godmode/db/db_info.php: Added include to
|
||||||
|
functions_fsgraph.php
|
||||||
|
|
||||||
2011-05-17 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
|
2011-05-17 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
|
||||||
|
|
||||||
* include/graphs/fgraph.php
|
* include/graphs/fgraph.php
|
||||||
|
|
|
@ -21,6 +21,7 @@ global $config;
|
||||||
require_once ($config["homedir"] . '/include/functions_graph.php');
|
require_once ($config["homedir"] . '/include/functions_graph.php');
|
||||||
require_once($config['homedir'] . "/include/functions_agents.php");
|
require_once($config['homedir'] . "/include/functions_agents.php");
|
||||||
require_once($config['homedir'] . "/include/functions_modules.php");
|
require_once($config['homedir'] . "/include/functions_modules.php");
|
||||||
|
require_once($config['homedir'] . "/include/functions_fsgraph.php");
|
||||||
|
|
||||||
ui_print_page_header (__('Database maintenance').' » '.__('Database information'), "images/god8.png", false, "", true);
|
ui_print_page_header (__('Database maintenance').' » '.__('Database information'), "images/god8.png", false, "", true);
|
||||||
|
|
||||||
|
|
|
@ -152,7 +152,22 @@ if (isset($config['history_db_enabled'])) {
|
||||||
|
|
||||||
// Make dbconnection the default connection again (the link identifier of the already opened link will be returned)
|
// Make dbconnection the default connection again (the link identifier of the already opened link will be returned)
|
||||||
db_connect();
|
db_connect();
|
||||||
require_once("include/fgraph.php");
|
|
||||||
|
function include_graphs_dependencies($home_url = '', $serialize_ttl = 1) {
|
||||||
|
global $ttl;
|
||||||
|
global $homeurl;
|
||||||
|
|
||||||
|
$ttl = $serialize_ttl;
|
||||||
|
$homeurl = $home_url;
|
||||||
|
|
||||||
|
include_once($homeurl . 'include/functions.php');
|
||||||
|
include_once($homeurl . 'include/functions_html.php');
|
||||||
|
|
||||||
|
include_once($homeurl . 'include/graphs/functions_fsgraph.php');
|
||||||
|
include_once($homeurl . 'include/graphs/functions_gd.php');
|
||||||
|
include_once($homeurl . 'include/graphs/functions_utils.php');
|
||||||
|
}
|
||||||
|
//require_once("include/fgraph.php");
|
||||||
include_graphs_dependencies();
|
include_graphs_dependencies();
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -803,7 +803,7 @@ function agents_get_group_agents ($id_group = 0, $search = false, $case = "lower
|
||||||
$search_sql .= ' AND nombre COLLATE utf8_general_ci LIKE \'' . $name . '\' ';
|
$search_sql .= ' AND nombre COLLATE utf8_general_ci LIKE \'' . $name . '\' ';
|
||||||
break;
|
break;
|
||||||
case "oracle":
|
case "oracle":
|
||||||
$search_sql .= ' AND nombre LIKE UPPER("' . $name . '") ';
|
$search_sql .= ' AND UPPER(nombre) LIKE UPPER(\'' . $name . '\') ';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -958,13 +958,29 @@ function agents_get_modules ($id_agent = null, $details = false, $filter = false
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($value[0] == '%') {
|
if ($value[0] == '%') {
|
||||||
array_push ($fields, $field.' LIKE "'.$value.'"');
|
switch ($config['dbtype']){
|
||||||
|
case "mysql":
|
||||||
|
case "postgresql":
|
||||||
|
array_push ($fields, $field.' LIKE "'.$value.'"');
|
||||||
|
break;
|
||||||
|
case "oracle":
|
||||||
|
array_push ($fields, $field.' LIKE \''.$value.'\'');
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if ($operatorDistin) {
|
else if ($operatorDistin) {
|
||||||
array_push($fields, $field.' <> ' . substr($value, 2));
|
array_push($fields, $field.' <> ' . substr($value, 2));
|
||||||
}
|
}
|
||||||
else if (substr($value, -1) == '%') {
|
else if (substr($value, -1) == '%') {
|
||||||
array_push ($fields, $field.' LIKE "'.$value.'"');
|
switch ($config['dbtype']){
|
||||||
|
case "mysql":
|
||||||
|
case "postgresql":
|
||||||
|
array_push ($fields, $field.' LIKE "'.$value.'"');
|
||||||
|
break;
|
||||||
|
case "oracle":
|
||||||
|
array_push ($fields, $field.' LIKE \''.$value.'\'');
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
switch ($config["dbtype"]) {
|
switch ($config["dbtype"]) {
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
$ttl = 1;
|
$ttl = 1;
|
||||||
$homeurl = '';
|
$homeurl = '';
|
||||||
|
|
||||||
function include_graphs_dependencies($home_url = '', $serialize_ttl = 1) {
|
/*function include_graphs_dependencies($home_url = '', $serialize_ttl = 1) {
|
||||||
global $ttl;
|
global $ttl;
|
||||||
global $homeurl;
|
global $homeurl;
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ function include_graphs_dependencies($home_url = '', $serialize_ttl = 1) {
|
||||||
include_once($homeurl . 'include/graphs/functions_fsgraph.php');
|
include_once($homeurl . 'include/graphs/functions_fsgraph.php');
|
||||||
include_once($homeurl . 'include/graphs/functions_gd.php');
|
include_once($homeurl . 'include/graphs/functions_gd.php');
|
||||||
include_once($homeurl . 'include/graphs/functions_utils.php');
|
include_once($homeurl . 'include/graphs/functions_utils.php');
|
||||||
}
|
}*/
|
||||||
/*
|
/*
|
||||||
// If is called from index
|
// If is called from index
|
||||||
if(file_exists('include/functions.php')) {
|
if(file_exists('include/functions.php')) {
|
||||||
|
|
|
@ -60,6 +60,15 @@ if (is_ajax ()) {
|
||||||
ORDER BY sort_order DESC", $id_template, $filter_groups);
|
ORDER BY sort_order DESC", $id_template, $filter_groups);
|
||||||
break;
|
break;
|
||||||
case "oracle":
|
case "oracle":
|
||||||
|
$sql = sprintf ("SELECT t1.id, t1.name,
|
||||||
|
(SELECT COUNT(t2.id)
|
||||||
|
FROM talert_templates t2
|
||||||
|
WHERE t2.id = %d
|
||||||
|
AND t2.id_alert_action = t1.id) as sort_order
|
||||||
|
FROM talert_actions t1
|
||||||
|
WHERE id_group IN (%s)
|
||||||
|
ORDER BY sort_order DESC", $id_template, $filter_groups);
|
||||||
|
break;
|
||||||
case "postgresql":
|
case "postgresql":
|
||||||
$sql = sprintf ("SELECT t1.id, t1.name,
|
$sql = sprintf ("SELECT t1.id, t1.name,
|
||||||
(SELECT COUNT(t2.id)
|
(SELECT COUNT(t2.id)
|
||||||
|
|
|
@ -129,44 +129,46 @@ switch ($config["dbtype"]) {
|
||||||
$sql .= ')';
|
$sql .= ')';
|
||||||
break;
|
break;
|
||||||
case "oracle":
|
case "oracle":
|
||||||
//TODO PENDING TO OPTIMIZE
|
$profiles = db_get_all_rows_sql('SELECT id_grupo
|
||||||
$names = oracle_db_get_all_rows_filter ('user_tab_columns',array ('table_name' => 'TAGENTE_MODULO', 'column_name' => '<>NOMBRE'), 'column_name');
|
FROM tusuario_perfil t1
|
||||||
$column_names = '';
|
INNER JOIN tperfil t2 ON t1.id_perfil = t2.id_perfil
|
||||||
foreach ($names as $column_name => $value) {
|
WHERE t2.agent_view = 1 AND t1.id_usuario = \'' . $config['id_user'] . '\';');
|
||||||
$column_names .= $value['column_name'] . ',';
|
if ($profiles === false)
|
||||||
}
|
$profiles = array();
|
||||||
|
|
||||||
$column_names = substr($column_names,0,-1);
|
$id_groups = array();
|
||||||
$sql = '
|
$flag_all_group = false;
|
||||||
select nombre
|
foreach ($profiles as $profile) {
|
||||||
from (select distinct dbms_lob.substr(nombre,4000,1) as nombre, ' . $column_names .' from tagente_modulo)
|
if ($profile['id_grupo'] == 0) {
|
||||||
where nombre <> \'delete_pending\' ' . $subquery_enterprise . ' AND id_agente in
|
$flag_all_group = true;
|
||||||
|
}
|
||||||
|
$id_groups[] = $profile['id_grupo'];
|
||||||
|
}
|
||||||
|
|
||||||
|
//The check of is_admin
|
||||||
|
$flag_is_admin = (bool)db_get_value('is_admin', 'tusuario', 'id_user', $config['id_user']);
|
||||||
|
|
||||||
|
$sql = ' SELECT distinct dbms_lob.substr(nombre,4000,1) as nombre
|
||||||
|
FROM tagente_modulo
|
||||||
|
WHERE dbms_lob.substr(nombre,4000,1) <> \'delete_pending\' ' . $subquery_enterprise . ' AND id_agente IN
|
||||||
(
|
(
|
||||||
select id_agente
|
SELECT id_agente
|
||||||
from tagente where id_grupo IN (
|
FROM tagente
|
||||||
select id_grupo
|
WHERE';
|
||||||
from tusuario_perfil
|
|
||||||
where id_usuario = \'' . $config['id_user'] . '\'
|
if ($flag_is_admin || $flag_all_group) {
|
||||||
and id_perfil IN (
|
$sql .= ' 1 = 1 ';
|
||||||
select id_perfil
|
}
|
||||||
from tperfil where agent_view = 1
|
else {
|
||||||
)
|
if (empty($id_groups)) {
|
||||||
)
|
$sql .= ' 1 = 0 ';
|
||||||
OR
|
}
|
||||||
(1 = (
|
else {
|
||||||
SELECT is_admin FROM tusuario WHERE id_user = \'' . $config['id_user'] . '\'
|
$sql .= ' id_grupo IN (' . implode(',', $id_groups) . ') ';
|
||||||
)
|
}
|
||||||
)
|
}
|
||||||
OR 0 IN (
|
|
||||||
select id_grupo
|
$sql .= ')';
|
||||||
from tusuario_perfil
|
|
||||||
where id_usuario = \'' . $config['id_user'] . '\'
|
|
||||||
and id_perfil IN (
|
|
||||||
select id_perfil
|
|
||||||
from tperfil where agent_view = 1
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)';
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue