From 4e1110a052ffd208f52011e256166bc33c3acf3a Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Mon, 28 Jun 2021 21:21:31 +0200 Subject: [PATCH] MQ up to down connections (MC => NODES) --- pandora_console/godmode/groups/modu_group_list.php | 2 +- pandora_console/include/db/mysql.php | 4 ++-- pandora_console/include/db/oracle.php | 4 ++-- pandora_console/include/db/postgresql.php | 4 ++-- pandora_console/include/functions_db.php | 9 +++++---- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/pandora_console/godmode/groups/modu_group_list.php b/pandora_console/godmode/groups/modu_group_list.php index 4aa6bab921..107f6b4703 100644 --- a/pandora_console/godmode/groups/modu_group_list.php +++ b/pandora_console/godmode/groups/modu_group_list.php @@ -83,7 +83,7 @@ if (is_management_allowed() === false) { __( 'This node is configured with centralized mode. All module groups information is read only. Go to %s to manage it.', ''.__('metaconsole').'' ) ); diff --git a/pandora_console/include/db/mysql.php b/pandora_console/include/db/mysql.php index abe119b7d9..d1c2c7bcdf 100644 --- a/pandora_console/include/db/mysql.php +++ b/pandora_console/include/db/mysql.php @@ -846,10 +846,10 @@ function mysql_db_get_value_sql($sql, $dbconnection=false) * * @return mixed The first row of the result or false */ -function mysql_db_get_row_sql($sql, $search_history_db=false) +function mysql_db_get_row_sql($sql, $search_history_db=false, $cache=true) { $sql .= ' LIMIT 1'; - $result = db_get_all_rows_sql($sql, $search_history_db); + $result = db_get_all_rows_sql($sql, $search_history_db, $cache); if ($result === false) { return false; diff --git a/pandora_console/include/db/oracle.php b/pandora_console/include/db/oracle.php index 150cc95de2..617acc5392 100644 --- a/pandora_console/include/db/oracle.php +++ b/pandora_console/include/db/oracle.php @@ -1004,10 +1004,10 @@ function oracle_db_get_value_sql($sql, $dbconnection=false) * * @return mixed The first row of the result or false */ -function oracle_db_get_row_sql($sql, $search_history_db=false) +function oracle_db_get_row_sql($sql, $search_history_db=false, $cache=true) { $sql = 'SELECT * FROM ('.$sql.') WHERE rownum < 2'; - $result = oracle_db_get_all_rows_sql($sql, $search_history_db); + $result = oracle_db_get_all_rows_sql($sql, $search_history_db, $cache); if ($result === false) { return false; diff --git a/pandora_console/include/db/postgresql.php b/pandora_console/include/db/postgresql.php index e80debaaff..667c511bf2 100644 --- a/pandora_console/include/db/postgresql.php +++ b/pandora_console/include/db/postgresql.php @@ -713,10 +713,10 @@ function postgresql_db_get_value_sql($sql, $dbconnection=false) * * @return mixed The first row of the result or false */ -function postgresql_db_get_row_sql($sql, $search_history_db=false) +function postgresql_db_get_row_sql($sql, $search_history_db=false, $cache=true) { $sql .= ' LIMIT 1'; - $result = postgresql_db_get_all_rows_sql($sql, $search_history_db); + $result = postgresql_db_get_all_rows_sql($sql, $search_history_db, $cache); if ($result === false) { return false; diff --git a/pandora_console/include/functions_db.php b/pandora_console/include/functions_db.php index 83c83ebe0a..aed0cfaf55 100644 --- a/pandora_console/include/functions_db.php +++ b/pandora_console/include/functions_db.php @@ -442,21 +442,21 @@ function db_get_value_sql($sql, $dbconnection=false) * * @return mixed The first row of the result or false */ -function db_get_row_sql($sql, $search_history_db=false) +function db_get_row_sql($sql, $search_history_db=false, $cache=true) { global $config; switch ($config['dbtype']) { case 'mysql': - return mysql_db_get_row_sql($sql, $search_history_db); + return mysql_db_get_row_sql($sql, $search_history_db, $cache); break; case 'postgresql': - return postgresql_db_get_row_sql($sql, $search_history_db); + return postgresql_db_get_row_sql($sql, $search_history_db, $cache); break; case 'oracle': - return oracle_db_get_row_sql($sql, $search_history_db); + return oracle_db_get_row_sql($sql, $search_history_db, $cache); break; } @@ -1378,6 +1378,7 @@ function db_process_sql($sql, $rettype='affected_rows', $dbconnection='', $cache if ($rc !== false) { if (enterprise_hook('is_metaconsole') === true + && isset($config['centralized_management']) === true && (bool) $config['centralized_management'] === true && $dbconnection === '' ) {