diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 1082b58d4f..32f61be673 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,4 +1,9 @@ -2011-03-10 Miguel de Dios +2011-03-11 Miguel de Dios + + * extensions/update_manager.php, + extensions/update_manager/load_updatemanager.php: changes for PostgreSQL. + +2011-03-11 Miguel de Dios * include/db/postgresql.php, operation/agentes/estado_agente.php: erased the lost call to traces messages. diff --git a/pandora_console/extensions/update_manager.php b/pandora_console/extensions/update_manager.php index ae58e1c3ef..45f7680d8a 100644 --- a/pandora_console/extensions/update_manager.php +++ b/pandora_console/extensions/update_manager.php @@ -38,16 +38,22 @@ function pandora_update_manager_install () { load_update_manager_lib (); /* SQL installation */ - $sentences = file (EXTENSIONS_DIR.'/update_manager/sql/update_manager.sql'); + switch ($config['dbtype']) { + case 'mysql': + $sentences = file (EXTENSIONS_DIR.'/update_manager/sql/update_manager.sql'); + break; + case 'postgresql': + $sentences = file (EXTENSIONS_DIR.'/update_manager/sql/update_manager.postgreSQL.sql'); + break; + } foreach ($sentences as $sentence) { $success = process_sql ($sentence); if ($success === false) return; } - $sql = 'INSERT INTO `tconfig` (`token`, `value`) - VALUES ("update_manager_installed", 1)'; - process_sql ($sql); + $values = array("token" => "update_manager_installed", "value" => 1); + process_sql_insert('tconfig', $values); um_db_connect ('mysql', $config['dbhost'], $config['dbuser'], $config['dbpass'], $config['dbname']); @@ -146,12 +152,4 @@ if(isset($config['id_user'])) { pandora_update_manager_install (); $db = NULL; -switch ($config['dbtype']) { - case 'mysql': - pandora_update_manager_install (); - break; - case 'postgresql': - //TODO MAKE THE UPDATE MANAGER FOR POSTGRESQL - break; -} ?> diff --git a/pandora_console/extensions/update_manager/load_updatemanager.php b/pandora_console/extensions/update_manager/load_updatemanager.php index 1a02a7642f..993217fa15 100644 --- a/pandora_console/extensions/update_manager/load_updatemanager.php +++ b/pandora_console/extensions/update_manager/load_updatemanager.php @@ -26,6 +26,8 @@ if (! extension_loaded ('mysql')) require_once ('lib/libupdate_manager.php'); function get_user_key ($settings) { + global $config; + if ($settings->customer_key != FREE_USER) { if (! file_exists ($settings->keygen_path)) { echo '

'; @@ -59,9 +61,18 @@ function get_user_key ($settings) { global $build_version; global $pandora_version; - $n = (int) get_db_value ('COUNT(`id_agente`)', 'tagente', 'disabled', 0); - $m = (int) get_db_value ('COUNT(`id_agente_modulo`)', 'tagente_modulo', + switch ($config['dbtype']) { + case 'mysql': + $n = (int) get_db_value ('COUNT(`id_agente`)', 'tagente', 'disabled', 0); + $m = (int) get_db_value ('COUNT(`id_agente_modulo`)', 'tagente_modulo', 'disabled', 0); + break; + case 'postgresql': + $n = (int) get_db_value ('COUNT("id_agente")', 'tagente', 'disabled', 0); + $m = (int) get_db_value ('COUNT("id_agente_modulo")', 'tagente_modulo', + 'disabled', 0); + break; + } $user_key = array ('A' => $n, 'M' => $m, 'B' => $build_version, 'P' => $pandora_version); return json_encode ($user_key);