Remove usage of $GLOBALS['controllink']
This is now stored internally inside DatabaseInterface instance. Signed-off-by: Michal Čihař <michal@cihar.com>
This commit is contained in:
parent
deed987f15
commit
4fe87fb592
@ -105,13 +105,9 @@ class Bookmark
|
||||
* @return boolean whether the INSERT succeeds or not
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @global resource $controllink the controluser db connection handle
|
||||
*/
|
||||
public function save()
|
||||
{
|
||||
global $controllink;
|
||||
|
||||
$cfgBookmark = self::getParams();
|
||||
if (empty($cfgBookmark)) {
|
||||
return false;
|
||||
@ -124,7 +120,7 @@ class Bookmark
|
||||
. "'" . $GLOBALS['dbi']->escapeString($this->_user) . "', "
|
||||
. "'" . $GLOBALS['dbi']->escapeString($this->_query) . "', "
|
||||
. "'" . $GLOBALS['dbi']->escapeString($this->_label) . "')";
|
||||
return $GLOBALS['dbi']->query($query, $controllink);
|
||||
return $GLOBALS['dbi']->query($query, DatabaseInterface::CONNECT_CONTROL);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -133,13 +129,9 @@ class Bookmark
|
||||
* @return bool true if successful
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @global resource $controllink the controluser db connection handle
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
global $controllink;
|
||||
|
||||
$cfgBookmark = self::getParams();
|
||||
if (empty($cfgBookmark)) {
|
||||
return false;
|
||||
@ -148,7 +140,7 @@ class Bookmark
|
||||
$query = "DELETE FROM " . Util::backquote($cfgBookmark['db'])
|
||||
. "." . Util::backquote($cfgBookmark['table'])
|
||||
. " WHERE id = " . $this->_id;
|
||||
return $GLOBALS['dbi']->tryQuery($query, $controllink);
|
||||
return $GLOBALS['dbi']->tryQuery($query, DatabaseInterface::CONNECT_CONTROL);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -259,13 +251,9 @@ class Bookmark
|
||||
* @return Bookmark[] the bookmarks list
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @global resource $controllink the controluser db connection handle
|
||||
*/
|
||||
public static function getList($db = false)
|
||||
{
|
||||
global $controllink;
|
||||
|
||||
$cfgBookmark = self::getParams();
|
||||
if (empty($cfgBookmark)) {
|
||||
return array();
|
||||
@ -284,7 +272,7 @@ class Bookmark
|
||||
$query,
|
||||
null,
|
||||
null,
|
||||
$controllink,
|
||||
DatabaseInterface::CONNECT_CONTROL,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
|
||||
@ -320,14 +308,10 @@ class Bookmark
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @global resource $controllink the controluser db connection handle
|
||||
*
|
||||
*/
|
||||
public static function get($db, $id, $id_field = 'id',
|
||||
$action_bookmark_all = false, $exact_user_match = false
|
||||
) {
|
||||
global $controllink;
|
||||
|
||||
$cfgBookmark = self::getParams();
|
||||
if (empty($cfgBookmark)) {
|
||||
return null;
|
||||
@ -347,7 +331,7 @@ class Bookmark
|
||||
$query .= " AND " . Util::backquote($id_field)
|
||||
. " = " . $GLOBALS['dbi']->escapeString($id) . " LIMIT 1";
|
||||
|
||||
$result = $GLOBALS['dbi']->fetchSingleRow($query, 'ASSOC', $controllink);
|
||||
$result = $GLOBALS['dbi']->fetchSingleRow($query, 'ASSOC', DatabaseInterface::CONNECT_CONTROL);
|
||||
if (! empty($result)) {
|
||||
$bookmark = new Bookmark();
|
||||
$bookmark->_id = $result['id'];
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
namespace PhpMyAdmin;
|
||||
|
||||
use PhpMyAdmin\Charsets;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Template;
|
||||
@ -68,7 +69,7 @@ class CentralColumns
|
||||
return array();
|
||||
}
|
||||
$pmadb = $cfgCentralColumns['db'];
|
||||
$GLOBALS['dbi']->selectDb($pmadb, $GLOBALS['controllink']);
|
||||
$GLOBALS['dbi']->selectDb($pmadb, DatabaseInterface::CONNECT_CONTROL);
|
||||
$central_list_table = $cfgCentralColumns['table'];
|
||||
//get current values of $db from central column list
|
||||
if ($num == 0) {
|
||||
@ -80,7 +81,7 @@ class CentralColumns
|
||||
. 'LIMIT ' . $from . ', ' . $num . ';';
|
||||
}
|
||||
$has_list = (array) $GLOBALS['dbi']->fetchResult(
|
||||
$query, null, null, $GLOBALS['controllink']
|
||||
$query, null, null, DatabaseInterface::CONNECT_CONTROL
|
||||
);
|
||||
self::handleColumnExtra($has_list);
|
||||
return $has_list;
|
||||
@ -100,13 +101,13 @@ class CentralColumns
|
||||
return 0;
|
||||
}
|
||||
$pmadb = $cfgCentralColumns['db'];
|
||||
$GLOBALS['dbi']->selectDb($pmadb, $GLOBALS['controllink']);
|
||||
$GLOBALS['dbi']->selectDb($pmadb, DatabaseInterface::CONNECT_CONTROL);
|
||||
$central_list_table = $cfgCentralColumns['table'];
|
||||
$query = 'SELECT count(db_name) FROM ' .
|
||||
Util::backquote($central_list_table) . ' '
|
||||
. 'WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\';';
|
||||
$res = $GLOBALS['dbi']->fetchResult(
|
||||
$query, null, null, $GLOBALS['controllink']
|
||||
$query, null, null, DatabaseInterface::CONNECT_CONTROL
|
||||
);
|
||||
if (isset($res[0])) {
|
||||
return $res[0];
|
||||
@ -131,13 +132,13 @@ class CentralColumns
|
||||
return array();
|
||||
}
|
||||
$pmadb = $cfgCentralColumns['db'];
|
||||
$GLOBALS['dbi']->selectDb($pmadb, $GLOBALS['controllink']);
|
||||
$GLOBALS['dbi']->selectDb($pmadb, DatabaseInterface::CONNECT_CONTROL);
|
||||
$central_list_table = $cfgCentralColumns['table'];
|
||||
if ($allFields) {
|
||||
$query = 'SELECT * FROM ' . Util::backquote($central_list_table) . ' '
|
||||
. 'WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\' AND col_name IN (' . $cols . ');';
|
||||
$has_list = (array) $GLOBALS['dbi']->fetchResult(
|
||||
$query, null, null, $GLOBALS['controllink']
|
||||
$query, null, null, DatabaseInterface::CONNECT_CONTROL
|
||||
);
|
||||
self::handleColumnExtra($has_list);
|
||||
} else {
|
||||
@ -145,7 +146,7 @@ class CentralColumns
|
||||
. Util::backquote($central_list_table) . ' '
|
||||
. 'WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\' AND col_name IN (' . $cols . ');';
|
||||
$has_list = (array) $GLOBALS['dbi']->fetchResult(
|
||||
$query, null, null, $GLOBALS['controllink']
|
||||
$query, null, null, DatabaseInterface::CONNECT_CONTROL
|
||||
);
|
||||
}
|
||||
|
||||
@ -301,14 +302,14 @@ class CentralColumns
|
||||
)
|
||||
);
|
||||
}
|
||||
$GLOBALS['dbi']->selectDb($pmadb, $GLOBALS['controllink']);
|
||||
$GLOBALS['dbi']->selectDb($pmadb, DatabaseInterface::CONNECT_CONTROL);
|
||||
if (! empty($insQuery)) {
|
||||
foreach ($insQuery as $query) {
|
||||
if (!$GLOBALS['dbi']->tryQuery($query, $GLOBALS['controllink'])) {
|
||||
if (!$GLOBALS['dbi']->tryQuery($query, DatabaseInterface::CONNECT_CONTROL)) {
|
||||
$message = Message::error(__('Could not add columns!'));
|
||||
$message->addMessage(
|
||||
Message::rawError(
|
||||
$GLOBALS['dbi']->getError($GLOBALS['controllink'])
|
||||
$GLOBALS['dbi']->getError(DatabaseInterface::CONNECT_CONTROL)
|
||||
)
|
||||
);
|
||||
break;
|
||||
@ -386,17 +387,17 @@ class CentralColumns
|
||||
)
|
||||
);
|
||||
}
|
||||
$GLOBALS['dbi']->selectDb($pmadb, $GLOBALS['controllink']);
|
||||
$GLOBALS['dbi']->selectDb($pmadb, DatabaseInterface::CONNECT_CONTROL);
|
||||
|
||||
$query = 'DELETE FROM ' . Util::backquote($central_list_table) . ' '
|
||||
. 'WHERE db_name = \'' . $GLOBALS['dbi']->escapeString($db) . '\' AND col_name IN (' . $cols . ');';
|
||||
|
||||
if (!$GLOBALS['dbi']->tryQuery($query, $GLOBALS['controllink'])) {
|
||||
if (!$GLOBALS['dbi']->tryQuery($query, DatabaseInterface::CONNECT_CONTROL)) {
|
||||
$message = Message::error(__('Could not remove columns!'));
|
||||
$message->addHtml('<br />' . htmlspecialchars($cols) . '<br />');
|
||||
$message->addMessage(
|
||||
Message::rawError(
|
||||
$GLOBALS['dbi']->getError($GLOBALS['controllink'])
|
||||
$GLOBALS['dbi']->getError(DatabaseInterface::CONNECT_CONTROL)
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -529,7 +530,7 @@ class CentralColumns
|
||||
return self::configErrorMessage();
|
||||
}
|
||||
$centralTable = $cfgCentralColumns['table'];
|
||||
$GLOBALS['dbi']->selectDb($cfgCentralColumns['db'], $GLOBALS['controllink']);
|
||||
$GLOBALS['dbi']->selectDb($cfgCentralColumns['db'], DatabaseInterface::CONNECT_CONTROL);
|
||||
if ($orig_col_name == "") {
|
||||
$def = array();
|
||||
$def['Type'] = $col_type;
|
||||
@ -556,9 +557,9 @@ class CentralColumns
|
||||
. 'AND col_name = \'' . $GLOBALS['dbi']->escapeString($orig_col_name)
|
||||
. '\'';
|
||||
}
|
||||
if (!$GLOBALS['dbi']->tryQuery($query, $GLOBALS['controllink'])) {
|
||||
if (!$GLOBALS['dbi']->tryQuery($query, DatabaseInterface::CONNECT_CONTROL)) {
|
||||
return Message::error(
|
||||
$GLOBALS['dbi']->getError($GLOBALS['controllink'])
|
||||
$GLOBALS['dbi']->getError(DatabaseInterface::CONNECT_CONTROL)
|
||||
);
|
||||
}
|
||||
return true;
|
||||
@ -1173,9 +1174,9 @@ class CentralColumns
|
||||
}
|
||||
$query .= ';';
|
||||
}
|
||||
$GLOBALS['dbi']->selectDb($cfgCentralColumns['db'], $GLOBALS['controllink']);
|
||||
$GLOBALS['dbi']->selectDb($cfgCentralColumns['db'], DatabaseInterface::CONNECT_CONTROL);
|
||||
$columns_list = (array)$GLOBALS['dbi']->fetchResult(
|
||||
$query, null, null, $GLOBALS['controllink']
|
||||
$query, null, null, DatabaseInterface::CONNECT_CONTROL
|
||||
);
|
||||
self::handleColumnExtra($columns_list);
|
||||
return json_encode($columns_list);
|
||||
|
||||
@ -11,6 +11,7 @@ namespace PhpMyAdmin\Controllers\Server;
|
||||
|
||||
use PhpMyAdmin\Controllers\Controller;
|
||||
use PhpMyAdmin\Charsets;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Server\Common;
|
||||
@ -114,7 +115,7 @@ class ServerDatabasesController extends Controller
|
||||
*/
|
||||
if ($GLOBALS['server'] > 0) {
|
||||
$this->_databases = $this->dbi->getDatabasesFull(
|
||||
null, $this->_dbstats, null, $this->_sort_by,
|
||||
null, $this->_dbstats, DatabaseInterface::CONNECT_USER, $this->_sort_by,
|
||||
$this->_sort_order, $this->_pos, true
|
||||
);
|
||||
$this->_database_count = count($GLOBALS['dblist']->databases);
|
||||
|
||||
@ -323,7 +323,7 @@ class Qbe
|
||||
} // end if
|
||||
$all_tables = $GLOBALS['dbi']->query(
|
||||
'SHOW TABLES FROM ' . Util::backquote($this->_db) . ';',
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
$all_tables_count = $GLOBALS['dbi']->numRows($all_tables);
|
||||
|
||||
@ -158,7 +158,7 @@ class DatabaseInterface
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function query($query, $link = null, $options = 0,
|
||||
public function query($query, $link = DatabaseInterface::CONNECT_USER, $options = 0,
|
||||
$cache_affected_rows = true
|
||||
) {
|
||||
$res = $this->tryQuery($query, $link, $options, $cache_affected_rows)
|
||||
@ -261,7 +261,7 @@ class DatabaseInterface
|
||||
* Stores query data into session data for debugging purposes
|
||||
*
|
||||
* @param string $query Query text
|
||||
* @param object $link database link
|
||||
* @param integer $link link type
|
||||
* @param object|boolean $result Query result
|
||||
* @param integer $time Time to execute query
|
||||
*
|
||||
@ -293,20 +293,20 @@ class DatabaseInterface
|
||||
* runs a query and returns the result
|
||||
*
|
||||
* @param string $query query to run
|
||||
* @param object $link mysql link resource
|
||||
* @param integer $link link type
|
||||
* @param integer $options query options
|
||||
* @param bool $cache_affected_rows whether to cache affected row
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function tryQuery($query, $link = null, $options = 0,
|
||||
public function tryQuery($query, $link = DatabaseInterface::CONNECT_USER, $options = 0,
|
||||
$cache_affected_rows = true
|
||||
) {
|
||||
$debug = $GLOBALS['cfg']['DBG']['sql'];
|
||||
$link = $this->getLink($link);
|
||||
if ($link === false) {
|
||||
if (! isset($this->_links[$link])) {
|
||||
return false;
|
||||
}
|
||||
$link = $this->_links[$link];
|
||||
|
||||
if ($debug) {
|
||||
$time = microtime(true);
|
||||
@ -357,12 +357,12 @@ class DatabaseInterface
|
||||
*
|
||||
* @return mysqli_result collection | boolean(false)
|
||||
*/
|
||||
public function tryMultiQuery($multi_query = '', $link = null)
|
||||
public function tryMultiQuery($multi_query = '', $link = DatabaseInterface::CONNECT_USER)
|
||||
{
|
||||
$link = $this->getLink($link);
|
||||
if ($link === false) {
|
||||
if (! isset($this->_links[$link])) {
|
||||
return false;
|
||||
}
|
||||
$link = $this->_links[$link];
|
||||
|
||||
return $this->_extension->realMultiQuery($link, $multi_query);
|
||||
}
|
||||
@ -375,7 +375,7 @@ class DatabaseInterface
|
||||
*
|
||||
* @return array tables names
|
||||
*/
|
||||
public function getTables($database, $link = null)
|
||||
public function getTables($database, $link = DatabaseInterface::CONNECT_USER)
|
||||
{
|
||||
$tables = $this->fetchResult(
|
||||
'SHOW TABLES FROM ' . Util::backquote($database) . ';',
|
||||
@ -497,7 +497,7 @@ class DatabaseInterface
|
||||
* @param string $database database
|
||||
* @param string|array $table table name(s)
|
||||
* @param boolean $tbl_is_group $table is a table group
|
||||
* @param mixed $link mysql link
|
||||
* @param integer $link link type
|
||||
* @param integer $limit_offset zero-based offset for the count
|
||||
* @param boolean|integer $limit_count number of tables to return
|
||||
* @param string $sort_by table attribute to sort by
|
||||
@ -509,7 +509,7 @@ class DatabaseInterface
|
||||
* @return array list of tables in given db(s)
|
||||
*/
|
||||
public function getTablesFull($database, $table = '',
|
||||
$tbl_is_group = false, $link = null, $limit_offset = 0,
|
||||
$tbl_is_group = false, $link = DatabaseInterface::CONNECT_USER, $limit_offset = 0,
|
||||
$limit_count = false, $sort_by = 'Name', $sort_order = 'ASC',
|
||||
$table_type = null
|
||||
) {
|
||||
@ -810,7 +810,7 @@ class DatabaseInterface
|
||||
*
|
||||
* @param string $database database
|
||||
* @param boolean $force_stats retrieve stats also for MySQL < 5
|
||||
* @param object $link mysql link
|
||||
* @param integer $link link type
|
||||
* @param string $sort_by column to order by
|
||||
* @param string $sort_order ASC or DESC
|
||||
* @param integer $limit_offset starting offset for LIMIT
|
||||
@ -822,7 +822,7 @@ class DatabaseInterface
|
||||
* @return array $databases
|
||||
*/
|
||||
public function getDatabasesFull($database = null, $force_stats = false,
|
||||
$link = null, $sort_by = 'SCHEMA_NAME', $sort_order = 'ASC',
|
||||
$link = DatabaseInterface::CONNECT_USER, $sort_by = 'SCHEMA_NAME', $sort_order = 'ASC',
|
||||
$limit_offset = 0, $limit_count = false
|
||||
) {
|
||||
$sort_order = strtoupper($sort_order);
|
||||
@ -1077,7 +1077,7 @@ class DatabaseInterface
|
||||
* @return array
|
||||
*/
|
||||
public function getColumnsFull($database = null, $table = null,
|
||||
$column = null, $link = null
|
||||
$column = null, $link = DatabaseInterface::CONNECT_USER
|
||||
) {
|
||||
if (! $GLOBALS['cfg']['Server']['DisableIS']) {
|
||||
$sql_wheres = array();
|
||||
@ -1240,13 +1240,13 @@ class DatabaseInterface
|
||||
* @param string $table name of table to retrieve columns from
|
||||
* @param string $column name of column, null to show all columns
|
||||
* @param boolean $full whether to return full info or only column names
|
||||
* @param mixed $link mysql link resource
|
||||
* @param integer $link link type
|
||||
*
|
||||
* @return array array indexed by column names or,
|
||||
* if $column is given, flat array description
|
||||
*/
|
||||
public function getColumns($database, $table, $column = null, $full = false,
|
||||
$link = null
|
||||
$link = DatabaseInterface::CONNECT_USER
|
||||
) {
|
||||
$sql = $this->getColumnsSql($database, $table, $column, $full);
|
||||
$fields = $this->fetchResult($sql, 'Field', null, $link);
|
||||
@ -1289,7 +1289,7 @@ class DatabaseInterface
|
||||
*
|
||||
* @return null|array
|
||||
*/
|
||||
public function getColumnNames($database, $table, $link = null)
|
||||
public function getColumnNames($database, $table, $link = DatabaseInterface::CONNECT_USER)
|
||||
{
|
||||
$sql = $this->getColumnsSql($database, $table);
|
||||
// We only need the 'Field' column which contains the table's column names
|
||||
@ -1329,7 +1329,7 @@ class DatabaseInterface
|
||||
*
|
||||
* @return array $indexes
|
||||
*/
|
||||
public function getTableIndexes($database, $table, $link = null)
|
||||
public function getTableIndexes($database, $table, $link = DatabaseInterface::CONNECT_USER)
|
||||
{
|
||||
$sql = $this->getTableIndexesSql($database, $table);
|
||||
$indexes = $this->fetchResult($sql, null, null, $link);
|
||||
@ -1351,10 +1351,9 @@ class DatabaseInterface
|
||||
* @return mixed value for mysql server variable
|
||||
*/
|
||||
public function getVariable(
|
||||
$var, $type = self::GETVAR_SESSION, $link = null
|
||||
$var, $type = self::GETVAR_SESSION, $link = DatabaseInterface::CONNECT_USER
|
||||
) {
|
||||
$link = $this->getLink($link);
|
||||
if ($link === false) {
|
||||
if (! isset($this->_links[$link])) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1382,10 +1381,9 @@ class DatabaseInterface
|
||||
*
|
||||
* @return bool whether query was a successful
|
||||
*/
|
||||
public function setVariable($var, $value, $link = null)
|
||||
public function setVariable($var, $value, $link = DatabaseInterface::CONNECT_USER)
|
||||
{
|
||||
$link = $this->getLink($link);
|
||||
if ($link === false) {
|
||||
if (! isset($this->_links[$link])) {
|
||||
return false;
|
||||
}
|
||||
$current_value = $this->getVariable(
|
||||
@ -1395,7 +1393,7 @@ class DatabaseInterface
|
||||
return true;
|
||||
}
|
||||
|
||||
return $this->query("SET " . $var . " = " . $value . ';', $link);
|
||||
return $this->query("SET " . $var . " = " . $value . ';', $this->_links[$link]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1416,7 +1414,7 @@ class DatabaseInterface
|
||||
* been established. It sets the connection collation, and determines the
|
||||
* version of MySQL which is running.
|
||||
*
|
||||
* @param mixed $link mysql link resource|object
|
||||
* @param integer $link link type
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -1546,12 +1544,12 @@ class DatabaseInterface
|
||||
* starting at 0, with 0 being default
|
||||
* @param integer|string $field field to fetch the value from,
|
||||
* starting at 0, with 0 being default
|
||||
* @param object $link mysql link
|
||||
* @param integer $link link type
|
||||
*
|
||||
* @return mixed value of first field in first row from result
|
||||
* or false if not found
|
||||
*/
|
||||
public function fetchValue($query, $row_number = 0, $field = 0, $link = null)
|
||||
public function fetchValue($query, $row_number = 0, $field = 0, $link = DatabaseInterface::CONNECT_USER)
|
||||
{
|
||||
$value = false;
|
||||
|
||||
@ -1605,12 +1603,12 @@ class DatabaseInterface
|
||||
* @param string $query The query to execute
|
||||
* @param string $type NUM|ASSOC|BOTH returned array should either
|
||||
* numeric associative or both
|
||||
* @param object $link mysql link
|
||||
* @param integer $link link type
|
||||
*
|
||||
* @return array|boolean first row from result
|
||||
* or false if result is empty
|
||||
*/
|
||||
public function fetchSingleRow($query, $type = 'ASSOC', $link = null)
|
||||
public function fetchSingleRow($query, $type = 'ASSOC', $link = DatabaseInterface::CONNECT_USER)
|
||||
{
|
||||
$result = $this->tryQuery(
|
||||
$query,
|
||||
@ -1710,13 +1708,13 @@ class DatabaseInterface
|
||||
* or array of those
|
||||
* @param string|integer $value value-name or offset
|
||||
* used as value for array
|
||||
* @param object $link mysql link
|
||||
* @param integer $link link type
|
||||
* @param integer $options query options
|
||||
*
|
||||
* @return array resultrows or values indexed by $key
|
||||
*/
|
||||
public function fetchResult($query, $key = null, $value = null,
|
||||
$link = null, $options = 0
|
||||
$link = DatabaseInterface::CONNECT_USER, $options = 0
|
||||
) {
|
||||
$resultrows = array();
|
||||
|
||||
@ -1798,16 +1796,16 @@ class DatabaseInterface
|
||||
/**
|
||||
* returns warnings for last query
|
||||
*
|
||||
* @param object $link mysql link resource
|
||||
* @param integer $link link type
|
||||
*
|
||||
* @return array warnings
|
||||
*/
|
||||
public function getWarnings($link = null)
|
||||
public function getWarnings($link = DatabaseInterface::CONNECT_USER)
|
||||
{
|
||||
$link = $this->getLink($link);
|
||||
if ($link === false) {
|
||||
if (! isset($this->_links[$link])) {
|
||||
return false;
|
||||
}
|
||||
$link = $this->_links[$link];
|
||||
|
||||
return $this->fetchResult('SHOW WARNINGS', null, null, $link);
|
||||
}
|
||||
@ -1817,11 +1815,11 @@ class DatabaseInterface
|
||||
*
|
||||
* @param string $db db name
|
||||
* @param string $which PROCEDURE | FUNCTION
|
||||
* @param object $link mysql link
|
||||
* @param integer $link link type
|
||||
*
|
||||
* @return array the procedure names or function names
|
||||
*/
|
||||
public function getProceduresOrFunctions($db, $which, $link = null)
|
||||
public function getProceduresOrFunctions($db, $which, $link = DatabaseInterface::CONNECT_USER)
|
||||
{
|
||||
$shows = $this->fetchResult(
|
||||
'SHOW ' . $which . ' STATUS;', null, null, $link
|
||||
@ -1845,7 +1843,7 @@ class DatabaseInterface
|
||||
*
|
||||
* @return string the definition
|
||||
*/
|
||||
public function getDefinition($db, $which, $name, $link = null)
|
||||
public function getDefinition($db, $which, $name, $link = DatabaseInterface::CONNECT_USER)
|
||||
{
|
||||
$returned_field = array(
|
||||
'PROCEDURE' => 'Create Procedure',
|
||||
@ -2229,7 +2227,7 @@ class DatabaseInterface
|
||||
$is = false;
|
||||
$result = $this->tryQuery(
|
||||
$query,
|
||||
null,
|
||||
self::CONNECT_USER,
|
||||
self::QUERY_STORE
|
||||
);
|
||||
if ($result) {
|
||||
@ -2244,7 +2242,7 @@ class DatabaseInterface
|
||||
"SHOW GRANTS FOR CURRENT_USER();",
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
self::CONNECT_USER,
|
||||
self::QUERY_STORE
|
||||
);
|
||||
if ($grants) {
|
||||
@ -2462,7 +2460,7 @@ class DatabaseInterface
|
||||
$this->_links[$target] = $result;
|
||||
/* Run post connect for user connections */
|
||||
if ($target == DatabaseInterface::CONNECT_USER) {
|
||||
$this->postConnect($result);
|
||||
$this->postConnect(DatabaseInterface::CONNECT_USER);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
@ -2489,16 +2487,16 @@ class DatabaseInterface
|
||||
* selects given database
|
||||
*
|
||||
* @param string $dbname database name to select
|
||||
* @param object $link connection object
|
||||
* @param integer $link link type
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function selectDb($dbname, $link = null)
|
||||
public function selectDb($dbname, $link = DatabaseInterface::CONNECT_USER)
|
||||
{
|
||||
$link = $this->getLink($link);
|
||||
if ($link === false) {
|
||||
if (! isset($this->_links[$link])) {
|
||||
return false;
|
||||
}
|
||||
$link = $this->_links[$link];
|
||||
return $this->_extension->selectDb($dbname, $link);
|
||||
}
|
||||
|
||||
@ -2566,80 +2564,80 @@ class DatabaseInterface
|
||||
/**
|
||||
* Check if there are any more query results from a multi query
|
||||
*
|
||||
* @param object $link the connection object
|
||||
* @param integer $link link type
|
||||
*
|
||||
* @return bool true or false
|
||||
*/
|
||||
public function moreResults($link = null)
|
||||
public function moreResults($link = DatabaseInterface::CONNECT_USER)
|
||||
{
|
||||
$link = $this->getLink($link);
|
||||
if ($link === false) {
|
||||
if (! isset($this->_links[$link])) {
|
||||
return false;
|
||||
}
|
||||
$link = $this->_links[$link];
|
||||
return $this->_extension->moreResults($link);
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare next result from multi_query
|
||||
*
|
||||
* @param object $link the connection object
|
||||
* @param integer $link link type
|
||||
*
|
||||
* @return bool true or false
|
||||
*/
|
||||
public function nextResult($link = null)
|
||||
public function nextResult($link = DatabaseInterface::CONNECT_USER)
|
||||
{
|
||||
$link = $this->getLink($link);
|
||||
if ($link === false) {
|
||||
if (! isset($this->_links[$link])) {
|
||||
return false;
|
||||
}
|
||||
$link = $this->_links[$link];
|
||||
return $this->_extension->nextResult($link);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store the result returned from multi query
|
||||
*
|
||||
* @param object $link the connection object
|
||||
* @param integer $link link type
|
||||
*
|
||||
* @return mixed false when empty results / result set when not empty
|
||||
*/
|
||||
public function storeResult($link = null)
|
||||
public function storeResult($link = DatabaseInterface::CONNECT_USER)
|
||||
{
|
||||
$link = $this->getLink($link);
|
||||
if ($link === false) {
|
||||
if (! isset($this->_links[$link])) {
|
||||
return false;
|
||||
}
|
||||
$link = $this->_links[$link];
|
||||
return $this->_extension->storeResult($link);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representing the type of connection used
|
||||
*
|
||||
* @param object $link mysql link
|
||||
* @param integer $link link type
|
||||
*
|
||||
* @return string type of connection used
|
||||
*/
|
||||
public function getHostInfo($link = null)
|
||||
public function getHostInfo($link = DatabaseInterface::CONNECT_USER)
|
||||
{
|
||||
$link = $this->getLink($link);
|
||||
if ($link === false) {
|
||||
if (! isset($this->_links[$link])) {
|
||||
return false;
|
||||
}
|
||||
$link = $this->_links[$link];
|
||||
return $this->_extension->getHostInfo($link);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the version of the MySQL protocol used
|
||||
*
|
||||
* @param object $link mysql link
|
||||
* @param integer $link link type
|
||||
*
|
||||
* @return integer version of the MySQL protocol used
|
||||
*/
|
||||
public function getProtoInfo($link = null)
|
||||
public function getProtoInfo($link = DatabaseInterface::CONNECT_USER)
|
||||
{
|
||||
$link = $this->getLink($link);
|
||||
if ($link === false) {
|
||||
if (! isset($this->_links[$link])) {
|
||||
return false;
|
||||
}
|
||||
$link = $this->_links[$link];
|
||||
return $this->_extension->getProtoInfo($link);
|
||||
}
|
||||
|
||||
@ -2656,13 +2654,16 @@ class DatabaseInterface
|
||||
/**
|
||||
* returns last error message or false if no errors occurred
|
||||
*
|
||||
* @param object $link connection link
|
||||
* @param integer $link link type
|
||||
*
|
||||
* @return string|bool $error or false
|
||||
*/
|
||||
public function getError($link = null)
|
||||
public function getError($link = DatabaseInterface::CONNECT_USER)
|
||||
{
|
||||
$link = $this->getLink($link);
|
||||
if (! isset($this->_links[$link])) {
|
||||
return false;
|
||||
}
|
||||
$link = $this->_links[$link];
|
||||
return $this->_extension->getError($link);
|
||||
}
|
||||
|
||||
@ -2682,16 +2683,16 @@ class DatabaseInterface
|
||||
* returns last inserted auto_increment id for given $link
|
||||
* or $GLOBALS['userlink']
|
||||
*
|
||||
* @param object $link the connection object
|
||||
* @param integer $link link type
|
||||
*
|
||||
* @return int|boolean
|
||||
*/
|
||||
public function insertId($link = null)
|
||||
public function insertId($link = DatabaseInterface::CONNECT_USER)
|
||||
{
|
||||
$link = $this->getLink($link);
|
||||
if ($link === false) {
|
||||
if (! isset($this->_links[$link])) {
|
||||
return false;
|
||||
}
|
||||
$link = $this->_links[$link];
|
||||
// If the primary key is BIGINT we get an incorrect result
|
||||
// (sometimes negative, sometimes positive)
|
||||
// and in the present function we don't know if the PK is BIGINT
|
||||
@ -2706,17 +2707,17 @@ class DatabaseInterface
|
||||
/**
|
||||
* returns the number of rows affected by last query
|
||||
*
|
||||
* @param object $link the connection object
|
||||
* @param integer $link link type
|
||||
* @param bool $get_from_cache whether to retrieve from cache
|
||||
*
|
||||
* @return int|boolean
|
||||
*/
|
||||
public function affectedRows($link = null, $get_from_cache = true)
|
||||
public function affectedRows($link = DatabaseInterface::CONNECT_USER, $get_from_cache = true)
|
||||
{
|
||||
$link = $this->getLink($link);
|
||||
if ($link === false) {
|
||||
if (! isset($this->_links[$link])) {
|
||||
return false;
|
||||
}
|
||||
$link = $this->_links[$link];
|
||||
|
||||
if ($get_from_cache) {
|
||||
return $GLOBALS['cached_affected_rows'];
|
||||
@ -2814,11 +2815,9 @@ class DatabaseInterface
|
||||
*
|
||||
* @return string a MySQL escaped string
|
||||
*/
|
||||
public function escapeString($str, $link = null)
|
||||
public function escapeString($str, $link = DatabaseInterface::CONNECT_USER)
|
||||
{
|
||||
if ($link === null) {
|
||||
$link = $this->getLink();
|
||||
}
|
||||
$link = $this->_links[$link];
|
||||
|
||||
if ($this->_extension === null) {
|
||||
return $str;
|
||||
@ -2827,26 +2826,6 @@ class DatabaseInterface
|
||||
return $this->_extension->escapeString($link, $str);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets correct link object.
|
||||
*
|
||||
* @param object $link optional database link to use
|
||||
*
|
||||
* @return object|boolean
|
||||
*/
|
||||
public function getLink($link = null)
|
||||
{
|
||||
if (! is_null($link) && $link !== false) {
|
||||
return $link;
|
||||
}
|
||||
|
||||
if (isset($this->_links[DatabaseInterface::CONNECT_USER])) {
|
||||
return $this->_links[DatabaseInterface::CONNECT_USER];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if this database server is running on Amazon RDS.
|
||||
*
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
namespace PhpMyAdmin\Display;
|
||||
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Encoding;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Plugins;
|
||||
@ -274,7 +275,7 @@ class Export
|
||||
return $ret;
|
||||
}
|
||||
|
||||
while ($row = $GLOBALS['dbi']->fetchAssoc($result, $GLOBALS['controllink'])) {
|
||||
while ($row = $GLOBALS['dbi']->fetchAssoc($result, DatabaseInterface::CONNECT_CONTROL)) {
|
||||
$ret .= '<option value="' . htmlspecialchars($row['id']) . '"';
|
||||
if (!empty($_GET['template_id']) && $_GET['template_id'] == $row['id']) {
|
||||
$ret .= ' selected="selected"';
|
||||
@ -1110,7 +1111,7 @@ class Export
|
||||
|
||||
$response = Response::getInstance();
|
||||
if (! $result) {
|
||||
$error = $GLOBALS['dbi']->getError($GLOBALS['controllink']);
|
||||
$error = $GLOBALS['dbi']->getError(DatabaseInterface::CONNECT_CONTROL);
|
||||
$response->setRequestStatus(false);
|
||||
$response->addJSON('message', $error);
|
||||
exit;
|
||||
@ -1125,7 +1126,7 @@ class Export
|
||||
} elseif ('load' == $_REQUEST['templateAction']) {
|
||||
$data = null;
|
||||
while ($row = $GLOBALS['dbi']->fetchAssoc(
|
||||
$result, $GLOBALS['controllink']
|
||||
$result, DatabaseInterface::CONNECT_CONTROL
|
||||
)) {
|
||||
$data = $row['template_data'];
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
*/
|
||||
namespace PhpMyAdmin\Navigation\Nodes;
|
||||
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
@ -823,7 +824,7 @@ class Node
|
||||
$sqlQuery,
|
||||
'db_name',
|
||||
'count',
|
||||
$GLOBALS['controllink']
|
||||
DatabaseInterface::CONNECT_CONTROL
|
||||
);
|
||||
|
||||
return $counts;
|
||||
|
||||
@ -2198,7 +2198,7 @@ class ExportSql extends ExportPlugin
|
||||
|
||||
$result = $GLOBALS['dbi']->tryQuery(
|
||||
$sql_query,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_UNBUFFERED
|
||||
);
|
||||
// a possible error: the table has crashed
|
||||
|
||||
@ -90,10 +90,10 @@ class PmdCommon
|
||||
$GLOBALS['dbi']->getColumnsSql(
|
||||
$GLOBALS['db'],
|
||||
$GLOBALS['PMD_URL']["TABLE_NAME_SMALL"][$i],
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
true
|
||||
),
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
$tbl_name_i = $GLOBALS['PMD']['TABLE_NAME'][$i];
|
||||
@ -269,7 +269,7 @@ class PmdCommon
|
||||
$query,
|
||||
'name',
|
||||
null,
|
||||
$GLOBALS['controllink'],
|
||||
DatabaseInterface::CONNECT_CONTROL,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
return $tab_pos;
|
||||
@ -297,7 +297,7 @@ class PmdCommon
|
||||
$query,
|
||||
null,
|
||||
null,
|
||||
$GLOBALS['controllink'],
|
||||
DatabaseInterface::CONNECT_CONTROL,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
return count($page_name) ? $page_name[0] : null;
|
||||
@ -361,7 +361,7 @@ class PmdCommon
|
||||
$query,
|
||||
null,
|
||||
null,
|
||||
$GLOBALS['controllink'],
|
||||
DatabaseInterface::CONNECT_CONTROL,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
|
||||
@ -401,7 +401,7 @@ class PmdCommon
|
||||
$query,
|
||||
null,
|
||||
null,
|
||||
$GLOBALS['controllink'],
|
||||
DatabaseInterface::CONNECT_CONTROL,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
if (count($min_page_no[0])) {
|
||||
@ -634,7 +634,7 @@ class PmdCommon
|
||||
return array(true, __('Internal relationship has been added.'));
|
||||
}
|
||||
|
||||
$error = $GLOBALS['dbi']->getError($GLOBALS['controllink']);
|
||||
$error = $GLOBALS['dbi']->getError(DatabaseInterface::CONNECT_CONTROL);
|
||||
return array(
|
||||
false,
|
||||
__('Error: Internal relationship could not be added!')
|
||||
@ -705,7 +705,7 @@ class PmdCommon
|
||||
);
|
||||
|
||||
if (!$result) {
|
||||
$error = $GLOBALS['dbi']->getError($GLOBALS['controllink']);
|
||||
$error = $GLOBALS['dbi']->getError(DatabaseInterface::CONNECT_CONTROL);
|
||||
return array(
|
||||
false,
|
||||
__('Error: Internal relationship could not be removed!') . "<br/>" . $error
|
||||
@ -742,7 +742,7 @@ class PmdCommon
|
||||
. $GLOBALS['dbi']->escapeString($cfgDesigner['user']) . "';";
|
||||
|
||||
$orig_data = $GLOBALS['dbi']->fetchSingleRow(
|
||||
$orig_data_query, 'ASSOC', $GLOBALS['controllink']
|
||||
$orig_data_query, 'ASSOC', DatabaseInterface::CONNECT_CONTROL
|
||||
);
|
||||
|
||||
if (! empty($orig_data)) {
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
*/
|
||||
namespace PhpMyAdmin;
|
||||
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Url;
|
||||
@ -129,7 +130,7 @@ class RecentFavoriteTable
|
||||
json_encode($this->_tables)
|
||||
) . "')";
|
||||
|
||||
$success = $GLOBALS['dbi']->tryQuery($sql_query, $GLOBALS['controllink']);
|
||||
$success = $GLOBALS['dbi']->tryQuery($sql_query, DatabaseInterface::CONNECT_CONTROL);
|
||||
|
||||
if (! $success) {
|
||||
$error_msg = '';
|
||||
@ -145,7 +146,7 @@ class RecentFavoriteTable
|
||||
$message = Message::error($error_msg);
|
||||
$message->addMessage(
|
||||
Message::rawError(
|
||||
$GLOBALS['dbi']->getError($GLOBALS['controllink'])
|
||||
$GLOBALS['dbi']->getError(DatabaseInterface::CONNECT_CONTROL)
|
||||
),
|
||||
'<br /><br />'
|
||||
);
|
||||
|
||||
@ -48,14 +48,14 @@ class Relation
|
||||
if ($show_error) {
|
||||
$result = $GLOBALS['dbi']->query(
|
||||
$sql,
|
||||
$GLOBALS['controllink'],
|
||||
DatabaseInterface::CONNECT_CONTROL,
|
||||
$options,
|
||||
$cache_affected_rows
|
||||
);
|
||||
} else {
|
||||
$result = @$GLOBALS['dbi']->tryQuery(
|
||||
$sql,
|
||||
$GLOBALS['controllink'],
|
||||
DatabaseInterface::CONNECT_CONTROL,
|
||||
$options,
|
||||
$cache_affected_rows
|
||||
);
|
||||
@ -497,9 +497,8 @@ class Relation
|
||||
|
||||
if ($GLOBALS['server'] == 0
|
||||
|| empty($GLOBALS['cfg']['Server']['pmadb'])
|
||||
|| empty($GLOBALS['controllink'])
|
||||
|| ! $GLOBALS['dbi']->selectDb(
|
||||
$GLOBALS['cfg']['Server']['pmadb'], $GLOBALS['controllink']
|
||||
$GLOBALS['cfg']['Server']['pmadb'], DatabaseInterface::CONNECT_CONTROL
|
||||
)
|
||||
) {
|
||||
// No server selected -> no bookmark table
|
||||
@ -728,13 +727,13 @@ class Relation
|
||||
),
|
||||
$query
|
||||
);
|
||||
$GLOBALS['dbi']->tryMultiQuery($query, $GLOBALS['controllink']);
|
||||
$GLOBALS['dbi']->tryMultiQuery($query, DatabaseInterface::CONNECT_CONTROL);
|
||||
// skips result sets of query as we are not interested in it
|
||||
while ($GLOBALS['dbi']->moreResults($GLOBALS['controllink'])
|
||||
&& $GLOBALS['dbi']->nextResult($GLOBALS['controllink'])
|
||||
while ($GLOBALS['dbi']->moreResults(DatabaseInterface::CONNECT_CONTROL)
|
||||
&& $GLOBALS['dbi']->nextResult(DatabaseInterface::CONNECT_CONTROL)
|
||||
) {
|
||||
}
|
||||
$error = $GLOBALS['dbi']->getError($GLOBALS['controllink']);
|
||||
$error = $GLOBALS['dbi']->getError(DatabaseInterface::CONNECT_CONTROL);
|
||||
// return true if no error exists otherwise false
|
||||
return empty($error);
|
||||
}
|
||||
@ -778,7 +777,7 @@ class Relation
|
||||
. '\'' . $GLOBALS['dbi']->escapeString($column) . '\'';
|
||||
}
|
||||
$foreign = $GLOBALS['dbi']->fetchResult(
|
||||
$rel_query, 'master_field', null, $GLOBALS['controllink']
|
||||
$rel_query, 'master_field', null, DatabaseInterface::CONNECT_CONTROL
|
||||
);
|
||||
}
|
||||
|
||||
@ -854,7 +853,7 @@ class Relation
|
||||
. '\'';
|
||||
|
||||
$row = $GLOBALS['dbi']->fetchSingleRow(
|
||||
$disp_query, 'ASSOC', $GLOBALS['controllink']
|
||||
$disp_query, 'ASSOC', DatabaseInterface::CONNECT_CONTROL
|
||||
);
|
||||
if (isset($row['display_field'])) {
|
||||
return $row['display_field'];
|
||||
@ -1146,7 +1145,7 @@ class Relation
|
||||
ORDER BY `id` DESC';
|
||||
|
||||
return $GLOBALS['dbi']->fetchResult(
|
||||
$hist_query, null, null, $GLOBALS['controllink']
|
||||
$hist_query, null, null, DatabaseInterface::CONNECT_CONTROL
|
||||
);
|
||||
} // end of 'self::getHistory()' function
|
||||
|
||||
@ -1182,7 +1181,7 @@ class Relation
|
||||
LIMIT ' . $GLOBALS['cfg']['QueryHistoryMax'] . ', 1';
|
||||
|
||||
if ($max_time = $GLOBALS['dbi']->fetchValue(
|
||||
$search_query, 0, 0, $GLOBALS['controllink']
|
||||
$search_query, 0, 0, DatabaseInterface::CONNECT_CONTROL
|
||||
)) {
|
||||
self::queryAsControlUser(
|
||||
'DELETE FROM '
|
||||
@ -1713,9 +1712,7 @@ class Relation
|
||||
. $GLOBALS['dbi']->escapeString($newpage) . '\')';
|
||||
self::queryAsControlUser($ins_query, false);
|
||||
|
||||
return $GLOBALS['dbi']->insertId(
|
||||
isset($GLOBALS['controllink']) ? $GLOBALS['controllink'] : ''
|
||||
);
|
||||
return $GLOBALS['dbi']->insertId(DatabaseInterface::CONNECT_CONTROL);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1939,7 +1936,7 @@ class Relation
|
||||
'pma__export_templates' => 'export_templates',
|
||||
);
|
||||
|
||||
$existingTables = $GLOBALS['dbi']->getTables($db, $GLOBALS['controllink']);
|
||||
$existingTables = $GLOBALS['dbi']->getTables($db, DatabaseInterface::CONNECT_CONTROL);
|
||||
|
||||
$createQueries = null;
|
||||
$foundOne = false;
|
||||
|
||||
@ -537,7 +537,7 @@ class Privileges
|
||||
$sql_query = "SELECT `usergroup` FROM " . $userTable
|
||||
. " WHERE `username` = '" . $GLOBALS['dbi']->escapeString($username) . "'";
|
||||
$userGroup = $GLOBALS['dbi']->fetchValue(
|
||||
$sql_query, 0, 0, $GLOBALS['controllink']
|
||||
$sql_query, 0, 0, DatabaseInterface::CONNECT_CONTROL
|
||||
);
|
||||
}
|
||||
|
||||
@ -584,7 +584,7 @@ class Privileges
|
||||
$sql_query = "SELECT `usergroup` FROM " . $userTable
|
||||
. " WHERE `username` = '" . $GLOBALS['dbi']->escapeString($username) . "'";
|
||||
$oldUserGroup = $GLOBALS['dbi']->fetchValue(
|
||||
$sql_query, 0, 0, $GLOBALS['controllink']
|
||||
$sql_query, 0, 0, DatabaseInterface::CONNECT_CONTROL
|
||||
);
|
||||
|
||||
if ($oldUserGroup === false) {
|
||||
@ -2862,7 +2862,7 @@ class Privileges
|
||||
. '.' . Util::backquote($cfgRelation['usergroups']);
|
||||
$sql_query = 'SELECT COUNT(*) FROM ' . $user_group_table;
|
||||
$user_group_count = $GLOBALS['dbi']->fetchValue(
|
||||
$sql_query, 0, 0, $GLOBALS['controllink']
|
||||
$sql_query, 0, 0, DatabaseInterface::CONNECT_CONTROL
|
||||
);
|
||||
|
||||
return $user_group_count;
|
||||
@ -2892,7 +2892,7 @@ class Privileges
|
||||
. ' LIMIT 1';
|
||||
|
||||
$usergroup = $GLOBALS['dbi']->fetchValue(
|
||||
$sql_query, 0, 0, $GLOBALS['controllink']
|
||||
$sql_query, 0, 0, DatabaseInterface::CONNECT_CONTROL
|
||||
);
|
||||
|
||||
if ($usergroup === false) {
|
||||
@ -4864,7 +4864,7 @@ class Privileges
|
||||
$res = $GLOBALS['dbi']->query(
|
||||
'SELECT `Db`, `Table_name`, `Table_priv` FROM `mysql`.`tables_priv`'
|
||||
. $user_host_condition,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
while ($row = $GLOBALS['dbi']->fetchAssoc($res)) {
|
||||
|
||||
@ -1716,7 +1716,7 @@ class Table
|
||||
. "', '" . $GLOBALS['dbi']->escapeString($this->_name) . "', '"
|
||||
. $GLOBALS['dbi']->escapeString(json_encode($this->uiprefs)) . "')";
|
||||
|
||||
$success = $this->_dbi->tryQuery($sql_query, $GLOBALS['controllink']);
|
||||
$success = $this->_dbi->tryQuery($sql_query, DatabaseInterface::CONNECT_CONTROL);
|
||||
|
||||
if (!$success) {
|
||||
$message = Message::error(
|
||||
@ -1724,7 +1724,7 @@ class Table
|
||||
);
|
||||
$message->addMessage(
|
||||
Message::rawError(
|
||||
$this->_dbi->getError($GLOBALS['controllink'])
|
||||
$this->_dbi->getError(DatabaseInterface::CONNECT_CONTROL)
|
||||
),
|
||||
'<br /><br />'
|
||||
);
|
||||
@ -1743,7 +1743,7 @@ class Table
|
||||
' ORDER BY last_update ASC' .
|
||||
' LIMIT ' . $num_rows_to_delete;
|
||||
$success = $this->_dbi->tryQuery(
|
||||
$sql_query, $GLOBALS['controllink']
|
||||
$sql_query, DatabaseInterface::CONNECT_CONTROL
|
||||
);
|
||||
|
||||
if (!$success) {
|
||||
@ -1758,7 +1758,7 @@ class Table
|
||||
);
|
||||
$message->addMessage(
|
||||
Message::rawError(
|
||||
$this->_dbi->getError($GLOBALS['controllink'])
|
||||
$this->_dbi->getError(DatabaseInterface::CONNECT_CONTROL)
|
||||
),
|
||||
'<br /><br />'
|
||||
);
|
||||
@ -2147,7 +2147,7 @@ class Table
|
||||
if ($upd_query) {
|
||||
$this->_dbi->query(
|
||||
$upd_query,
|
||||
$GLOBALS['controllink'],
|
||||
DatabaseInterface::CONNECT_CONTROL,
|
||||
0,
|
||||
false
|
||||
);
|
||||
@ -2232,7 +2232,7 @@ class Table
|
||||
if (isset($upd_query)) {
|
||||
$this->_dbi->query(
|
||||
$upd_query,
|
||||
$GLOBALS['controllink'],
|
||||
DatabaseInterface::CONNECT_CONTROL,
|
||||
0,
|
||||
false
|
||||
);
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
*/
|
||||
namespace PhpMyAdmin;
|
||||
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Plugins;
|
||||
use PhpMyAdmin\Plugins\Export\ExportSql;
|
||||
use PhpMyAdmin\Relation;
|
||||
@ -148,7 +149,7 @@ class Tracker
|
||||
" AND table_name = '" . $GLOBALS['dbi']->escapeString($tablename) . "' " .
|
||||
" ORDER BY version DESC LIMIT 1";
|
||||
|
||||
$result = $GLOBALS['dbi']->fetchValue($sql_query, 0, 0, $GLOBALS['controllink']) == 1;
|
||||
$result = $GLOBALS['dbi']->fetchValue($sql_query, 0, 0, DatabaseInterface::CONNECT_CONTROL) == 1;
|
||||
|
||||
self::$_tracking_cache[$dbname][$tablename] = $result;
|
||||
|
||||
|
||||
@ -279,7 +279,7 @@ class Transformations
|
||||
OR `input_transformation` != \'\'
|
||||
OR `input_transformation_options` != \'\'' : '') . ')';
|
||||
$result = $GLOBALS['dbi']->fetchResult(
|
||||
$com_qry, 'column_name', null, $GLOBALS['controllink']
|
||||
$com_qry, 'column_name', null, DatabaseInterface::CONNECT_CONTROL
|
||||
);
|
||||
|
||||
foreach ($result as $column => $values) {
|
||||
|
||||
@ -77,7 +77,7 @@ class UserPreferences
|
||||
. ' WHERE `username` = \''
|
||||
. $GLOBALS['dbi']->escapeString($cfgRelation['user'])
|
||||
. '\'';
|
||||
$row = $GLOBALS['dbi']->fetchSingleRow($query, 'ASSOC', $GLOBALS['controllink']);
|
||||
$row = $GLOBALS['dbi']->fetchSingleRow($query, 'ASSOC', DatabaseInterface::CONNECT_CONTROL);
|
||||
|
||||
return array(
|
||||
'config_data' => $row ? (array)json_decode($row['config_data']) : array(),
|
||||
@ -119,7 +119,7 @@ class UserPreferences
|
||||
. '\'';
|
||||
|
||||
$has_config = $GLOBALS['dbi']->fetchValue(
|
||||
$query, 0, 0, $GLOBALS['controllink']
|
||||
$query, 0, 0, DatabaseInterface::CONNECT_CONTROL
|
||||
);
|
||||
$config_data = json_encode($config_array);
|
||||
if ($has_config) {
|
||||
@ -140,11 +140,11 @@ class UserPreferences
|
||||
if (isset($_SESSION['cache'][$cache_key]['userprefs'])) {
|
||||
unset($_SESSION['cache'][$cache_key]['userprefs']);
|
||||
}
|
||||
if (!$GLOBALS['dbi']->tryQuery($query, $GLOBALS['controllink'])) {
|
||||
if (!$GLOBALS['dbi']->tryQuery($query, DatabaseInterface::CONNECT_CONTROL)) {
|
||||
$message = Message::error(__('Could not save configuration'));
|
||||
$message->addMessage(
|
||||
Message::rawError(
|
||||
$GLOBALS['dbi']->getError($GLOBALS['controllink'])
|
||||
$GLOBALS['dbi']->getError(DatabaseInterface::CONNECT_CONTROL)
|
||||
),
|
||||
'<br /><br />'
|
||||
);
|
||||
|
||||
@ -875,5 +875,4 @@ $GLOBALS['dummy_queries'] = array(
|
||||
$GLOBALS['dummy_db'] = '';
|
||||
|
||||
/* Some basic setup for dummy driver */
|
||||
$GLOBALS['controllink'] = 2;
|
||||
$GLOBALS['cfg']['DBG']['sql'] = false;
|
||||
|
||||
@ -9,6 +9,7 @@ namespace PhpMyAdmin\Tests;
|
||||
|
||||
use PhpMyAdmin\CentralColumns;
|
||||
use PhpMyAdmin\Config;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Types;
|
||||
use PhpMyAdmin\Url;
|
||||
use PhpMyAdmin\Util;
|
||||
@ -180,7 +181,7 @@ class CentralColumnsTest extends TestCase
|
||||
->with(
|
||||
"SELECT count(db_name) FROM `pma_central_columns` "
|
||||
. "WHERE db_name = 'phpmyadmin';",
|
||||
null, null, $GLOBALS['controllink']
|
||||
null, null, DatabaseInterface::CONNECT_CONTROL
|
||||
)
|
||||
->will(
|
||||
$this->returnValue(array(3))
|
||||
@ -223,7 +224,7 @@ class CentralColumnsTest extends TestCase
|
||||
->with(
|
||||
"SELECT col_name FROM `pma_central_columns` "
|
||||
. "WHERE db_name = 'PMA_db' AND col_name IN ('col1');",
|
||||
null, null, $GLOBALS['controllink']
|
||||
null, null, DatabaseInterface::CONNECT_CONTROL
|
||||
)
|
||||
->will(
|
||||
$this->returnValue(array('col1'))
|
||||
@ -234,7 +235,7 @@ class CentralColumnsTest extends TestCase
|
||||
->with(
|
||||
"DELETE FROM `pma_central_columns` "
|
||||
. "WHERE db_name = 'PMA_db' AND col_name IN ('col1');",
|
||||
$GLOBALS['controllink']
|
||||
DatabaseInterface::CONNECT_CONTROL
|
||||
)
|
||||
->will(
|
||||
$this->returnValue(array('col1'))
|
||||
@ -291,7 +292,7 @@ class CentralColumnsTest extends TestCase
|
||||
->with(
|
||||
"SELECT col_name FROM `pma_central_columns` "
|
||||
. "WHERE db_name = 'PMA_db' AND col_name IN ('id','col1','col2');",
|
||||
null, null, $GLOBALS['controllink']
|
||||
null, null, DatabaseInterface::CONNECT_CONTROL
|
||||
)
|
||||
->will(
|
||||
$this->returnValue(array('id','col1'))
|
||||
@ -317,7 +318,7 @@ class CentralColumnsTest extends TestCase
|
||||
->with(
|
||||
"SELECT * FROM `pma_central_columns` "
|
||||
. "WHERE db_name = 'PMA_db' AND col_name IN ('id','col1','col2');",
|
||||
null, null, $GLOBALS['controllink']
|
||||
null, null, DatabaseInterface::CONNECT_CONTROL
|
||||
)
|
||||
->will(
|
||||
$this->returnValue(array_slice($this->_columnData, 0, 2))
|
||||
@ -381,7 +382,7 @@ class CentralColumnsTest extends TestCase
|
||||
->with(
|
||||
"SELECT * FROM `pma_central_columns` "
|
||||
. "WHERE db_name = 'phpmyadmin' AND col_name IN ('col1','col2');",
|
||||
null, null, $GLOBALS['controllink']
|
||||
null, null, DatabaseInterface::CONNECT_CONTROL
|
||||
)
|
||||
->will(
|
||||
$this->returnValue($this->_columnData)
|
||||
@ -485,7 +486,7 @@ class CentralColumnsTest extends TestCase
|
||||
->with(
|
||||
"SELECT * FROM `pma_central_columns` "
|
||||
. "WHERE db_name = 'phpmyadmin';",
|
||||
null, null, $GLOBALS['controllink']
|
||||
null, null, DatabaseInterface::CONNECT_CONTROL
|
||||
)
|
||||
->will(
|
||||
$this->returnValue($this->_columnData)
|
||||
@ -509,7 +510,7 @@ class CentralColumnsTest extends TestCase
|
||||
"SELECT * FROM `pma_central_columns` "
|
||||
. "WHERE db_name = 'phpmyadmin' AND col_name "
|
||||
. "NOT IN ('id','col1','col2');",
|
||||
null, null, $GLOBALS['controllink']
|
||||
null, null, DatabaseInterface::CONNECT_CONTROL
|
||||
)
|
||||
->will(
|
||||
$this->returnValue($this->_columnData)
|
||||
@ -572,7 +573,7 @@ class CentralColumnsTest extends TestCase
|
||||
->with(
|
||||
"SELECT * FROM `pma_central_columns` WHERE db_name = 'phpmyadmin'"
|
||||
. " AND col_name IN ('col1');",
|
||||
null, null, $GLOBALS['controllink']
|
||||
null, null, DatabaseInterface::CONNECT_CONTROL
|
||||
)
|
||||
->will(
|
||||
$this->returnValue(array_slice($this->_columnData, 1, 1))
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
namespace PhpMyAdmin\Tests\Controllers\Server;
|
||||
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Di\Container;
|
||||
use PhpMyAdmin\Tests\PmaTestCase;
|
||||
use PhpMyAdmin\Tests\Stubs\Response as ResponseStub;
|
||||
@ -69,7 +70,7 @@ class ServerVariablesControllerTest extends PmaTestCase
|
||||
"SHOW SESSION VARIABLES;",
|
||||
0,
|
||||
1,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
$server_session_variable
|
||||
),
|
||||
@ -77,7 +78,7 @@ class ServerVariablesControllerTest extends PmaTestCase
|
||||
"SHOW GLOBAL VARIABLES;",
|
||||
0,
|
||||
1,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
$server_global_variables
|
||||
)
|
||||
|
||||
@ -63,7 +63,7 @@ class DesignerTest extends TestCase
|
||||
->with(
|
||||
"SELECT `page_nr`, `page_descr` FROM `pmadb`.`pdf_pages`"
|
||||
. " WHERE db_name = '" . $db . "' ORDER BY `page_descr`",
|
||||
2,
|
||||
DatabaseInterface::CONNECT_CONTROL,
|
||||
DatabaseInterface::QUERY_STORE,
|
||||
false
|
||||
)
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
*/
|
||||
namespace PhpMyAdmin\Tests;
|
||||
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Normalization;
|
||||
use PhpMyAdmin\Theme;
|
||||
use PhpMyAdmin\Types;
|
||||
@ -67,13 +68,13 @@ class NormalizationTest extends TestCase
|
||||
->method('getColumnNames')
|
||||
->will($this->returnValue(array("id", "col1", "col2")));
|
||||
$map = array(
|
||||
array('PMA_db', 'PMA_table1', null, array()),
|
||||
array('PMA_db', 'PMA_table1', DatabaseInterface::CONNECT_USER, array()),
|
||||
array(
|
||||
'PMA_db', 'PMA_table', null,
|
||||
'PMA_db', 'PMA_table', DatabaseInterface::CONNECT_USER,
|
||||
array(array('Key_name'=>'PRIMARY', 'Column_name'=>'id'))
|
||||
),
|
||||
array(
|
||||
'PMA_db', 'PMA_table2', null,
|
||||
'PMA_db', 'PMA_table2', DatabaseInterface::CONNECT_USER,
|
||||
array(
|
||||
array('Key_name'=>'PRIMARY', 'Column_name'=>'id'),
|
||||
array('Key_name'=>'PRIMARY', 'Column_name'=>'col1')
|
||||
|
||||
@ -532,7 +532,6 @@ class ExportHtmlwordTest extends PmaTestCase
|
||||
->will($this->returnValue(1));
|
||||
|
||||
$GLOBALS['cfgRelation']['relation'] = true;
|
||||
$GLOBALS['controllink'] = null;
|
||||
$_SESSION['relation'][0] = array(
|
||||
'PMA_VERSION' => PMA_VERSION,
|
||||
'relwork' => true,
|
||||
|
||||
@ -744,7 +744,6 @@ class ExportOdtTest extends PmaTestCase
|
||||
'relation' => 'rel',
|
||||
'column_info' => 'col'
|
||||
);
|
||||
$GLOBALS['controllink'] = null;
|
||||
$this->assertTrue(
|
||||
$this->object->getTableDef(
|
||||
'database',
|
||||
|
||||
@ -42,7 +42,6 @@ class ExportSqlTest extends PmaTestCase
|
||||
$GLOBALS['plugin_param']['export_type'] = 'table';
|
||||
$GLOBALS['plugin_param']['single_table'] = false;
|
||||
$GLOBALS['cfgRelation']['relation'] = true;
|
||||
$GLOBALS['controllink'] = null;
|
||||
$this->object = new ExportSql();
|
||||
}
|
||||
|
||||
@ -712,8 +711,8 @@ class ExportSqlTest extends PmaTestCase
|
||||
->will(
|
||||
$this->returnValueMap(
|
||||
array(
|
||||
array('db', 'EVENT', 'f1', null, 'f1event'),
|
||||
array('db', 'EVENT', 'f2', null, 'f2event')
|
||||
array('db', 'EVENT', 'f1', DatabaseInterface::CONNECT_USER, 'f1event'),
|
||||
array('db', 'EVENT', 'f2', DatabaseInterface::CONNECT_USER, 'f2event')
|
||||
)
|
||||
)
|
||||
);
|
||||
@ -1481,7 +1480,7 @@ class ExportSqlTest extends PmaTestCase
|
||||
->method('tryQuery')
|
||||
->with(
|
||||
"SELECT a FROM b WHERE 1",
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_UNBUFFERED
|
||||
)
|
||||
->will($this->returnValue('res'));
|
||||
@ -1612,7 +1611,7 @@ class ExportSqlTest extends PmaTestCase
|
||||
->method('tryQuery')
|
||||
->with(
|
||||
"SELECT a FROM b WHERE 1",
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
DatabaseInterface::QUERY_UNBUFFERED
|
||||
)
|
||||
->will($this->returnValue('res'));
|
||||
|
||||
@ -363,7 +363,6 @@ class ExportTexytextTest extends PmaTestCase
|
||||
$this->object = $this->getMockBuilder('PhpMyAdmin\Plugins\Export\ExportTexytext')
|
||||
->setMethods(array('formatOneColumnDefinition'))
|
||||
->getMock();
|
||||
$GLOBALS['controllink'] = null;
|
||||
|
||||
// case 1
|
||||
|
||||
|
||||
@ -41,7 +41,6 @@ class DiaRelationSchemaTest extends PmaTestCase
|
||||
$_REQUEST['t_y'] = array('information_schema.files' => 0);
|
||||
|
||||
$GLOBALS['server'] = 1;
|
||||
$GLOBALS['controllink'] = null;
|
||||
$GLOBALS['db'] = 'information_schema';
|
||||
$GLOBALS['cfg']['Server']['table_coords'] = "table_name";
|
||||
|
||||
|
||||
@ -42,7 +42,6 @@ class EpsRelationSchemaTest extends PmaTestCase
|
||||
$_REQUEST['t_y'] = array('information_schema.files' => 0);
|
||||
|
||||
$GLOBALS['server'] = 1;
|
||||
$GLOBALS['controllink'] = null;
|
||||
$GLOBALS['db'] = 'information_schema';
|
||||
$GLOBALS['cfg']['Server']['table_coords'] = "table_name";
|
||||
|
||||
|
||||
@ -45,7 +45,6 @@ class PdfRelationSchemaTest extends PmaTestCase
|
||||
$_REQUEST['t_y'] = array('information_schema.files' => 0);
|
||||
|
||||
$GLOBALS['server'] = 1;
|
||||
$GLOBALS['controllink'] = null;
|
||||
$GLOBALS['db'] = 'information_schema';
|
||||
$GLOBALS['cfg']['Server']['pmadb'] = "pmadb";
|
||||
$GLOBALS['cfg']['Server']['user'] = "user";
|
||||
|
||||
@ -41,7 +41,6 @@ class SvgRelationSchemaTest extends PmaTestCase
|
||||
$_REQUEST['t_y'] = array('information_schema.files' => 0);
|
||||
|
||||
$GLOBALS['server'] = 1;
|
||||
$GLOBALS['controllink'] = null;
|
||||
$GLOBALS['db'] = 'information_schema';
|
||||
$GLOBALS['cfg']['Server']['table_coords'] = "table_name";
|
||||
|
||||
|
||||
@ -26,7 +26,6 @@ class PmdCommonTest extends TestCase
|
||||
public function setup()
|
||||
{
|
||||
$GLOBALS['server'] = 1;
|
||||
$GLOBALS['controllink'] = 2;
|
||||
$_SESSION = array(
|
||||
'relation' => array(
|
||||
'1' => array(
|
||||
@ -68,7 +67,7 @@ class PmdCommonTest extends TestCase
|
||||
WHERE pdf_page_number = " . $pg,
|
||||
'name',
|
||||
null,
|
||||
2,
|
||||
DatabaseInterface::CONNECT_CONTROL,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
);
|
||||
$GLOBALS['dbi'] = $dbi;
|
||||
@ -99,7 +98,7 @@ class PmdCommonTest extends TestCase
|
||||
. " WHERE `page_nr` = " . $pg,
|
||||
null,
|
||||
null,
|
||||
2,
|
||||
DatabaseInterface::CONNECT_CONTROL,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
)
|
||||
->will($this->returnValue(array($pageName)));
|
||||
@ -161,7 +160,7 @@ class PmdCommonTest extends TestCase
|
||||
. " AND `page_descr` = '" . $db . "'",
|
||||
null,
|
||||
null,
|
||||
2,
|
||||
DatabaseInterface::CONNECT_CONTROL,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
)
|
||||
->will($this->returnValue(array($default_pg)));
|
||||
@ -195,7 +194,7 @@ class PmdCommonTest extends TestCase
|
||||
. " AND `page_descr` = '" . $db . "'",
|
||||
null,
|
||||
null,
|
||||
2,
|
||||
DatabaseInterface::CONNECT_CONTROL,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
)
|
||||
->will($this->returnValue(array()));
|
||||
@ -230,7 +229,7 @@ class PmdCommonTest extends TestCase
|
||||
. " AND `page_descr` = '" . $db . "'",
|
||||
null,
|
||||
null,
|
||||
2,
|
||||
DatabaseInterface::CONNECT_CONTROL,
|
||||
DatabaseInterface::QUERY_STORE
|
||||
)
|
||||
->will($this->returnValue(array($default_pg)));
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
*/
|
||||
namespace PhpMyAdmin\Tests;
|
||||
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\ReplicationGui;
|
||||
use PhpMyAdmin\Theme;
|
||||
use PHPUnit_Framework_TestCase as TestCase;
|
||||
@ -66,7 +67,7 @@ class ReplicationGuiTest extends TestCase
|
||||
"SHOW SLAVE HOSTS",
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
$slave_host
|
||||
),
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
*/
|
||||
namespace PhpMyAdmin\Tests\Rte;
|
||||
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Rte\Routines;
|
||||
use PhpMyAdmin\Types;
|
||||
@ -1106,9 +1107,9 @@ class RoutinesTest extends TestCase
|
||||
->will(
|
||||
$this->returnValueMap(
|
||||
array(
|
||||
array('foo', null, 'foo'),
|
||||
array("foo's bar", null, "foo\'s bar"),
|
||||
array('', null, '')
|
||||
array('foo', DatabaseInterface::CONNECT_USER, 'foo'),
|
||||
array("foo's bar", DatabaseInterface::CONNECT_USER, "foo\'s bar"),
|
||||
array('', DatabaseInterface::CONNECT_USER, '')
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
namespace PhpMyAdmin\Tests\Server\Status;
|
||||
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Server\Status\Advisor;
|
||||
use PhpMyAdmin\Server\Status\Data;
|
||||
use PhpMyAdmin\Theme;
|
||||
@ -88,7 +89,7 @@ class AdvisorTest extends TestCase
|
||||
"SHOW GLOBAL STATUS",
|
||||
0,
|
||||
1,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
$server_status
|
||||
),
|
||||
@ -96,7 +97,7 @@ class AdvisorTest extends TestCase
|
||||
"SHOW GLOBAL VARIABLES",
|
||||
0,
|
||||
1,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
$server_variables
|
||||
),
|
||||
@ -105,7 +106,7 @@ class AdvisorTest extends TestCase
|
||||
. "FROM data_dictionary.GLOBAL_STATEMENTS",
|
||||
0,
|
||||
1,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
$server_status
|
||||
),
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
namespace PhpMyAdmin\Tests\Server\Status;
|
||||
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Server\Status\Data;
|
||||
use PhpMyAdmin\Tests\PmaTestCase;
|
||||
|
||||
@ -71,7 +72,7 @@ class DataTest extends PmaTestCase
|
||||
"SHOW GLOBAL STATUS",
|
||||
0,
|
||||
1,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
$server_status
|
||||
),
|
||||
@ -79,7 +80,7 @@ class DataTest extends PmaTestCase
|
||||
"SHOW GLOBAL VARIABLES",
|
||||
0,
|
||||
1,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
$server_variables
|
||||
),
|
||||
@ -88,7 +89,7 @@ class DataTest extends PmaTestCase
|
||||
. "FROM data_dictionary.GLOBAL_STATEMENTS",
|
||||
0,
|
||||
1,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
$server_status
|
||||
),
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
namespace PhpMyAdmin\Tests\Server\Status;
|
||||
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Server\Status\Monitor;
|
||||
use PhpMyAdmin\Server\Status\Data;
|
||||
use PhpMyAdmin\Theme;
|
||||
@ -83,7 +84,7 @@ class MonitorTest extends TestCase
|
||||
"SHOW GLOBAL STATUS",
|
||||
0,
|
||||
1,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
$server_status
|
||||
),
|
||||
@ -91,7 +92,7 @@ class MonitorTest extends TestCase
|
||||
"SHOW GLOBAL VARIABLES",
|
||||
0,
|
||||
1,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
$server_variables
|
||||
),
|
||||
@ -100,7 +101,7 @@ class MonitorTest extends TestCase
|
||||
. "FROM data_dictionary.GLOBAL_STATEMENTS",
|
||||
0,
|
||||
1,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
$server_status
|
||||
),
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
namespace PhpMyAdmin\Tests\Server\Status;
|
||||
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Server\Status\Data;
|
||||
use PhpMyAdmin\Server\Status\Queries;
|
||||
use PhpMyAdmin\Theme;
|
||||
@ -83,7 +84,7 @@ class QueriesTest extends TestCase
|
||||
"SHOW GLOBAL STATUS",
|
||||
0,
|
||||
1,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
$server_status
|
||||
),
|
||||
@ -91,7 +92,7 @@ class QueriesTest extends TestCase
|
||||
"SHOW GLOBAL VARIABLES",
|
||||
0,
|
||||
1,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
$server_variables
|
||||
)
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
namespace PhpMyAdmin\Tests\Server\Status;
|
||||
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Server\Status\Data;
|
||||
use PhpMyAdmin\Server\Status\Variables;
|
||||
use PhpMyAdmin\Theme;
|
||||
@ -84,7 +85,7 @@ class VariablesTest extends TestCase
|
||||
"SHOW GLOBAL STATUS",
|
||||
0,
|
||||
1,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
$server_status
|
||||
),
|
||||
@ -92,7 +93,7 @@ class VariablesTest extends TestCase
|
||||
"SHOW GLOBAL VARIABLES",
|
||||
0,
|
||||
1,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
$server_variables
|
||||
),
|
||||
@ -101,7 +102,7 @@ class VariablesTest extends TestCase
|
||||
. "FROM data_dictionary.GLOBAL_STATEMENTS",
|
||||
0,
|
||||
1,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
$server_status
|
||||
),
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
namespace PhpMyAdmin\Tests\Server;
|
||||
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Server\Status;
|
||||
use PhpMyAdmin\Server\Status\Data;
|
||||
use PhpMyAdmin\Theme;
|
||||
@ -77,7 +78,7 @@ class StatusTest extends TestCase
|
||||
"SHOW GLOBAL STATUS",
|
||||
0,
|
||||
1,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
$server_status
|
||||
),
|
||||
@ -85,7 +86,7 @@ class StatusTest extends TestCase
|
||||
"SHOW GLOBAL VARIABLES",
|
||||
0,
|
||||
1,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
$server_variables
|
||||
),
|
||||
@ -94,7 +95,7 @@ class StatusTest extends TestCase
|
||||
. "FROM data_dictionary.GLOBAL_STATEMENTS",
|
||||
0,
|
||||
1,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
$server_status
|
||||
),
|
||||
|
||||
@ -85,7 +85,7 @@ class TableTest extends PmaTestCase
|
||||
$sql_isView_true,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
true
|
||||
),
|
||||
@ -93,7 +93,7 @@ class TableTest extends PmaTestCase
|
||||
$sql_copy_data,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
false
|
||||
),
|
||||
@ -101,7 +101,7 @@ class TableTest extends PmaTestCase
|
||||
$sql_isView_false,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
false
|
||||
),
|
||||
@ -109,7 +109,7 @@ class TableTest extends PmaTestCase
|
||||
$sql_isUpdatableView_true,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
true
|
||||
),
|
||||
@ -117,7 +117,7 @@ class TableTest extends PmaTestCase
|
||||
$sql_isUpdatableView_false,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
false
|
||||
),
|
||||
@ -125,7 +125,7 @@ class TableTest extends PmaTestCase
|
||||
$sql_analyzeStructure_true,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
array(
|
||||
array('COLUMN_NAME'=>'COLUMN_NAME', 'DATA_TYPE'=>'DATA_TYPE')
|
||||
@ -135,7 +135,7 @@ class TableTest extends PmaTestCase
|
||||
$getUniqueColumns_sql,
|
||||
array('Key_name', null),
|
||||
'Column_name',
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
array(
|
||||
array('index1'),
|
||||
@ -147,7 +147,7 @@ class TableTest extends PmaTestCase
|
||||
$getUniqueColumns_sql,
|
||||
'Column_name',
|
||||
'Column_name',
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
array(
|
||||
'column1',
|
||||
@ -162,7 +162,7 @@ class TableTest extends PmaTestCase
|
||||
'SHOW COLUMNS FROM `PMA`.`PMA_BookMark`',
|
||||
'Field',
|
||||
'Field',
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
array(
|
||||
'column1',
|
||||
@ -177,7 +177,7 @@ class TableTest extends PmaTestCase
|
||||
'SHOW COLUMNS FROM `PMA`.`PMA_BookMark`',
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_USER,
|
||||
0,
|
||||
array(
|
||||
array(
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
*/
|
||||
namespace PhpMyAdmin\Tests;
|
||||
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Tests\PmaTestCase;
|
||||
use PhpMyAdmin\Tracker;
|
||||
use PhpMyAdmin\Util;
|
||||
@ -291,12 +292,10 @@ class TrackerTest extends PmaTestCase
|
||||
"\n',
|
||||
'11' )";
|
||||
|
||||
$GLOBALS['controllink'] = null;
|
||||
|
||||
$queryResults = array(
|
||||
array(
|
||||
$expectedMainQuery,
|
||||
null,
|
||||
DatabaseInterface::CONNECT_CONTROL,
|
||||
0,
|
||||
false,
|
||||
'executed'
|
||||
@ -382,11 +381,9 @@ class TrackerTest extends PmaTestCase
|
||||
"\n',
|
||||
'CREATE DATABASE,ALTER DATABASE,DROP DATABASE' )";
|
||||
|
||||
$GLOBALS['controllink'] = null;
|
||||
|
||||
$dbi->expects($this->exactly(1))
|
||||
->method('query')
|
||||
->with($expectedMainQuery, null, 0, false)
|
||||
->with($expectedMainQuery, DatabaseInterface::CONNECT_CONTROL, 0, false)
|
||||
->will($this->returnValue("executed"));
|
||||
|
||||
$dbi->expects($this->any())->method('escapeString')
|
||||
@ -427,11 +424,9 @@ class TrackerTest extends PmaTestCase
|
||||
" AND `table_name` = '" . $tablename . "' " .
|
||||
" AND `version` = '" . $version . "' ";
|
||||
|
||||
$GLOBALS['controllink'] = null;
|
||||
|
||||
$dbi->expects($this->exactly(1))
|
||||
->method('query')
|
||||
->with($sql_query, null, 0, false)
|
||||
->with($sql_query, DatabaseInterface::CONNECT_CONTROL, 0, false)
|
||||
->will($this->returnValue("executed"));
|
||||
|
||||
$dbi->expects($this->any())->method('escapeString')
|
||||
@ -473,8 +468,6 @@ class TrackerTest extends PmaTestCase
|
||||
Tracker::changeTrackingData("", "", "", "", "")
|
||||
);
|
||||
|
||||
$GLOBALS['controllink'] = null;
|
||||
|
||||
$dbi = $this->getMockBuilder('PhpMyAdmin\DatabaseInterface')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
@ -509,8 +502,8 @@ class TrackerTest extends PmaTestCase
|
||||
->will(
|
||||
$this->returnValueMap(
|
||||
array(
|
||||
array($sql_query_1, null, 0, false, "executed_1"),
|
||||
array($sql_query_2, null, 0, false, "executed_2")
|
||||
array($sql_query_1, DatabaseInterface::CONNECT_CONTROL, 0, false, "executed_1"),
|
||||
array($sql_query_2, DatabaseInterface::CONNECT_CONTROL, 0, false, "executed_2")
|
||||
)
|
||||
)
|
||||
);
|
||||
@ -577,8 +570,6 @@ class TrackerTest extends PmaTestCase
|
||||
*/
|
||||
public function testGetTrackedData($fetchArrayReturn, $expectedArray)
|
||||
{
|
||||
$GLOBALS['controllink'] = null;
|
||||
|
||||
$dbi = $this->getMockBuilder('PhpMyAdmin\DatabaseInterface')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
namespace PhpMyAdmin\Tests;
|
||||
|
||||
use PhpMyAdmin\Config\ConfigFile;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\Tests\PmaTestCase;
|
||||
use PhpMyAdmin\UserPreferences;
|
||||
|
||||
@ -29,6 +30,7 @@ class UserPreferencesTest extends PmaTestCase
|
||||
include 'libraries/config.default.php';
|
||||
$GLOBALS['server'] = 0;
|
||||
$GLOBALS['PMA_PHP_SELF'] = '/phpmyadmin/';
|
||||
$GLOBALS['collation_connection'] = 'utf8_general_ci';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -100,7 +102,6 @@ class UserPreferencesTest extends PmaTestCase
|
||||
$_SESSION['relation'][$GLOBALS['server']]['db'] = "pma'db";
|
||||
$_SESSION['relation'][$GLOBALS['server']]['userconfig'] = "testconf";
|
||||
$_SESSION['relation'][$GLOBALS['server']]['user'] = "user";
|
||||
$GLOBALS['controllink'] = null;
|
||||
|
||||
$dbi = $this->getMockBuilder('PhpMyAdmin\DatabaseInterface')
|
||||
->disableOriginalConstructor()
|
||||
@ -111,7 +112,7 @@ class UserPreferencesTest extends PmaTestCase
|
||||
|
||||
$dbi->expects($this->once())
|
||||
->method('fetchSingleRow')
|
||||
->with($query, 'ASSOC', null)
|
||||
->with($query, 'ASSOC', DatabaseInterface::CONNECT_CONTROL)
|
||||
->will(
|
||||
$this->returnValue(
|
||||
array(
|
||||
@ -189,7 +190,6 @@ class UserPreferencesTest extends PmaTestCase
|
||||
$_SESSION['relation'][$GLOBALS['server']]['db'] = "pmadb";
|
||||
$_SESSION['relation'][$GLOBALS['server']]['userconfig'] = "testconf";
|
||||
$_SESSION['relation'][$GLOBALS['server']]['user'] = "user";
|
||||
$GLOBALS['controllink'] = null;
|
||||
|
||||
$query1 = 'SELECT `username` FROM `pmadb`.`testconf` '
|
||||
. 'WHERE `username` = \'user\'';
|
||||
@ -203,12 +203,12 @@ class UserPreferencesTest extends PmaTestCase
|
||||
|
||||
$dbi->expects($this->once())
|
||||
->method('fetchValue')
|
||||
->with($query1, 0, 0, null)
|
||||
->with($query1, 0, 0, DatabaseInterface::CONNECT_CONTROL)
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$dbi->expects($this->once())
|
||||
->method('tryQuery')
|
||||
->with($query2, null)
|
||||
->with($query2, DatabaseInterface::CONNECT_CONTROL)
|
||||
->will($this->returnValue(true));
|
||||
|
||||
$dbi->expects($this->any())
|
||||
@ -234,17 +234,17 @@ class UserPreferencesTest extends PmaTestCase
|
||||
|
||||
$dbi->expects($this->once())
|
||||
->method('fetchValue')
|
||||
->with($query1, 0, 0, null)
|
||||
->with($query1, 0, 0, DatabaseInterface::CONNECT_CONTROL)
|
||||
->will($this->returnValue(false));
|
||||
|
||||
$dbi->expects($this->once())
|
||||
->method('tryQuery')
|
||||
->with($query2, null)
|
||||
->with($query2, DatabaseInterface::CONNECT_CONTROL)
|
||||
->will($this->returnValue(false));
|
||||
|
||||
$dbi->expects($this->once())
|
||||
->method('getError')
|
||||
->with(null)
|
||||
->with(DatabaseInterface::CONNECT_CONTROL)
|
||||
->will($this->returnValue("err1"));
|
||||
$dbi->expects($this->any())
|
||||
->method('escapeString')
|
||||
@ -355,7 +355,7 @@ class UserPreferencesTest extends PmaTestCase
|
||||
{
|
||||
$GLOBALS['lang'] = '';
|
||||
|
||||
$this->mockResponse('Location: /phpmyadmin/file.html?a=b&saved=1&server=0#h+ash');
|
||||
$this->mockResponse('Location: /phpmyadmin/file.html?a=b&saved=1&server=0&collation_connection=utf8_general_ci#h+ash');
|
||||
|
||||
$GLOBALS['PMA_Config']->set('PmaAbsoluteUri', '');
|
||||
$GLOBALS['PMA_Config']->set('PMA_IS_IIS', false);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user