2012-04-20 Kikuchi Koichiro <koichiro@rworks.jp>
* extensions/update_manager.php, extensions/update_manager/sql/update_manager.sql, extensions/update_manager/sql/update_manager.postgreSQL.sql, extensions/update_manager/sql/update_manager.oracle.sql, extensions/update_manager/lib/libupdate_manager_client.php, extensions/update_manager/lib/libupdate_manager.php, include/db/postgresql.php, include/db/oracle.php, include/db/mysql.php, include/functions_config.php, include/config_process.php, include/functions_db.php: Now pandora_console support DB running on non-standard port. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6055 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
95950df2ad
commit
cc4c44cd80
|
@ -1,3 +1,19 @@
|
|||
2012-04-20 Kikuchi Koichiro <koichiro@rworks.jp>
|
||||
|
||||
* extensions/update_manager.php,
|
||||
extensions/update_manager/sql/update_manager.sql,
|
||||
extensions/update_manager/sql/update_manager.postgreSQL.sql,
|
||||
extensions/update_manager/sql/update_manager.oracle.sql,
|
||||
extensions/update_manager/lib/libupdate_manager_client.php,
|
||||
extensions/update_manager/lib/libupdate_manager.php,
|
||||
include/db/postgresql.php,
|
||||
include/db/oracle.php,
|
||||
include/db/mysql.php,
|
||||
include/functions_config.php,
|
||||
include/config_process.php,
|
||||
include/functions_db.php: Now pandora_console support DB
|
||||
running on non-standard port.
|
||||
|
||||
2012-04-19 Sancho Lerena <slerena@artica.es>
|
||||
|
||||
* operation/agentes/estado_monitores.php: Put units in module view.
|
||||
|
|
|
@ -85,7 +85,8 @@ function update_settings_database_connection () {
|
|||
global $config;
|
||||
|
||||
um_db_connect ('mysql', $config['dbhost'], $config['dbuser'],
|
||||
$config['dbpass'], $config['dbname']);
|
||||
$config['dbpass'], $config['dbname'], $config['dbport']);
|
||||
um_db_update_setting ('dbport', $config['dbport']);
|
||||
um_db_update_setting ('dbname', $config['dbname']);
|
||||
um_db_update_setting ('dbuser', $config['dbuser']);
|
||||
um_db_update_setting ('dbpass', $config['dbpass']);
|
||||
|
@ -120,7 +121,7 @@ function pandora_update_manager_install () {
|
|||
db_process_sql_insert('tconfig', $values);
|
||||
|
||||
um_db_connect ('mysql', $config['dbhost'], $config['dbuser'],
|
||||
$config['dbpass'], $config['dbname']);
|
||||
$config['dbpass'], $config['dbname'], $config['dbport']);
|
||||
um_db_update_setting ('updating_code_path',
|
||||
dirname ($_SERVER['SCRIPT_FILENAME']));
|
||||
update_settings_database_connection ();
|
||||
|
@ -183,7 +184,7 @@ function pandora_update_manager_login () {
|
|||
|
||||
if (enterprise_installed()) {
|
||||
um_db_connect ('mysql', $config['dbhost'], $config['dbuser'],
|
||||
$config['dbpass'], $config['dbname']);
|
||||
$config['dbpass'], $config['dbname'], $config['dbport']);
|
||||
$settings = um_db_load_settings ();
|
||||
|
||||
$user_key = get_user_key ($settings);
|
||||
|
|
|
@ -793,14 +793,14 @@ function um_db_is_auth_developer ($id_auth) {
|
|||
return (bool) $developer;
|
||||
}
|
||||
|
||||
function um_db_connect ($backend = 'mysql', $host = '', $user = '', $password = '', $db_name = '') {
|
||||
return db_connect ($host, $db_name, $user, $password);
|
||||
function um_db_connect ($backend = 'mysql', $host = '', $user = '', $password = '', $db_name = '', $port = null) {
|
||||
return db_connect ($host, $db_name, $user, $password, null, $port);
|
||||
}
|
||||
|
||||
function um_component_db_connect () {
|
||||
$settings = um_db_load_settings ();
|
||||
|
||||
return db_connect ($settings->dbhost, $settings->dbname, $settings->dbuser, $settings->dbpass);
|
||||
return db_connect ($settings->dbhost, $settings->dbname, $settings->dbuser, $settings->dbpass, null, $settings->dbport);
|
||||
}
|
||||
|
||||
function um_get_package_status () {
|
||||
|
|
|
@ -666,7 +666,7 @@ function um_client_db_connect (&$settings = NULL) {
|
|||
$settings = um_db_load_settings ();
|
||||
|
||||
//mysql_select_db (DB_NAME);
|
||||
mysql_connect ($settings->dbhost, $settings->dbuser,
|
||||
mysql_connect ($settings->dbhost . ':' . $settings->dbport, $settings->dbuser,
|
||||
$settings->dbpass);
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -11,6 +11,7 @@ CREATE TABLE tupdate_settings ( key VARCHAR2(255) default '' PRIMARY KEY, value
|
|||
/INSERT INTO tupdate_settings VALUES ('dbhost', '')
|
||||
/INSERT INTO tupdate_settings VALUES ('dbpass', '')
|
||||
/INSERT INTO tupdate_settings VALUES ('dbuser', '')
|
||||
/INSERT INTO tupdate_settings VALUES ('dbport', '')
|
||||
/INSERT INTO tupdate_settings VALUES ('proxy', '')
|
||||
/INSERT INTO tupdate_settings VALUES ('proxy_port', '')
|
||||
/INSERT INTO tupdate_settings VALUES ('proxy_user', '')
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
CREATE TABLE "tupdate_settings" ( "key" varchar(255) default '' PRIMARY KEY, "value" varchar(255) default '');
|
||||
INSERT INTO "tupdate_settings" VALUES ('current_update', '0'), ('customer_key', 'PANDORA-FREE'), ('keygen_path', '/usr/share/pandora/util/keygen'), ('update_server_host', 'www.artica.es'), ('update_server_port', '80'), ('update_server_path', '/pandoraupdate4/server.php'), ('updating_binary_path', 'Path where the updated binary files will be stored'), ('updating_code_path', 'Path where the updated code is stored'), ('dbname', ''), ('dbhost', ''), ('dbpass', ''), ('dbuser', ''), ('proxy', ''), ('proxy_port', ''), ('proxy_user', ''), ('proxy_pass', '');
|
||||
INSERT INTO "tupdate_settings" VALUES ('current_update', '0'), ('customer_key', 'PANDORA-FREE'), ('keygen_path', '/usr/share/pandora/util/keygen'), ('update_server_host', 'www.artica.es'), ('update_server_port', '80'), ('update_server_path', '/pandoraupdate4/server.php'), ('updating_binary_path', 'Path where the updated binary files will be stored'), ('updating_code_path', 'Path where the updated code is stored'), ('dbname', ''), ('dbhost', ''), ('dbpass', ''), ('dbuser', ''), ('dbport', ''), ('proxy', ''), ('proxy_port', ''), ('proxy_user', ''), ('proxy_pass', '');
|
||||
CREATE TABLE "tupdate_package"( "id" SERIAL NOT NULL PRIMARY KEY, "timestamp" TIMESTAMP without time zone default NULL, "description" varchar(255) default '');
|
||||
CREATE TYPE type_tupdate_type AS ENUM ('code', 'db_data', 'db_schema', 'binary');
|
||||
CREATE TABLE "tupdate" ( "id" SERIAL NOT NULL PRIMARY KEY, "type" type_tupdate_type, "id_update_package" INTEGER default 0 REFERENCES "tupdate_package"("id") ON UPDATE CASCADE ON DELETE CASCADE, "filename" varchar(250) default '', "checksum" varchar(250) default '', "previous_checksum" varchar(250) default '', "svn_version" INTEGER default 0, "data" TEXT default '', "data_rollback" TEXT default '', "description" TEXT default '', "db_table_name" varchar(140) default '', "db_field_name" varchar(140) default '', "db_field_value" varchar(1024) default '');
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
CREATE TABLE `tupdate_settings` ( `key` varchar(255) default '', `value` varchar(255) default '', PRIMARY KEY (`key`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
INSERT INTO `tupdate_settings` VALUES ('current_update', '0'), ('customer_key', 'PANDORA-FREE'), ('keygen_path', '/usr/share/pandora/util/keygen'), ('update_server_host', 'www.artica.es'), ('update_server_port', '80'), ('update_server_path', '/pandoraupdate4/server.php'), ('updating_binary_path', 'Path where the updated binary files will be stored'), ('updating_code_path', 'Path where the updated code is stored'), ('dbname', ''), ('dbhost', ''), ('dbpass', ''), ('dbuser', ''), ('proxy', ''), ('proxy_port', ''), ('proxy_user', ''), ('proxy_pass', '');
|
||||
INSERT INTO `tupdate_settings` VALUES ('current_update', '0'), ('customer_key', 'PANDORA-FREE'), ('keygen_path', '/usr/share/pandora/util/keygen'), ('update_server_host', 'www.artica.es'), ('update_server_port', '80'), ('update_server_path', '/pandoraupdate4/server.php'), ('updating_binary_path', 'Path where the updated binary files will be stored'), ('updating_code_path', 'Path where the updated code is stored'), ('dbname', ''), ('dbhost', ''), ('dbpass', ''), ('dbuser', ''), ('dbport', ''), ('proxy', ''), ('proxy_port', ''), ('proxy_user', ''), ('proxy_pass', '');
|
||||
CREATE TABLE `tupdate_package` ( id int(11) unsigned NOT NULL auto_increment, timestamp datetime NOT NULL, description varchar(255) default '', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
CREATE TABLE `tupdate` ( id int(11) unsigned NOT NULL auto_increment, type enum('code', 'db_data', 'db_schema', 'binary'), id_update_package int(11) unsigned NOT NULL default 0, filename varchar(250) default '', checksum varchar(250) default '', previous_checksum varchar(250) default '', svn_version int(4) unsigned NOT NULL default 0, data LONGTEXT default '', data_rollback LONGTEXT default '', description TEXT default '', db_table_name varchar(140) default '', db_field_name varchar(140) default '', db_field_value varchar(1024) default '', PRIMARY KEY (`id`), FOREIGN KEY (`id_update_package`) REFERENCES tupdate_package(`id`) ON UPDATE CASCADE ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
CREATE TABLE `tupdate_journal` ( id int(11) unsigned NOT NULL auto_increment, id_update int(11) unsigned NOT NULL default 0, PRIMARY KEY (`id`), FOREIGN KEY (`id_update`) REFERENCES tupdate(`id`) ON UPDATE CASCADE ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
|
|
@ -69,6 +69,20 @@ if (!isset($config['dbtype'])) {
|
|||
$config['dbtype'] = 'mysql';
|
||||
}
|
||||
|
||||
if (!isset($config['dbport'])) {
|
||||
switch ($config['dbtype']) {
|
||||
case 'mysql':
|
||||
$config['dbport'] = '3306';
|
||||
break;
|
||||
case 'postgresql':
|
||||
$config['dbport'] = '5432';
|
||||
break;
|
||||
case 'oracle':
|
||||
$config['dbport'] = '1521';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
require_once ($ownDir . 'constants.php');
|
||||
require_once ($ownDir . 'functions_db.php');
|
||||
require_once ($ownDir . 'functions.php');
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
function mysql_connect_db($host = null, $db = null, $user = null, $pass = null, $history = null) {
|
||||
function mysql_connect_db($host = null, $db = null, $user = null, $pass = null, $history = null, $port = null) {
|
||||
global $config;
|
||||
|
||||
if ($host === null)
|
||||
|
@ -25,11 +25,13 @@ function mysql_connect_db($host = null, $db = null, $user = null, $pass = null,
|
|||
$user = $config["dbuser"];
|
||||
if ($pass === null)
|
||||
$pass = $config["dbpass"];
|
||||
|
||||
if ($port === null)
|
||||
$port = $config["dbport"];
|
||||
|
||||
// Non-persistent connection: This will help to avoid mysql errors like "has gone away" or locking problems
|
||||
// If you want persistent connections change it to mysql_pconnect().
|
||||
|
||||
$connect_id = mysql_connect($host, $user, $pass);
|
||||
$connect_id = mysql_connect($host . ":" . $port, $user, $pass);
|
||||
mysql_select_db($db, $connect_id);
|
||||
|
||||
if (! $connect_id) {
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
function oracle_connect_db($host = null, $db = null, $user = null, $pass = null, $history = null) {
|
||||
function oracle_connect_db($host = null, $db = null, $user = null, $pass = null, $history = null, $port = null) {
|
||||
global $config;
|
||||
|
||||
if ($host === null)
|
||||
|
@ -25,10 +25,12 @@ function oracle_connect_db($host = null, $db = null, $user = null, $pass = null,
|
|||
$user = $config["dbuser"];
|
||||
if ($pass === null)
|
||||
$pass = $config["dbpass"];
|
||||
if ($port === null)
|
||||
$port = $config["dbport"];
|
||||
|
||||
// Non-persistent connection: This will help to avoid mysql errors like "has gone away" or locking problems
|
||||
// If you want persistent connections change it to oci_pconnect().
|
||||
$connect_id = oci_connect($user, $pass, '//' . $host . '/' . $db);
|
||||
$connect_id = oci_connect($user, $pass, '//' . $host . ':' . $port . '/' . $db);
|
||||
|
||||
if (! $connect_id) {
|
||||
include ($config["homedir"]."/general/error_authconfig.php");
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
function postgresql_connect_db($host = null, $db = null, $user = null, $pass = null, $history = null) {
|
||||
function postgresql_connect_db($host = null, $db = null, $user = null, $pass = null, $history = null, $port = null) {
|
||||
global $config;
|
||||
|
||||
if ($host === null)
|
||||
|
@ -25,8 +25,11 @@ function postgresql_connect_db($host = null, $db = null, $user = null, $pass = n
|
|||
$user = $config["dbuser"];
|
||||
if ($pass === null)
|
||||
$pass = $config["dbpass"];
|
||||
if ($port === null)
|
||||
$port = $config["dbport"];
|
||||
|
||||
$connect_id = pg_connect("host='" . $host . "'" .
|
||||
" port=" . $port .
|
||||
" dbname='" . $db . "'" .
|
||||
" user='" . $user . "'" .
|
||||
" password='" . $pass . "'");
|
||||
|
|
|
@ -757,7 +757,7 @@ function config_check (){
|
|||
if (enterprise_installed()) {
|
||||
if ($config['update_manager_installed'] == 1) {
|
||||
um_db_connect ('mysql', $config['dbhost'], $config['dbuser'],
|
||||
$config['dbpass'], $config['dbname']);
|
||||
$config['dbpass'], $config['dbname'], $config['dbport']);
|
||||
|
||||
$settings = um_db_load_settings ();
|
||||
|
||||
|
|
|
@ -42,18 +42,18 @@ function db_select_engine() {
|
|||
}
|
||||
}
|
||||
|
||||
function db_connect($host = null, $db = null, $user = null, $pass = null, $history = null) {
|
||||
function db_connect($host = null, $db = null, $user = null, $pass = null, $history = null, $port = null) {
|
||||
global $config;
|
||||
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
return mysql_connect_db($host, $db, $user, $pass, $history);
|
||||
return mysql_connect_db($host, $db, $user, $pass, $history, $port);
|
||||
break;
|
||||
case "postgresql":
|
||||
return postgresql_connect_db($host, $db, $user, $pass, $history);
|
||||
return postgresql_connect_db($host, $db, $user, $pass, $history, $port);
|
||||
break;
|
||||
case "oracle":
|
||||
return oracle_connect_db($host, $db, $user, $pass, $history);
|
||||
return oracle_connect_db($host, $db, $user, $pass, $history, $port);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue