Merge branch 'master' of https://github.com/phpmyadmin/phpmyadmin
This commit is contained in:
commit
fe3d80bb95
@ -4,3 +4,6 @@ imports:
|
||||
- php
|
||||
filter:
|
||||
excluded_paths: [libraries/php-gettext/*, libraries/tcpdf/*, libraries/bfShapeFiles/*, PMAStandard/*, libraries/phpseclib/*, libraries/plugins/auth/recaptchalib.php, libraries/plugins/auth/swekey/swekey.php, js/jquery/*, js/jqplot/*, js/openlayers/*, js/codemirror/*, js/canvg/*, js/tracekit/*, js/OpenStreetMap.js]
|
||||
tools:
|
||||
external_code_coverage:
|
||||
timeout: 3600 # Timeout in seconds.
|
||||
|
||||
@ -37,6 +37,8 @@ before_script:
|
||||
|
||||
composer install --dev --no-interaction ;
|
||||
|
||||
wget https://scrutinizer-ci.com/ocular.phar ;
|
||||
|
||||
fi ;
|
||||
|
||||
if [[ ! -z "$SELENIUM" ]] ; then
|
||||
@ -68,6 +70,7 @@ script:
|
||||
ant lint ;
|
||||
fi
|
||||
after_script:
|
||||
- if [[ -f build/logs/clover.xml ]] ; then php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml ; fi
|
||||
- if [[ -f vendor/bin/coveralls ]] ; then php vendor/bin/coveralls -v ; fi
|
||||
matrix:
|
||||
allow_failures:
|
||||
|
||||
@ -9,6 +9,8 @@ if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once './libraries/logging.lib.php';
|
||||
|
||||
/**
|
||||
* Main interface for database interactions
|
||||
*
|
||||
@ -123,8 +125,8 @@ class PMA_DatabaseInterface
|
||||
* Stores query data into session data for debugging purposes
|
||||
*
|
||||
* @param string $query Query text
|
||||
* @param resource $link database link
|
||||
* @param resource $result Query result
|
||||
* @param object $link database link
|
||||
* @param object $result Query result
|
||||
* @param integer $time Time to execute query
|
||||
*
|
||||
* @return void
|
||||
@ -146,34 +148,18 @@ class PMA_DatabaseInterface
|
||||
$_SESSION['debug']['queries'][$hash]['time'] = $time;
|
||||
}
|
||||
|
||||
$trace = array();
|
||||
foreach (debug_backtrace() as $trace_step) {
|
||||
$trace[]
|
||||
= (isset($trace_step['file'])
|
||||
? PMA_Error::relPath($trace_step['file'])
|
||||
: '')
|
||||
. (isset($trace_step['line'])
|
||||
? '#' . $trace_step['line'] . ': '
|
||||
: '')
|
||||
. (isset($trace_step['class']) ? $trace_step['class'] : '')
|
||||
. (isset($trace_step['type']) ? $trace_step['type'] : '')
|
||||
. (isset($trace_step['function']) ? $trace_step['function'] : '')
|
||||
. '('
|
||||
. (isset($trace_step['params'])
|
||||
? implode(', ', $trace_step['params'])
|
||||
: ''
|
||||
)
|
||||
. ')'
|
||||
;
|
||||
}
|
||||
$_SESSION['debug']['queries'][$hash]['trace'][] = $trace;
|
||||
$_SESSION['debug']['queries'][$hash]['trace'][] = PMA_Error::formatBacktrace(
|
||||
debug_backtrace(),
|
||||
" ",
|
||||
"\n"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* runs a query and returns the result
|
||||
*
|
||||
* @param string $query query to run
|
||||
* @param resource $link mysql link resource
|
||||
* @param object $link mysql link resource
|
||||
* @param integer $options query options
|
||||
* @param bool $cache_affected_rows whether to cache affected row
|
||||
*
|
||||
@ -182,12 +168,9 @@ class PMA_DatabaseInterface
|
||||
public function tryQuery($query, $link = null, $options = 0,
|
||||
$cache_affected_rows = true
|
||||
) {
|
||||
if (empty($link)) {
|
||||
if (isset($GLOBALS['userlink'])) {
|
||||
$link = $GLOBALS['userlink'];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
$link = $this->getLink($link);
|
||||
if ($link === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($GLOBALS['cfg']['DBG']['sql']) {
|
||||
@ -221,12 +204,9 @@ class PMA_DatabaseInterface
|
||||
*/
|
||||
public function tryMultiQuery($multi_query = '', $link = null)
|
||||
{
|
||||
if (empty($link)) {
|
||||
if (isset($GLOBALS['userlink'])) {
|
||||
$link = $GLOBALS['userlink'];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
$link = $this->getLink($link);
|
||||
if ($link === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->_extension->realMultiQuery($link, $multi_query);
|
||||
@ -498,8 +478,6 @@ class PMA_DatabaseInterface
|
||||
$databases = $database;
|
||||
}
|
||||
|
||||
$tables = array();
|
||||
|
||||
$sql_where_table = $this->_getTableCondition(
|
||||
$table, $tbl_is_group, $tble_type
|
||||
);
|
||||
@ -832,7 +810,7 @@ class PMA_DatabaseInterface
|
||||
*
|
||||
* @param string $database database
|
||||
* @param boolean $force_stats retrieve stats also for MySQL < 5
|
||||
* @param resource $link mysql link
|
||||
* @param object $link mysql link
|
||||
* @param string $sort_by column to order by
|
||||
* @param string $sort_order ASC or DESC
|
||||
* @param integer $limit_offset starting offset for LIMIT
|
||||
@ -1031,8 +1009,6 @@ class PMA_DatabaseInterface
|
||||
public function getColumnsFull($database = null, $table = null,
|
||||
$column = null, $link = null
|
||||
) {
|
||||
$columns = array();
|
||||
|
||||
$sql_wheres = array();
|
||||
$array_keys = array();
|
||||
|
||||
@ -1408,12 +1384,9 @@ class PMA_DatabaseInterface
|
||||
public function getVariable(
|
||||
$var, $type = self::GETVAR_SESSION, $link = null
|
||||
) {
|
||||
if ($link === null) {
|
||||
if (isset($GLOBALS['userlink'])) {
|
||||
$link = $GLOBALS['userlink'];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
$link = $this->getLink($link);
|
||||
if ($link === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch ($type) {
|
||||
@ -1597,7 +1570,7 @@ class PMA_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 resource $link mysql link
|
||||
* @param object $link mysql link
|
||||
*
|
||||
* @return mixed value of first field in first row from result
|
||||
* or false if not found
|
||||
@ -1657,7 +1630,7 @@ class PMA_DatabaseInterface
|
||||
* @param string $query The query to execute
|
||||
* @param string $type NUM|ASSOC|BOTH returned array should either
|
||||
* numeric associativ or both
|
||||
* @param resource $link mysql link
|
||||
* @param object $link mysql link
|
||||
*
|
||||
* @return array|boolean first row from result
|
||||
* or false if result is empty
|
||||
@ -1697,6 +1670,23 @@ class PMA_DatabaseInterface
|
||||
return $row;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns row or element of a row
|
||||
*
|
||||
* @param array $row Row to process
|
||||
* @param string|null $value Which column to return
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
private function _fetchValue($row, $value)
|
||||
{
|
||||
if (is_null($value)) {
|
||||
return $row;
|
||||
} else {
|
||||
return $row[$value];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* returns all rows in the resultset in one array
|
||||
*
|
||||
@ -1744,7 +1734,7 @@ class PMA_DatabaseInterface
|
||||
* used as key for array
|
||||
* @param string|integer $value value-name or offset
|
||||
* used as value for array
|
||||
* @param resource $link mysql link
|
||||
* @param object $link mysql link
|
||||
* @param mixed $options query options
|
||||
*
|
||||
* @return array resultrows or values indexed by $key
|
||||
@ -1774,35 +1764,9 @@ class PMA_DatabaseInterface
|
||||
$fetch_function = 'fetchRow';
|
||||
}
|
||||
|
||||
if (null === $key && null === $value) {
|
||||
if (null === $key) {
|
||||
while ($row = $this->$fetch_function($result)) {
|
||||
$resultrows[] = $row;
|
||||
}
|
||||
} elseif (null === $key) {
|
||||
while ($row = $this->$fetch_function($result)) {
|
||||
$resultrows[] = $row[$value];
|
||||
}
|
||||
} elseif (null === $value) {
|
||||
if (is_array($key)) {
|
||||
while ($row = $this->$fetch_function($result)) {
|
||||
$result_target =& $resultrows;
|
||||
foreach ($key as $key_index) {
|
||||
if (null === $key_index) {
|
||||
$result_target =& $result_target[];
|
||||
continue;
|
||||
}
|
||||
|
||||
if (! isset($result_target[$row[$key_index]])) {
|
||||
$result_target[$row[$key_index]] = array();
|
||||
}
|
||||
$result_target =& $result_target[$row[$key_index]];
|
||||
}
|
||||
$result_target = $row;
|
||||
}
|
||||
} else {
|
||||
while ($row = $this->$fetch_function($result)) {
|
||||
$resultrows[$row[$key]] = $row;
|
||||
}
|
||||
$resultrows[] = $this->_fetchValue($row, $value);
|
||||
}
|
||||
} else {
|
||||
if (is_array($key)) {
|
||||
@ -1819,11 +1783,11 @@ class PMA_DatabaseInterface
|
||||
}
|
||||
$result_target =& $result_target[$row[$key_index]];
|
||||
}
|
||||
$result_target = $row[$value];
|
||||
$result_target = $this->_fetchValue($row, $value);
|
||||
}
|
||||
} else {
|
||||
while ($row = $this->$fetch_function($result)) {
|
||||
$resultrows[$row[$key]] = $row[$value];
|
||||
$resultrows[$row[$key]] = $this->_fetchValue($row, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1863,18 +1827,15 @@ class PMA_DatabaseInterface
|
||||
/**
|
||||
* returns warnings for last query
|
||||
*
|
||||
* @param resource $link mysql link resource
|
||||
* @param object $link mysql link resource
|
||||
*
|
||||
* @return array warnings
|
||||
*/
|
||||
public function getWarnings($link = null)
|
||||
{
|
||||
if (empty($link)) {
|
||||
if (isset($GLOBALS['userlink'])) {
|
||||
$link = $GLOBALS['userlink'];
|
||||
} else {
|
||||
return array();
|
||||
}
|
||||
$link = $this->getLink($link);
|
||||
if ($link === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $this->fetchResult('SHOW WARNINGS', null, null, $link);
|
||||
@ -1885,7 +1846,7 @@ class PMA_DatabaseInterface
|
||||
*
|
||||
* @param string $db db name
|
||||
* @param string $which PROCEDURE | FUNCTION
|
||||
* @param resource $link mysql link
|
||||
* @param object $link mysql link
|
||||
*
|
||||
* @return array the procedure names or function names
|
||||
*/
|
||||
@ -2169,6 +2130,10 @@ class PMA_DatabaseInterface
|
||||
*/
|
||||
public function selectDb($dbname, $link = null)
|
||||
{
|
||||
$link = $this->getLink($link);
|
||||
if ($link === false) {
|
||||
return false;
|
||||
}
|
||||
return $this->_extension->selectDb($dbname, $link);
|
||||
}
|
||||
|
||||
@ -2242,6 +2207,10 @@ class PMA_DatabaseInterface
|
||||
*/
|
||||
public function moreResults($link = null)
|
||||
{
|
||||
$link = $this->getLink($link);
|
||||
if ($link === false) {
|
||||
return false;
|
||||
}
|
||||
return $this->_extension->moreResults($link = null);
|
||||
}
|
||||
|
||||
@ -2254,6 +2223,10 @@ class PMA_DatabaseInterface
|
||||
*/
|
||||
public function nextResult($link = null)
|
||||
{
|
||||
$link = $this->getLink($link);
|
||||
if ($link === false) {
|
||||
return false;
|
||||
}
|
||||
return $this->_extension->nextResult($link = null);
|
||||
}
|
||||
|
||||
@ -2276,6 +2249,10 @@ class PMA_DatabaseInterface
|
||||
*/
|
||||
public function getHostInfo($link = null)
|
||||
{
|
||||
$link = $this->getLink($link);
|
||||
if ($link === false) {
|
||||
return false;
|
||||
}
|
||||
return $this->_extension->getHostInfo($link);
|
||||
}
|
||||
|
||||
@ -2288,6 +2265,10 @@ class PMA_DatabaseInterface
|
||||
*/
|
||||
public function getProtoInfo($link = null)
|
||||
{
|
||||
$link = $this->getLink($link);
|
||||
if ($link === false) {
|
||||
return false;
|
||||
}
|
||||
return $this->_extension->getProtoInfo($link);
|
||||
}
|
||||
|
||||
@ -2310,6 +2291,10 @@ class PMA_DatabaseInterface
|
||||
*/
|
||||
public function getError($link = null)
|
||||
{
|
||||
$link = $this->getLink($link);
|
||||
if ($link === false) {
|
||||
return false;
|
||||
}
|
||||
return $this->_extension->getError($link);
|
||||
}
|
||||
|
||||
@ -2335,12 +2320,9 @@ class PMA_DatabaseInterface
|
||||
*/
|
||||
public function insertId($link = null)
|
||||
{
|
||||
if (empty($link)) {
|
||||
if (isset($GLOBALS['userlink'])) {
|
||||
$link = $GLOBALS['userlink'];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
$link = $this->getLink($link);
|
||||
if ($link === false) {
|
||||
return false;
|
||||
}
|
||||
// If the primary key is BIGINT we get an incorrect result
|
||||
// (sometimes negative, sometimes positive)
|
||||
@ -2359,11 +2341,20 @@ class PMA_DatabaseInterface
|
||||
* @param object $link the connection object
|
||||
* @param bool $get_from_cache whether to retrieve from cache
|
||||
*
|
||||
* @return string|int
|
||||
* @return int
|
||||
*/
|
||||
public function affectedRows($link = null, $get_from_cache = true)
|
||||
{
|
||||
return $this->_extension->affectedRows($link, $get_from_cache);
|
||||
$link = $this->getLink($link);
|
||||
if ($link === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($get_from_cache) {
|
||||
return $GLOBALS['cached_affected_rows'];
|
||||
} else {
|
||||
return $this->_extension->affectedRows($link);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2468,5 +2459,26 @@ class PMA_DatabaseInterface
|
||||
return $server['socket'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets correct link object.
|
||||
*
|
||||
* @param
|
||||
* @param mixed $link optional database link to use
|
||||
*
|
||||
* @return object
|
||||
*/
|
||||
public function getLink($link = null)
|
||||
{
|
||||
if ( ! is_null($link) && $link !== false) {
|
||||
return $link;
|
||||
}
|
||||
|
||||
if (isset($GLOBALS['userlink']) && !is_null($GLOBALS['userlink'])) {
|
||||
return $GLOBALS['userlink'];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@ -261,10 +261,30 @@ class PMA_Error extends PMA_Message
|
||||
* @return string
|
||||
*/
|
||||
public function getBacktraceDisplay()
|
||||
{
|
||||
return PMA_Error::formatBacktrace(
|
||||
$this->getBacktrace(),
|
||||
"<br />\n",
|
||||
"<br />\n"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* return formatted backtrace field
|
||||
*
|
||||
* @param array $backtrace Backtrace data
|
||||
* @param string $separatror Arguments separator to use
|
||||
* @param string $lines Lines separator to use
|
||||
*
|
||||
* @return string formatted backtrace
|
||||
* @static
|
||||
*/
|
||||
static function formatBacktrace($backtrace, $separator, $lines)
|
||||
{
|
||||
$retval = '';
|
||||
|
||||
foreach ($this->getBacktrace() as $step) {
|
||||
foreach ($backtrace as $step) {
|
||||
if (isset($step['file']) && isset($step['line'])) {
|
||||
$retval .= PMA_Error::relPath($step['file'])
|
||||
. '#' . $step['line'] . ': ';
|
||||
@ -274,18 +294,18 @@ class PMA_Error extends PMA_Message
|
||||
}
|
||||
$retval .= $step['function'] . '(';
|
||||
if (isset($step['args']) && (count($step['args']) > 1)) {
|
||||
$retval .= "<br />\n";
|
||||
$retval .= $separator;
|
||||
foreach ($step['args'] as $arg) {
|
||||
$retval .= "\t";
|
||||
$retval .= $this->getArg($arg, $step['function']);
|
||||
$retval .= ',' . "<br />\n";
|
||||
$retval .= PMA_Error::getArg($arg, $step['function']);
|
||||
$retval .= ',' . $separator;
|
||||
}
|
||||
} elseif (isset($step['args']) && (count($step['args']) > 0)) {
|
||||
foreach ($step['args'] as $arg) {
|
||||
$retval .= $this->getArg($arg, $step['function']);
|
||||
$retval .= PMA_Error::getArg($arg, $step['function']);
|
||||
}
|
||||
}
|
||||
$retval .= ')' . "<br />\n";
|
||||
$retval .= ')' . $lines;
|
||||
}
|
||||
|
||||
return $retval;
|
||||
@ -301,8 +321,9 @@ class PMA_Error extends PMA_Message
|
||||
* @param string $function function name
|
||||
*
|
||||
* @return string
|
||||
* @static
|
||||
*/
|
||||
protected function getArg($arg, $function)
|
||||
static function getArg($arg, $function)
|
||||
{
|
||||
$retval = '';
|
||||
$include_functions = array(
|
||||
|
||||
@ -2794,7 +2794,7 @@ class PMA_Util
|
||||
*/
|
||||
public static function clearUserCache()
|
||||
{
|
||||
self::cacheUnset('is_superuser', true);
|
||||
self::cacheUnset('is_superuser');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2841,17 +2841,13 @@ class PMA_Util
|
||||
/**
|
||||
* Removes cached information from the session
|
||||
*
|
||||
* @param string $var variable name
|
||||
* @param int|true $server server
|
||||
* @param string $var variable name
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function cacheUnset($var, $server = 0)
|
||||
public static function cacheUnset($var)
|
||||
{
|
||||
if ($server === true) {
|
||||
$server = $GLOBALS['server'];
|
||||
}
|
||||
unset($_SESSION['cache']['server_' . $server][$var]);
|
||||
unset($_SESSION['cache']['server_' . $GLOBALS['server']][$var]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -201,7 +201,6 @@ function PMA_getStatementPrefix($is_create_tbl = true)
|
||||
*/
|
||||
function PMA_getColumnCreationStatements($is_create_tbl = true)
|
||||
{
|
||||
$definitions = array();
|
||||
$sql_statement = "";
|
||||
list($field_cnt, $field_primary, $field_index,
|
||||
$field_unique, $field_fulltext
|
||||
|
||||
@ -18,7 +18,6 @@ if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once './libraries/logging.lib.php';
|
||||
require_once './libraries/dbi/drizzle-wrappers.lib.php';
|
||||
require_once './libraries/dbi/DBIExtension.int.php';
|
||||
|
||||
@ -29,6 +28,26 @@ if (! defined('PMA_MYSQL_CLIENT_API')) {
|
||||
define('PMA_MYSQL_CLIENT_API', (int)drizzle_version());
|
||||
}
|
||||
|
||||
/**
|
||||
* Names of field flags.
|
||||
*/
|
||||
$pma_drizzle_flag_names = array(
|
||||
DRIZZLE_COLUMN_FLAGS_UNIQUE_KEY => 'unique',
|
||||
DRIZZLE_COLUMN_FLAGS_NUM => 'num',
|
||||
DRIZZLE_COLUMN_FLAGS_PART_KEY => 'part_key',
|
||||
DRIZZLE_COLUMN_FLAGS_SET => 'set',
|
||||
DRIZZLE_COLUMN_FLAGS_TIMESTAMP => 'timestamp',
|
||||
DRIZZLE_COLUMN_FLAGS_AUTO_INCREMENT => 'auto_increment',
|
||||
DRIZZLE_COLUMN_FLAGS_ENUM => 'enum',
|
||||
DRIZZLE_COLUMN_FLAGS_ZEROFILL => 'zerofill',
|
||||
DRIZZLE_COLUMN_FLAGS_UNSIGNED => 'unsigned',
|
||||
DRIZZLE_COLUMN_FLAGS_BLOB => 'blob',
|
||||
DRIZZLE_COLUMN_FLAGS_MULTIPLE_KEY => 'multiple_key',
|
||||
DRIZZLE_COLUMN_FLAGS_UNIQUE_KEY => 'unique_key',
|
||||
DRIZZLE_COLUMN_FLAGS_PRI_KEY => 'primary_key',
|
||||
DRIZZLE_COLUMN_FLAGS_NOT_NULL => 'not_null',
|
||||
);
|
||||
|
||||
/**
|
||||
* Interface to the Drizzle extension
|
||||
*
|
||||
@ -136,15 +155,8 @@ class PMA_DBI_Drizzle implements PMA_DBI_Extension
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function selectDb($dbname, $link = null)
|
||||
public function selectDb($dbname, $link)
|
||||
{
|
||||
if (empty($link)) {
|
||||
if (isset($GLOBALS['userlink'])) {
|
||||
$link = $GLOBALS['userlink'];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return $link->selectDb($dbname);
|
||||
}
|
||||
|
||||
@ -249,7 +261,7 @@ class PMA_DBI_Drizzle implements PMA_DBI_Extension
|
||||
*
|
||||
* @return bool false
|
||||
*/
|
||||
public function moreResults($link = null)
|
||||
public function moreResults($link)
|
||||
{
|
||||
// N.B.: PHP's 'mysql' extension does not support
|
||||
// multi_queries so this function will always
|
||||
@ -265,7 +277,7 @@ class PMA_DBI_Drizzle implements PMA_DBI_Extension
|
||||
*
|
||||
* @return bool false
|
||||
*/
|
||||
public function nextResult($link = null)
|
||||
public function nextResult($link)
|
||||
{
|
||||
// N.B.: PHP's 'mysql' extension does not support
|
||||
// multi_queries so this function will always
|
||||
@ -281,16 +293,8 @@ class PMA_DBI_Drizzle implements PMA_DBI_Extension
|
||||
*
|
||||
* @return string type of connection used
|
||||
*/
|
||||
public function getHostInfo($link = null)
|
||||
public function getHostInfo($link)
|
||||
{
|
||||
if (null === $link) {
|
||||
if (isset($GLOBALS['userlink'])) {
|
||||
$link = $GLOBALS['userlink'];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$str = $link->port()
|
||||
? $link->host() . ':' . $link->port() . ' via TCP/IP'
|
||||
: 'Localhost via UNIX socket';
|
||||
@ -304,16 +308,8 @@ class PMA_DBI_Drizzle implements PMA_DBI_Extension
|
||||
*
|
||||
* @return int version of the Drizzle protocol used
|
||||
*/
|
||||
public function getProtoInfo($link = null)
|
||||
public function getProtoInfo($link)
|
||||
{
|
||||
if (null === $link) {
|
||||
if (isset($GLOBALS['userlink'])) {
|
||||
$link = $GLOBALS['userlink'];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return $link->protocolVersion();
|
||||
}
|
||||
|
||||
@ -334,24 +330,11 @@ class PMA_DBI_Drizzle implements PMA_DBI_Extension
|
||||
*
|
||||
* @return string|bool $error or false
|
||||
*/
|
||||
public function getError($link = null)
|
||||
public function getError($link)
|
||||
{
|
||||
$GLOBALS['errno'] = 0;
|
||||
|
||||
/* Treat false same as null because of controllink */
|
||||
if ($link === false) {
|
||||
$link = null;
|
||||
}
|
||||
|
||||
if (null === $link && isset($GLOBALS['userlink'])) {
|
||||
$link =& $GLOBALS['userlink'];
|
||||
// Do not stop now. We still can get the error code
|
||||
// with mysqli_connect_errno()
|
||||
// } else {
|
||||
// return false;
|
||||
}
|
||||
|
||||
if (null !== $link) {
|
||||
if (null !== $link && false !== $link) {
|
||||
$error_number = drizzle_con_errno($link->getConnectionObject());
|
||||
$error_message = drizzle_con_error($link->getConnectionObject());
|
||||
} else {
|
||||
@ -392,22 +375,11 @@ class PMA_DBI_Drizzle implements PMA_DBI_Extension
|
||||
* @param PMA_DrizzleResult $link connection object
|
||||
* @param bool $get_from_cache whether to retrieve from cache
|
||||
*
|
||||
* @return string|int
|
||||
* @return int
|
||||
*/
|
||||
public function affectedRows($link = null, $get_from_cache = true)
|
||||
public function affectedRows($link)
|
||||
{
|
||||
if (empty($link)) {
|
||||
if (isset($GLOBALS['userlink'])) {
|
||||
$link = $GLOBALS['userlink'];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if ($get_from_cache) {
|
||||
return $GLOBALS['cached_affected_rows'];
|
||||
} else {
|
||||
return $link->affectedRows();
|
||||
}
|
||||
return $link->affectedRows();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -573,27 +545,11 @@ class PMA_DBI_Drizzle implements PMA_DBI_Extension
|
||||
$type = $f->typeDrizzle();
|
||||
$charsetnr = $f->charset();
|
||||
$f = $f->flags();
|
||||
$flags = '';
|
||||
if ($f & DRIZZLE_COLUMN_FLAGS_UNIQUE_KEY) {
|
||||
$flags .= 'unique ';
|
||||
}
|
||||
if ($f & DRIZZLE_COLUMN_FLAGS_NUM) {
|
||||
$flags .= 'num ';
|
||||
}
|
||||
if ($f & DRIZZLE_COLUMN_FLAGS_PART_KEY) {
|
||||
$flags .= 'part_key ';
|
||||
}
|
||||
if ($f & DRIZZLE_COLUMN_FLAGS_SET) {
|
||||
$flags .= 'set ';
|
||||
}
|
||||
if ($f & DRIZZLE_COLUMN_FLAGS_TIMESTAMP) {
|
||||
$flags .= 'timestamp ';
|
||||
}
|
||||
if ($f & DRIZZLE_COLUMN_FLAGS_AUTO_INCREMENT) {
|
||||
$flags .= 'auto_increment ';
|
||||
}
|
||||
if ($f & DRIZZLE_COLUMN_FLAGS_ENUM) {
|
||||
$flags .= 'enum ';
|
||||
$flags = array();
|
||||
foreach ($GLOBALS['pma_drizzle_flag_names'] as $flag => $name) {
|
||||
if ($f & $flag) {
|
||||
$flags[] = $name;
|
||||
}
|
||||
}
|
||||
// See http://dev.mysql.com/doc/refman/6.0/en/c-api-datatypes.html:
|
||||
// to determine if a string is binary, we should not use MYSQLI_BINARY_FLAG
|
||||
@ -605,30 +561,9 @@ class PMA_DBI_Drizzle implements PMA_DBI_Extension
|
||||
|| $type == DRIZZLE_COLUMN_TYPE_DRIZZLE_VARCHAR)
|
||||
&& 63 == $charsetnr
|
||||
) {
|
||||
$flags .= 'binary ';
|
||||
$flags[] = 'binary';
|
||||
}
|
||||
if ($f & DRIZZLE_COLUMN_FLAGS_ZEROFILL) {
|
||||
$flags .= 'zerofill ';
|
||||
}
|
||||
if ($f & DRIZZLE_COLUMN_FLAGS_UNSIGNED) {
|
||||
$flags .= 'unsigned ';
|
||||
}
|
||||
if ($f & DRIZZLE_COLUMN_FLAGS_BLOB) {
|
||||
$flags .= 'blob ';
|
||||
}
|
||||
if ($f & DRIZZLE_COLUMN_FLAGS_MULTIPLE_KEY) {
|
||||
$flags .= 'multiple_key ';
|
||||
}
|
||||
if ($f & DRIZZLE_COLUMN_FLAGS_UNIQUE_KEY) {
|
||||
$flags .= 'unique_key ';
|
||||
}
|
||||
if ($f & DRIZZLE_COLUMN_FLAGS_PRI_KEY) {
|
||||
$flags .= 'primary_key ';
|
||||
}
|
||||
if ($f & DRIZZLE_COLUMN_FLAGS_NOT_NULL) {
|
||||
$flags .= 'not_null ';
|
||||
}
|
||||
return trim($flags);
|
||||
return implode(' ', $flags);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -525,11 +525,11 @@ class PMA_DBI_Dummy implements PMA_DBI_Extension
|
||||
* selects given database
|
||||
*
|
||||
* @param string $dbname name of db to select
|
||||
* @param resource $link mysql link resource
|
||||
* @param object $link mysql link resource
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function selectDb($dbname, $link = null)
|
||||
public function selectDb($dbname, $link)
|
||||
{
|
||||
$GLOBALS['dummy_db'] = $dbname;
|
||||
return true;
|
||||
@ -539,7 +539,7 @@ class PMA_DBI_Dummy implements PMA_DBI_Extension
|
||||
* runs a query and returns the result
|
||||
*
|
||||
* @param string $query query to run
|
||||
* @param resource $link mysql link resource
|
||||
* @param object $link mysql link resource
|
||||
* @param int $options query options
|
||||
*
|
||||
* @return mixed
|
||||
@ -579,7 +579,7 @@ class PMA_DBI_Dummy implements PMA_DBI_Extension
|
||||
/**
|
||||
* returns result data from $result
|
||||
*
|
||||
* @param resource $result result MySQL result
|
||||
* @param object $result result MySQL result
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@ -597,7 +597,7 @@ class PMA_DBI_Dummy implements PMA_DBI_Extension
|
||||
/**
|
||||
* returns array of rows with associative and numeric keys from $result
|
||||
*
|
||||
* @param resource $result result MySQL result
|
||||
* @param object $result result MySQL result
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@ -619,7 +619,7 @@ class PMA_DBI_Dummy implements PMA_DBI_Extension
|
||||
/**
|
||||
* returns array of rows with associative keys from $result
|
||||
*
|
||||
* @param resource $result MySQL result
|
||||
* @param object $result MySQL result
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@ -642,7 +642,7 @@ class PMA_DBI_Dummy implements PMA_DBI_Extension
|
||||
/**
|
||||
* returns array of rows with numeric keys from $result
|
||||
*
|
||||
* @param resource $result MySQL result
|
||||
* @param object $result MySQL result
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@ -655,7 +655,7 @@ class PMA_DBI_Dummy implements PMA_DBI_Extension
|
||||
/**
|
||||
* Adjusts the result pointer to an arbitrary row in the result
|
||||
*
|
||||
* @param resource $result database result
|
||||
* @param object $result database result
|
||||
* @param integer $offset offset to seek
|
||||
*
|
||||
* @return bool true on success, false on failure
|
||||
@ -672,7 +672,7 @@ class PMA_DBI_Dummy implements PMA_DBI_Extension
|
||||
/**
|
||||
* Frees memory associated with the result
|
||||
*
|
||||
* @param resource $result database result
|
||||
* @param object $result database result
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -688,7 +688,7 @@ class PMA_DBI_Dummy implements PMA_DBI_Extension
|
||||
*
|
||||
* @return bool false
|
||||
*/
|
||||
public function moreResults($link = null)
|
||||
public function moreResults($link)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -700,7 +700,7 @@ class PMA_DBI_Dummy implements PMA_DBI_Extension
|
||||
*
|
||||
* @return boolean false
|
||||
*/
|
||||
public function nextResult($link = null)
|
||||
public function nextResult($link)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -722,7 +722,7 @@ class PMA_DBI_Dummy implements PMA_DBI_Extension
|
||||
*
|
||||
* @return string type of connection used
|
||||
*/
|
||||
public function getHostInfo($link = null)
|
||||
public function getHostInfo($link)
|
||||
{
|
||||
return '';
|
||||
}
|
||||
@ -734,7 +734,7 @@ class PMA_DBI_Dummy implements PMA_DBI_Extension
|
||||
*
|
||||
* @return integer version of the MySQL protocol used
|
||||
*/
|
||||
public function getProtoInfo($link = null)
|
||||
public function getProtoInfo($link)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
@ -756,7 +756,7 @@ class PMA_DBI_Dummy implements PMA_DBI_Extension
|
||||
*
|
||||
* @return string|bool $error or false
|
||||
*/
|
||||
public function getError($link = null)
|
||||
public function getError($link)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -764,7 +764,7 @@ class PMA_DBI_Dummy implements PMA_DBI_Extension
|
||||
/**
|
||||
* returns the number of rows returned by last query
|
||||
*
|
||||
* @param resource $result MySQL result
|
||||
* @param object $result MySQL result
|
||||
*
|
||||
* @return string|int
|
||||
*/
|
||||
@ -780,7 +780,7 @@ class PMA_DBI_Dummy implements PMA_DBI_Extension
|
||||
/**
|
||||
* returns the number of rows affected by last query
|
||||
*
|
||||
* @param resource $link the mysql object
|
||||
* @param object $link the mysql object
|
||||
* @param bool $get_from_cache whether to retrieve from cache
|
||||
*
|
||||
* @return string|int
|
||||
@ -805,7 +805,7 @@ class PMA_DBI_Dummy implements PMA_DBI_Extension
|
||||
/**
|
||||
* return number of fields in given $result
|
||||
*
|
||||
* @param resource $result MySQL result
|
||||
* @param object $result MySQL result
|
||||
*
|
||||
* @return int field count
|
||||
*/
|
||||
|
||||
@ -40,7 +40,7 @@ interface PMA_DBI_Extension
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function selectDb($dbname, $link = null);
|
||||
public function selectDb($dbname, $link);
|
||||
|
||||
/**
|
||||
* runs a query and returns the result
|
||||
@ -116,7 +116,7 @@ interface PMA_DBI_Extension
|
||||
*
|
||||
* @return bool true or false
|
||||
*/
|
||||
public function moreResults($link = null);
|
||||
public function moreResults($link);
|
||||
|
||||
/**
|
||||
* Prepare next result from multi_query
|
||||
@ -125,7 +125,7 @@ interface PMA_DBI_Extension
|
||||
*
|
||||
* @return bool true or false
|
||||
*/
|
||||
public function nextResult($link = null);
|
||||
public function nextResult($link);
|
||||
|
||||
/**
|
||||
* Store the result returned from multi query
|
||||
@ -141,7 +141,7 @@ interface PMA_DBI_Extension
|
||||
*
|
||||
* @return string type of connection used
|
||||
*/
|
||||
public function getHostInfo($link = null);
|
||||
public function getHostInfo($link);
|
||||
|
||||
/**
|
||||
* Returns the version of the MySQL protocol used
|
||||
@ -150,7 +150,7 @@ interface PMA_DBI_Extension
|
||||
*
|
||||
* @return integer version of the MySQL protocol used
|
||||
*/
|
||||
public function getProtoInfo($link = null);
|
||||
public function getProtoInfo($link);
|
||||
|
||||
/**
|
||||
* returns a string that represents the client library version
|
||||
@ -166,7 +166,7 @@ interface PMA_DBI_Extension
|
||||
*
|
||||
* @return string|bool $error or false
|
||||
*/
|
||||
public function getError($link = null);
|
||||
public function getError($link);
|
||||
|
||||
/**
|
||||
* returns the number of rows returned by last query
|
||||
@ -180,12 +180,11 @@ interface PMA_DBI_Extension
|
||||
/**
|
||||
* returns the number of rows affected by last query
|
||||
*
|
||||
* @param object $link the connection object
|
||||
* @param bool $get_from_cache whether to retrieve from cache
|
||||
* @param object $link the connection object
|
||||
*
|
||||
* @return string|int
|
||||
* @return int
|
||||
*/
|
||||
public function affectedRows($link = null, $get_from_cache = true);
|
||||
public function affectedRows($link);
|
||||
|
||||
/**
|
||||
* returns metainfo for fields in $result
|
||||
|
||||
@ -10,7 +10,6 @@ if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once './libraries/logging.lib.php';
|
||||
require_once './libraries/dbi/DBIExtension.int.php';
|
||||
|
||||
/**
|
||||
@ -159,19 +158,12 @@ class PMA_DBI_Mysql implements PMA_DBI_Extension
|
||||
* selects given database
|
||||
*
|
||||
* @param string $dbname name of db to select
|
||||
* @param resource $link mysql link resource
|
||||
* @param object $link mysql link resource
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function selectDb($dbname, $link = null)
|
||||
public function selectDb($dbname, $link)
|
||||
{
|
||||
if (empty($link)) {
|
||||
if (isset($GLOBALS['userlink'])) {
|
||||
$link = $GLOBALS['userlink'];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return mysql_select_db($dbname, $link);
|
||||
}
|
||||
|
||||
@ -179,7 +171,7 @@ class PMA_DBI_Mysql implements PMA_DBI_Extension
|
||||
* runs a query and returns the result
|
||||
*
|
||||
* @param string $query query to run
|
||||
* @param resource $link mysql link resource
|
||||
* @param object $link mysql link resource
|
||||
* @param int $options query options
|
||||
*
|
||||
* @return mixed
|
||||
@ -198,7 +190,7 @@ class PMA_DBI_Mysql implements PMA_DBI_Extension
|
||||
/**
|
||||
* returns array of rows with associative and numeric keys from $result
|
||||
*
|
||||
* @param resource $result result MySQL result
|
||||
* @param object $result result MySQL result
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@ -210,7 +202,7 @@ class PMA_DBI_Mysql implements PMA_DBI_Extension
|
||||
/**
|
||||
* returns array of rows with associative keys from $result
|
||||
*
|
||||
* @param resource $result MySQL result
|
||||
* @param object $result MySQL result
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@ -222,7 +214,7 @@ class PMA_DBI_Mysql implements PMA_DBI_Extension
|
||||
/**
|
||||
* returns array of rows with numeric keys from $result
|
||||
*
|
||||
* @param resource $result MySQL result
|
||||
* @param object $result MySQL result
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@ -234,7 +226,7 @@ class PMA_DBI_Mysql implements PMA_DBI_Extension
|
||||
/**
|
||||
* Adjusts the result pointer to an arbitrary row in the result
|
||||
*
|
||||
* @param resource $result database result
|
||||
* @param object $result database result
|
||||
* @param integer $offset offset to seek
|
||||
*
|
||||
* @return bool true on success, false on failure
|
||||
@ -247,7 +239,7 @@ class PMA_DBI_Mysql implements PMA_DBI_Extension
|
||||
/**
|
||||
* Frees memory associated with the result
|
||||
*
|
||||
* @param resource $result database result
|
||||
* @param object $result database result
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -265,7 +257,7 @@ class PMA_DBI_Mysql implements PMA_DBI_Extension
|
||||
*
|
||||
* @return bool false
|
||||
*/
|
||||
public function moreResults($link = null)
|
||||
public function moreResults($link)
|
||||
{
|
||||
// N.B.: PHP's 'mysql' extension does not support
|
||||
// multi_queries so this function will always
|
||||
@ -281,7 +273,7 @@ class PMA_DBI_Mysql implements PMA_DBI_Extension
|
||||
*
|
||||
* @return boolean false
|
||||
*/
|
||||
public function nextResult($link = null)
|
||||
public function nextResult($link)
|
||||
{
|
||||
// N.B.: PHP's 'mysql' extension does not support
|
||||
// multi_queries so this function will always
|
||||
@ -293,38 +285,24 @@ class PMA_DBI_Mysql implements PMA_DBI_Extension
|
||||
/**
|
||||
* Returns a string representing the type of connection used
|
||||
*
|
||||
* @param resource $link mysql link
|
||||
* @param object $link mysql link
|
||||
*
|
||||
* @return string type of connection used
|
||||
*/
|
||||
public function getHostInfo($link = null)
|
||||
public function getHostInfo($link)
|
||||
{
|
||||
if (null === $link) {
|
||||
if (isset($GLOBALS['userlink'])) {
|
||||
$link = $GLOBALS['userlink'];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return mysql_get_host_info($link);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the version of the MySQL protocol used
|
||||
*
|
||||
* @param resource $link mysql link
|
||||
* @param object $link mysql link
|
||||
*
|
||||
* @return int version of the MySQL protocol used
|
||||
*/
|
||||
public function getProtoInfo($link = null)
|
||||
public function getProtoInfo($link)
|
||||
{
|
||||
if (null === $link) {
|
||||
if (isset($GLOBALS['userlink'])) {
|
||||
$link = $GLOBALS['userlink'];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return mysql_get_proto_info($link);
|
||||
}
|
||||
|
||||
@ -341,28 +319,14 @@ class PMA_DBI_Mysql implements PMA_DBI_Extension
|
||||
/**
|
||||
* returns last error message or false if no errors occurred
|
||||
*
|
||||
* @param resource $link mysql link
|
||||
* @param object $link mysql link
|
||||
*
|
||||
* @return string|bool $error or false
|
||||
*/
|
||||
public function getError($link = null)
|
||||
public function getError($link)
|
||||
{
|
||||
$GLOBALS['errno'] = 0;
|
||||
|
||||
/* Treat false same as null because of controllink */
|
||||
if ($link === false) {
|
||||
$link = null;
|
||||
}
|
||||
|
||||
if (null === $link && isset($GLOBALS['userlink'])) {
|
||||
$link =& $GLOBALS['userlink'];
|
||||
|
||||
// Do not stop now. On the initial connection, we don't have a $link,
|
||||
// we don't have a $GLOBALS['userlink'], but we can catch the error code
|
||||
// } else {
|
||||
// return false;
|
||||
}
|
||||
|
||||
if (null !== $link && false !== $link) {
|
||||
$error_number = mysql_errno($link);
|
||||
$error_message = mysql_error($link);
|
||||
@ -384,7 +348,7 @@ class PMA_DBI_Mysql implements PMA_DBI_Extension
|
||||
/**
|
||||
* returns the number of rows returned by last query
|
||||
*
|
||||
* @param resource $result MySQL result
|
||||
* @param object $result MySQL result
|
||||
*
|
||||
* @return string|int
|
||||
*/
|
||||
@ -400,32 +364,19 @@ class PMA_DBI_Mysql implements PMA_DBI_Extension
|
||||
/**
|
||||
* returns the number of rows affected by last query
|
||||
*
|
||||
* @param resource $link the mysql object
|
||||
* @param bool $get_from_cache whether to retrieve from cache
|
||||
* @param object $link the mysql object
|
||||
*
|
||||
* @return string|int
|
||||
* @return int
|
||||
*/
|
||||
public function affectedRows($link = null, $get_from_cache = true)
|
||||
public function affectedRows($link)
|
||||
{
|
||||
if (empty($link)) {
|
||||
if (isset($GLOBALS['userlink'])) {
|
||||
$link = $GLOBALS['userlink'];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($get_from_cache) {
|
||||
return $GLOBALS['cached_affected_rows'];
|
||||
} else {
|
||||
return mysql_affected_rows($link);
|
||||
}
|
||||
return mysql_affected_rows($link);
|
||||
}
|
||||
|
||||
/**
|
||||
* returns metainfo for fields in $result
|
||||
*
|
||||
* @param resource $result MySQL result
|
||||
* @param object $result MySQL result
|
||||
*
|
||||
* @return array meta info for fields in $result
|
||||
*
|
||||
@ -448,7 +399,7 @@ class PMA_DBI_Mysql implements PMA_DBI_Extension
|
||||
/**
|
||||
* return number of fields in given $result
|
||||
*
|
||||
* @param resource $result MySQL result
|
||||
* @param object $result MySQL result
|
||||
*
|
||||
* @return int field count
|
||||
*/
|
||||
@ -460,7 +411,7 @@ class PMA_DBI_Mysql implements PMA_DBI_Extension
|
||||
/**
|
||||
* returns the length of the given field $i in $result
|
||||
*
|
||||
* @param resource $result MySQL result
|
||||
* @param object $result MySQL result
|
||||
* @param int $i field
|
||||
*
|
||||
* @return int length of field
|
||||
@ -473,7 +424,7 @@ class PMA_DBI_Mysql implements PMA_DBI_Extension
|
||||
/**
|
||||
* returns name of $i. field in $result
|
||||
*
|
||||
* @param resource $result MySQL result
|
||||
* @param object $result MySQL result
|
||||
* @param int $i field
|
||||
*
|
||||
* @return string name of $i. field in $result
|
||||
@ -486,7 +437,7 @@ class PMA_DBI_Mysql implements PMA_DBI_Extension
|
||||
/**
|
||||
* returns concatenated string of human readable field flags
|
||||
*
|
||||
* @param resource $result MySQL result
|
||||
* @param object $result MySQL result
|
||||
* @param int $i field
|
||||
*
|
||||
* @return string field flags
|
||||
|
||||
@ -10,7 +10,6 @@ if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
require_once './libraries/logging.lib.php';
|
||||
require_once './libraries/dbi/DBIExtension.int.php';
|
||||
|
||||
/**
|
||||
@ -49,7 +48,7 @@ if (! defined('MYSQLI_TYPE_VARCHAR')) {
|
||||
/**
|
||||
* Names of field flags.
|
||||
*/
|
||||
$pma_flag_names = array(
|
||||
$pma_mysqli_flag_names = array(
|
||||
MYSQLI_UNIQUE_KEY_FLAG => 'unique',
|
||||
MYSQLI_NUM_FLAG => 'num',
|
||||
MYSQLI_PART_KEY_FLAG => 'part_key',
|
||||
@ -218,6 +217,10 @@ class PMA_DBI_Mysqli implements PMA_DBI_Extension
|
||||
);
|
||||
}
|
||||
|
||||
if ($return_value === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $link;
|
||||
}
|
||||
|
||||
@ -229,15 +232,8 @@ class PMA_DBI_Mysqli implements PMA_DBI_Extension
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function selectDb($dbname, $link = null)
|
||||
public function selectDb($dbname, $link)
|
||||
{
|
||||
if (empty($link)) {
|
||||
if (isset($GLOBALS['userlink'])) {
|
||||
$link = $GLOBALS['userlink'];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return mysqli_select_db($link, $dbname);
|
||||
}
|
||||
|
||||
@ -346,15 +342,8 @@ class PMA_DBI_Mysqli implements PMA_DBI_Extension
|
||||
*
|
||||
* @return bool true or false
|
||||
*/
|
||||
public function moreResults($link = null)
|
||||
public function moreResults($link)
|
||||
{
|
||||
if (empty($link)) {
|
||||
if (isset($GLOBALS['userlink'])) {
|
||||
$link = $GLOBALS['userlink'];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return mysqli_more_results($link);
|
||||
}
|
||||
|
||||
@ -365,15 +354,8 @@ class PMA_DBI_Mysqli implements PMA_DBI_Extension
|
||||
*
|
||||
* @return bool true or false
|
||||
*/
|
||||
public function nextResult($link = null)
|
||||
public function nextResult($link)
|
||||
{
|
||||
if (empty($link)) {
|
||||
if (isset($GLOBALS['userlink'])) {
|
||||
$link = $GLOBALS['userlink'];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return mysqli_next_result($link);
|
||||
}
|
||||
|
||||
@ -384,11 +366,6 @@ class PMA_DBI_Mysqli implements PMA_DBI_Extension
|
||||
*/
|
||||
public function storeResult()
|
||||
{
|
||||
if (isset($GLOBALS['userlink'])) {
|
||||
$link = $GLOBALS['userlink'];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
return mysqli_store_result($link);
|
||||
}
|
||||
|
||||
@ -399,15 +376,8 @@ class PMA_DBI_Mysqli implements PMA_DBI_Extension
|
||||
*
|
||||
* @return string type of connection used
|
||||
*/
|
||||
public function getHostInfo($link = null)
|
||||
public function getHostInfo($link)
|
||||
{
|
||||
if (null === $link) {
|
||||
if (isset($GLOBALS['userlink'])) {
|
||||
$link = $GLOBALS['userlink'];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return mysqli_get_host_info($link);
|
||||
}
|
||||
|
||||
@ -418,15 +388,8 @@ class PMA_DBI_Mysqli implements PMA_DBI_Extension
|
||||
*
|
||||
* @return integer version of the MySQL protocol used
|
||||
*/
|
||||
public function getProtoInfo($link = null)
|
||||
public function getProtoInfo($link)
|
||||
{
|
||||
if (null === $link) {
|
||||
if (isset($GLOBALS['userlink'])) {
|
||||
$link = $GLOBALS['userlink'];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return mysqli_get_proto_info($link);
|
||||
}
|
||||
|
||||
@ -447,22 +410,11 @@ class PMA_DBI_Mysqli implements PMA_DBI_Extension
|
||||
*
|
||||
* @return string|bool $error or false
|
||||
*/
|
||||
public function getError($link = null)
|
||||
public function getError($link)
|
||||
{
|
||||
$GLOBALS['errno'] = 0;
|
||||
|
||||
/* Treat false same as null because of controllink */
|
||||
if ($link === false) {
|
||||
$link = null;
|
||||
}
|
||||
|
||||
if (null === $link && isset($GLOBALS['userlink'])) {
|
||||
$link =& $GLOBALS['userlink'];
|
||||
// Do not stop now. We still can get the error code
|
||||
// with mysqli_connect_errno()
|
||||
}
|
||||
|
||||
if (null !== $link) {
|
||||
if (null !== $link && false !== $link) {
|
||||
$error_number = mysqli_errno($link);
|
||||
$error_message = mysqli_error($link);
|
||||
} else {
|
||||
@ -500,25 +452,13 @@ class PMA_DBI_Mysqli implements PMA_DBI_Extension
|
||||
/**
|
||||
* returns the number of rows affected by last query
|
||||
*
|
||||
* @param mysqli $link the mysqli object
|
||||
* @param bool $get_from_cache whether to retrieve from cache
|
||||
* @param mysqli $link the mysqli object
|
||||
*
|
||||
* @return string|int
|
||||
* @return int
|
||||
*/
|
||||
public function affectedRows($link = null, $get_from_cache = true)
|
||||
public function affectedRows($link)
|
||||
{
|
||||
if (empty($link)) {
|
||||
if (isset($GLOBALS['userlink'])) {
|
||||
$link = $GLOBALS['userlink'];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if ($get_from_cache) {
|
||||
return $GLOBALS['cached_affected_rows'];
|
||||
} else {
|
||||
return mysqli_affected_rows($link);
|
||||
}
|
||||
return mysqli_affected_rows($link);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -655,7 +595,7 @@ class PMA_DBI_Mysqli implements PMA_DBI_Extension
|
||||
$charsetnr = $f->charsetnr;
|
||||
$f = $f->flags;
|
||||
$flags = array();
|
||||
foreach ($GLOBALS['pma_flag_names'] as $flag => $name) {
|
||||
foreach ($GLOBALS['pma_mysqli_flag_names'] as $flag => $name) {
|
||||
if ($f & $flag) {
|
||||
$flags[] = $name;
|
||||
}
|
||||
|
||||
@ -47,5 +47,31 @@ abstract class AuthenticationPlugin extends PluginObserver
|
||||
* @return boolean
|
||||
*/
|
||||
abstract public function authFails();
|
||||
|
||||
/**
|
||||
* Returns error message for failed authentication.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getErrorMessage()
|
||||
{
|
||||
if (! empty($GLOBALS['login_without_password_is_forbidden'])) {
|
||||
return __(
|
||||
'Login without a password is forbidden by configuration'
|
||||
. ' (see AllowNoPassword)'
|
||||
);
|
||||
} elseif (! empty($GLOBALS['allowDeny_forbidden'])) {
|
||||
return __('Access denied!');
|
||||
} elseif (! empty($GLOBALS['no_activity'])) {
|
||||
return sprintf(
|
||||
__('No activity within %s seconds; please log in again.'),
|
||||
$GLOBALS['cfg']['LoginCookieValidity']
|
||||
);
|
||||
} elseif ($GLOBALS['dbi']->getError()) {
|
||||
return PMA_sanitize($GLOBALS['dbi']->getError());
|
||||
} else {
|
||||
return __('Cannot log in to the MySQL server');
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
||||
@ -482,11 +482,11 @@ class AuthenticationCookie extends AuthenticationPlugin
|
||||
$last_access_time = time() - $GLOBALS['cfg']['LoginCookieValidity'];
|
||||
if ($_SESSION['last_access_time'] < $last_access_time
|
||||
) {
|
||||
PMA_Util::cacheUnset('is_create_db_priv', true);
|
||||
PMA_Util::cacheUnset('is_process_priv', true);
|
||||
PMA_Util::cacheUnset('is_reload_priv', true);
|
||||
PMA_Util::cacheUnset('db_to_create', true);
|
||||
PMA_Util::cacheUnset('dbs_where_create_table_allowed', true);
|
||||
PMA_Util::cacheUnset('is_create_db_priv');
|
||||
PMA_Util::cacheUnset('is_process_priv');
|
||||
PMA_Util::cacheUnset('is_reload_priv');
|
||||
PMA_Util::cacheUnset('db_to_create');
|
||||
PMA_Util::cacheUnset('dbs_where_create_table_allowed');
|
||||
$GLOBALS['no_activity'] = true;
|
||||
$this->authFails();
|
||||
if (! defined('TESTSUITE')) {
|
||||
@ -669,24 +669,7 @@ class AuthenticationCookie extends AuthenticationPlugin
|
||||
// Deletes password cookie and displays the login form
|
||||
$GLOBALS['PMA_Config']->removeCookie('pmaPass-' . $GLOBALS['server']);
|
||||
|
||||
if (! empty($GLOBALS['login_without_password_is_forbidden'])) {
|
||||
$conn_error = __(
|
||||
'Login without a password is forbidden by configuration'
|
||||
. ' (see AllowNoPassword)'
|
||||
);
|
||||
} elseif (! empty($GLOBALS['allowDeny_forbidden'])) {
|
||||
$conn_error = __('Access denied!');
|
||||
} elseif (! empty($GLOBALS['no_activity'])) {
|
||||
$conn_error = sprintf(
|
||||
__('No activity within %s seconds; please log in again.'),
|
||||
$GLOBALS['cfg']['LoginCookieValidity']
|
||||
);
|
||||
} elseif ($GLOBALS['dbi']->getError()) {
|
||||
$conn_error = '#' . $GLOBALS['errno'] . ' '
|
||||
. __('Cannot log in to the MySQL server');
|
||||
} else {
|
||||
$conn_error = __('Cannot log in to the MySQL server');
|
||||
}
|
||||
$conn_error = $this->getErrorMessage();
|
||||
|
||||
// needed for PHP-CGI (not need for FastCGI or mod-php)
|
||||
header('Cache-Control: no-store, no-cache, must-revalidate');
|
||||
|
||||
@ -261,27 +261,7 @@ class AuthenticationSignon extends AuthenticationPlugin
|
||||
}
|
||||
|
||||
/* Set error message */
|
||||
if (! empty($GLOBALS['login_without_password_is_forbidden'])) {
|
||||
$_SESSION['PMA_single_signon_error_message'] = __(
|
||||
'Login without a password is forbidden by configuration '
|
||||
. '(see AllowNoPassword)'
|
||||
);
|
||||
} elseif (! empty($GLOBALS['allowDeny_forbidden'])) {
|
||||
$_SESSION['PMA_single_signon_error_message'] = __('Access denied!');
|
||||
} elseif (! empty($GLOBALS['no_activity'])) {
|
||||
$_SESSION['PMA_single_signon_error_message'] = sprintf(
|
||||
__('No activity within %s seconds; please log in again.'),
|
||||
$GLOBALS['cfg']['LoginCookieValidity']
|
||||
);
|
||||
} elseif ($GLOBALS['dbi']->getError()) {
|
||||
$_SESSION['PMA_single_signon_error_message'] = PMA_sanitize(
|
||||
$GLOBALS['dbi']->getError()
|
||||
);
|
||||
} else {
|
||||
$_SESSION['PMA_single_signon_error_message'] = __(
|
||||
'Cannot log in to the MySQL server'
|
||||
);
|
||||
}
|
||||
$_SESSION['PMA_single_signon_error_message'] = $this->getErrorMessage();
|
||||
}
|
||||
$this->auth();
|
||||
}
|
||||
|
||||
1384
po/be@latin.po
1384
po/be@latin.po
File diff suppressed because it is too large
Load Diff
1533
po/en_GB.po
1533
po/en_GB.po
File diff suppressed because it is too large
Load Diff
1339
po/phpmyadmin.pot
1339
po/phpmyadmin.pot
File diff suppressed because it is too large
Load Diff
1491
po/pt_BR.po
1491
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
1405
po/sr@latin.po
1405
po/sr@latin.po
File diff suppressed because it is too large
Load Diff
1490
po/uz@latin.po
1490
po/uz@latin.po
File diff suppressed because it is too large
Load Diff
1461
po/zh_CN.po
1461
po/zh_CN.po
File diff suppressed because it is too large
Load Diff
1406
po/zh_TW.po
1406
po/zh_TW.po
File diff suppressed because it is too large
Load Diff
@ -76,13 +76,6 @@ class PMA_DBI_Drizzle_Test extends PHPUnit_Framework_TestCase
|
||||
$_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
|
||||
$_SESSION['PMA_Theme'] = new PMA_Theme();
|
||||
|
||||
//Mock DBI, just for postConnect usage
|
||||
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$GLOBALS['dbi'] = $dbi;
|
||||
|
||||
$this->object = new PMA_DBI_Drizzle();
|
||||
}
|
||||
|
||||
@ -121,13 +114,14 @@ class PMA_DBI_Drizzle_Test extends PHPUnit_Framework_TestCase
|
||||
*
|
||||
* @group medium
|
||||
*/
|
||||
public function testrSelectDb()
|
||||
public function testSelectDb()
|
||||
{
|
||||
$this->markTestIncomplete('Not testing anything');
|
||||
//$link is empty
|
||||
$GLOBALS['userlink'] = null;
|
||||
$this->assertEquals(
|
||||
false,
|
||||
$this->object->selectDb("PMA")
|
||||
$this->object->selectDb("PMA", null)
|
||||
);
|
||||
}
|
||||
|
||||
@ -143,12 +137,12 @@ class PMA_DBI_Drizzle_Test extends PHPUnit_Framework_TestCase
|
||||
//PHP's 'mysql' extension does not support multi_queries
|
||||
$this->assertEquals(
|
||||
false,
|
||||
$this->object->moreResults()
|
||||
$this->object->moreResults(null)
|
||||
);
|
||||
//PHP's 'mysql' extension does not support multi_queries
|
||||
$this->assertEquals(
|
||||
false,
|
||||
$this->object->nextResult()
|
||||
$this->object->nextResult(null)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -252,11 +252,12 @@ class PMA_DBI_Mysql_Test extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testSelectDb()
|
||||
{
|
||||
$this->markTestIncomplete('Not testing anything');
|
||||
//$link is empty
|
||||
$GLOBALS['userlink'] = null;
|
||||
$this->assertEquals(
|
||||
false,
|
||||
$this->object->selectDb("PMA")
|
||||
$this->object->selectDb("PMA", null)
|
||||
);
|
||||
}
|
||||
|
||||
@ -272,12 +273,12 @@ class PMA_DBI_Mysql_Test extends PHPUnit_Framework_TestCase
|
||||
//PHP's 'mysql' extension does not support multi_queries
|
||||
$this->assertEquals(
|
||||
false,
|
||||
$this->object->moreResults()
|
||||
$this->object->moreResults(null)
|
||||
);
|
||||
//PHP's 'mysql' extension does not support multi_queries
|
||||
$this->assertEquals(
|
||||
false,
|
||||
$this->object->nextResult()
|
||||
$this->object->nextResult(null)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -50,13 +50,6 @@ class PMA_DBI_Mysqli_Test extends PHPUnit_Framework_TestCase
|
||||
$_SESSION['PMA_Theme'] = PMA_Theme::load('./themes/pmahomme');
|
||||
$_SESSION['PMA_Theme'] = new PMA_Theme();
|
||||
$this->object = new PMA_DBI_Mysqli();
|
||||
|
||||
//Mock DBI, just for postConnect usage
|
||||
$dbi = $this->getMockBuilder('PMA_DatabaseInterface')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$GLOBALS['dbi'] = $dbi;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -237,11 +230,12 @@ class PMA_DBI_Mysqli_Test extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testSelectDb()
|
||||
{
|
||||
$this->markTestIncomplete('Not testing anything');
|
||||
//$link is empty
|
||||
$GLOBALS['userlink'] = null;
|
||||
$this->assertEquals(
|
||||
false,
|
||||
$this->object->selectDb("PMA")
|
||||
$this->object->selectDb("PMA", null)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -45,6 +45,7 @@ class PMA_ConfigGenerator_Test extends PHPUnit_Framework_TestCase
|
||||
|
||||
$cf->setPersistKeys(array("1/", 2));
|
||||
|
||||
/* TODO: This is sometimes one second off... */
|
||||
$date = date(DATE_RFC1123);
|
||||
$result = ConfigGenerator::getConfigFile($cf);
|
||||
|
||||
|
||||
@ -101,9 +101,9 @@ class PMA_Cache_Test extends PHPUnit_Framework_TestCase
|
||||
PMA_Util::cacheSet('test_data', 25);
|
||||
PMA_Util::cacheSet('test_data_2', 25);
|
||||
|
||||
PMA_Util::cacheUnset('test_data', true);
|
||||
PMA_Util::cacheUnset('test_data');
|
||||
$this->assertArrayNotHasKey('test_data', $_SESSION['cache']['server_server']);
|
||||
PMA_Util::cacheUnset('test_data_2', true);
|
||||
PMA_Util::cacheUnset('test_data_2');
|
||||
$this->assertArrayNotHasKey('test_data_2', $_SESSION['cache']['server_server']);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user