Force separate connection for controluser queries
This commit is contained in:
@@ -1258,18 +1258,16 @@ h1 {font-family: sans-serif; font-size: large; font-weight: bold}
|
|||||||
// must be open after this one so it would be default one for all the
|
// must be open after this one so it would be default one for all the
|
||||||
// scripts)
|
// scripts)
|
||||||
if ($cfg['Server']['controluser'] != '') {
|
if ($cfg['Server']['controluser'] != '') {
|
||||||
$dbh = PMA_DBI_connect($cfg['Server']['controluser'], $cfg['Server']['controlpass']);
|
$dbh = PMA_DBI_connect($cfg['Server']['controluser'], $cfg['Server']['controlpass'], TRUE);
|
||||||
|
} else {
|
||||||
|
$dbh = PMA_DBI_connect($cfg['Server']['user'], $cfg['Server']['password'], TRUE);
|
||||||
} // end if ... else
|
} // end if ... else
|
||||||
|
|
||||||
// Pass #1 of DB-Config to read in master level DB-Config will go here
|
// Pass #1 of DB-Config to read in master level DB-Config will go here
|
||||||
// Robbat2 - May 11, 2002
|
// Robbat2 - May 11, 2002
|
||||||
|
|
||||||
// Connects to the server (validates user's login)
|
// Connects to the server (validates user's login)
|
||||||
$userlink = PMA_DBI_connect($cfg['Server']['user'], $cfg['Server']['password']);
|
$userlink = PMA_DBI_connect($cfg['Server']['user'], $cfg['Server']['password'], FALSE);
|
||||||
|
|
||||||
if (empty($dbh)) {
|
|
||||||
$dbh = $userlink;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Pass #2 of DB-Config to read in user level DB-Config will go here
|
// Pass #2 of DB-Config to read in user level DB-Config will go here
|
||||||
// Robbat2 - May 11, 2002
|
// Robbat2 - May 11, 2002
|
||||||
|
@@ -124,7 +124,7 @@ function PMA_DBI_get_variable($var, $type = PMA_DBI_GETVAR_SESSION, $link = NULL
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function PMA_DBI_postConnect($link) {
|
function PMA_DBI_postConnect($link, $is_controluser = FALSE) {
|
||||||
global $collation_connection, $charset_connection;
|
global $collation_connection, $charset_connection;
|
||||||
if (!defined('PMA_MYSQL_INT_VERSION')) {
|
if (!defined('PMA_MYSQL_INT_VERSION')) {
|
||||||
$result = PMA_DBI_query('SELECT VERSION() AS version', $link, PMA_DBI_QUERY_STORE);
|
$result = PMA_DBI_query('SELECT VERSION() AS version', $link, PMA_DBI_QUERY_STORE);
|
||||||
@@ -169,7 +169,7 @@ function PMA_DBI_postConnect($link) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$mysql_charset = $GLOBALS['mysql_charset_map'][$GLOBALS['charset']];
|
$mysql_charset = $GLOBALS['mysql_charset_map'][$GLOBALS['charset']];
|
||||||
if (empty($collation_connection) || (strpos($collation_connection, '_') ? substr($collation_connection, 0, strpos($collation_connection, '_')) : $collation_connection) == $mysql_charset) {
|
if ($is_controluser || empty($collation_connection) || (strpos($collation_connection, '_') ? substr($collation_connection, 0, strpos($collation_connection, '_')) : $collation_connection) == $mysql_charset) {
|
||||||
PMA_DBI_query('SET NAMES ' . $mysql_charset . ';', $link, PMA_DBI_QUERY_STORE);
|
PMA_DBI_query('SET NAMES ' . $mysql_charset . ';', $link, PMA_DBI_QUERY_STORE);
|
||||||
} else {
|
} else {
|
||||||
PMA_DBI_query('SET CHARACTER SET ' . $mysql_charset . ';', $link, PMA_DBI_QUERY_STORE);
|
PMA_DBI_query('SET CHARACTER SET ' . $mysql_charset . ';', $link, PMA_DBI_QUERY_STORE);
|
||||||
@@ -177,8 +177,10 @@ function PMA_DBI_postConnect($link) {
|
|||||||
if (!empty($collation_connection)) {
|
if (!empty($collation_connection)) {
|
||||||
PMA_DBI_query('SET collation_connection = \'' . $collation_connection . '\';', $link, PMA_DBI_QUERY_STORE);
|
PMA_DBI_query('SET collation_connection = \'' . $collation_connection . '\';', $link, PMA_DBI_QUERY_STORE);
|
||||||
}
|
}
|
||||||
|
if (!$is_controluser) {
|
||||||
$collation_connection = PMA_DBI_get_variable('collation_connection', PMA_DBI_GETVAR_SESSION, $link);
|
$collation_connection = PMA_DBI_get_variable('collation_connection', PMA_DBI_GETVAR_SESSION, $link);
|
||||||
$charset_connection = PMA_DBI_get_variable('character_set_connection', PMA_DBI_GETVAR_SESSION, $link);
|
$charset_connection = PMA_DBI_get_variable('character_set_connection', PMA_DBI_GETVAR_SESSION, $link);
|
||||||
|
}
|
||||||
|
|
||||||
// Add some field types to the list
|
// Add some field types to the list
|
||||||
// (we pass twice here; feel free to code something better :)
|
// (we pass twice here; feel free to code something better :)
|
||||||
|
@@ -32,7 +32,7 @@ if (!defined('PMA_MYSQL_CLIENT_API')) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function PMA_DBI_connect($user, $password) {
|
function PMA_DBI_connect($user, $password, $is_controluser = FALSE) {
|
||||||
global $cfg, $php_errormsg;
|
global $cfg, $php_errormsg;
|
||||||
|
|
||||||
$server_port = (empty($cfg['Server']['port']))
|
$server_port = (empty($cfg['Server']['port']))
|
||||||
@@ -70,7 +70,7 @@ function PMA_DBI_connect($user, $password) {
|
|||||||
PMA_auth_fails();
|
PMA_auth_fails();
|
||||||
} // end if
|
} // end if
|
||||||
|
|
||||||
PMA_DBI_postConnect($link);
|
PMA_DBI_postConnect($link, $is_controluser);
|
||||||
|
|
||||||
return $link;
|
return $link;
|
||||||
}
|
}
|
||||||
|
@@ -46,7 +46,7 @@ define('NUM_FLAG', 32768);
|
|||||||
define('PART_KEY_FLAG', 16384);
|
define('PART_KEY_FLAG', 16384);
|
||||||
define('UNIQUE_FLAG', 65536);
|
define('UNIQUE_FLAG', 65536);
|
||||||
|
|
||||||
function PMA_DBI_connect($user, $password) {
|
function PMA_DBI_connect($user, $password, $is_controluser = FALSE) {
|
||||||
global $cfg, $php_errormsg;
|
global $cfg, $php_errormsg;
|
||||||
|
|
||||||
$server_port = (empty($cfg['Server']['port']))
|
$server_port = (empty($cfg['Server']['port']))
|
||||||
@@ -74,7 +74,7 @@ function PMA_DBI_connect($user, $password) {
|
|||||||
PMA_auth_fails();
|
PMA_auth_fails();
|
||||||
} // end if
|
} // end if
|
||||||
|
|
||||||
PMA_DBI_postConnect($link);
|
PMA_DBI_postConnect($link, $is_controluser);
|
||||||
|
|
||||||
return $link;
|
return $link;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user