Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2016-01-05 08:23:16 +01:00
commit e23ad2e57d
6 changed files with 32 additions and 33 deletions

View File

@ -46,6 +46,7 @@ phpMyAdmin - ChangeLog
- issue Undefined index: host
- issue #11810 'Add to central columns' (per column button) does nothing
- issue #11727 SQL duplicate entry error trying to INSERT in designer_settings table
- issue #11798 Fix handling of databases with dot in a name
4.5.3.1 (2015-12-25)
- issue #11774 Undefined offset 2

View File

@ -93,8 +93,8 @@ class DatabaseInterface
/**
* Get a cached value from table cache.
*
* @param string $contentPath Dot notation of the target value
* @param mixed $default Return value on cache miss
* @param array $contentPath Array of the name of the target value
* @param mixed $default Return value on cache miss
*
* @return mixed cached value or default
*/
@ -106,8 +106,8 @@ class DatabaseInterface
/**
* Set an item in table cache using dot notation.
*
* @param string $contentPath Dot notation of the target path
* @param mixed $value Target value
* @param array $contentPath Array with the target path
* @param mixed $value Target value
*
* @return void
*/
@ -120,10 +120,8 @@ class DatabaseInterface
return;
}
$keys = explode('.', $contentPath);
while (count($keys) > 1) {
$key = array_shift($keys);
while (count($contentPath) > 1) {
$key = array_shift($contentPath);
// If the key doesn't exist at this depth, we will just create an empty
// array to hold the next value, allowing us to create the arrays to hold
@ -135,7 +133,7 @@ class DatabaseInterface
$loc = &$loc[$key];
}
$loc[array_shift($keys)] = $value;
$loc[array_shift($contentPath)] = $value;
}
/**

View File

@ -174,7 +174,7 @@ class Table
}
// use cached data or load information with SHOW command
if ($this->_dbi->getCachedTableContent("${db}.${table}") != null
if ($this->_dbi->getCachedTableContent(array($db, $table)) != null
|| $GLOBALS['cfg']['Server']['DisableIS']
) {
$type = $this->getStatusInfo('TABLE_TYPE');
@ -319,14 +319,14 @@ class Table
// sometimes there is only one entry (ExactRows) so
// we have to get the table's details
if ($this->_dbi->getCachedTableContent("${db}.${table}") == null
if ($this->_dbi->getCachedTableContent(array($db, $table)) == null
|| $force_read
|| count($this->_dbi->getCachedTableContent("${db}.${table}")) == 1
|| count($this->_dbi->getCachedTableContent(array($db, $table))) == 1
) {
$this->_dbi->getTablesFull($db, $table);
}
if ($this->_dbi->getCachedTableContent("${db}.${table}") == null) {
if ($this->_dbi->getCachedTableContent(array($db, $table)) == null) {
// happens when we enter the table creation dialog
// or when we really did not get any status info, for example
// when $table == 'TABLE_NAMES' after the user tried SHOW TABLES
@ -334,12 +334,12 @@ class Table
}
if (null === $info) {
return $this->_dbi->getCachedTableContent("${db}.${table}");
return $this->_dbi->getCachedTableContent(array($db, $table));
}
// array_key_exists allows for null values
if (!array_key_exists(
$info, $this->_dbi->getCachedTableContent("${db}.${table}")
$info, $this->_dbi->getCachedTableContent(array($db, $table))
)
) {
if (! $disable_error) {
@ -351,7 +351,7 @@ class Table
return false;
}
return $this->_dbi->getCachedTableContent("${db}.${table}.${info}");
return $this->_dbi->getCachedTableContent(array($db, $table, $info));
}
/**
@ -500,29 +500,29 @@ class Table
$db = $this->_db_name;
$table = $this->_name;
if ($this->_dbi->getCachedTableContent("${db}.${table}.ExactRows") != null) {
if ($this->_dbi->getCachedTableContent(array($db, $table, 'ExactRows')) != null) {
$row_count = $this->_dbi->getCachedTableContent(
"${db}.${table}.ExactRows"
array($db, $table, 'ExactRows')
);
return $row_count;
}
$row_count = false;
if (! $force_exact) {
if (($this->_dbi->getCachedTableContent("${db}.${table}.Rows") == null)
if (($this->_dbi->getCachedTableContent(array($db, $table, 'Rows')) == null)
&& !$is_view
) {
$tmp_tables = $this->_dbi->getTablesFull($db, $table);
if (isset($tmp_tables[$table])) {
$this->_dbi->cacheTableContent(
"${db}.${table}",
array($db, $table),
$tmp_tables[$table]
);
}
}
if ($this->_dbi->getCachedTableContent("${db}.${table}.Rows") != null) {
if ($this->_dbi->getCachedTableContent(array($db, $table, 'Rows')) != null) {
$row_count = $this->_dbi->getCachedTableContent(
"${db}.${table}.Rows"
array($db, $table, 'Rows')
);
} else {
$row_count = false;
@ -567,7 +567,7 @@ class Table
}
}
if ($row_count) {
$this->_dbi->cacheTableContent("${db}.${table}.ExactRows", $row_count);
$this->_dbi->cacheTableContent(array($db, $table, 'ExactRows'), $row_count);
}
return $row_count;

View File

@ -57,7 +57,7 @@ if (empty($is_table)
// Not a valid table name -> back to the db_sql.php
if (mb_strlen($table)) {
$is_table = $GLOBALS['dbi']->getCachedTableContent("${db}.${table}", false);
$is_table = $GLOBALS['dbi']->getCachedTableContent(array($db, $table), false);
if (! $is_table) {
$_result = $GLOBALS['dbi']->tryQuery(

View File

@ -595,8 +595,8 @@ class TableTest extends PMATestCase
public function testIsMergeCase2()
{
$map = array(
array('PMA.PMA_BookMark', null, array('ENGINE' => "MERGE")),
array('PMA.PMA_BookMark.ENGINE', null, "MERGE")
array(array('PMA', 'PMA_BookMark'), null, array('ENGINE' => "MERGE")),
array(array('PMA', 'PMA_BookMark', 'ENGINE'), null, "MERGE")
);
$GLOBALS['dbi']->expects($this->any())
->method('getCachedTableContent')
@ -617,8 +617,8 @@ class TableTest extends PMATestCase
public function testIsMergeCase3()
{
$map = array(
array('PMA.PMA_BookMark', null, array('ENGINE' => "MRG_MYISAM")),
array('PMA.PMA_BookMark.ENGINE', null, "MRG_MYISAM")
array(array('PMA', 'PMA_BookMark'), null, array('ENGINE' => "MRG_MYISAM")),
array(array('PMA', 'PMA_BookMark', 'ENGINE'), null, "MRG_MYISAM")
);
$GLOBALS['dbi']->expects($this->any())
->method('getCachedTableContent')
@ -639,8 +639,8 @@ class TableTest extends PMATestCase
public function testIsMergeCase4()
{
$map = array(
array('PMA.PMA_BookMark', null, array('ENGINE' => "ISDB")),
array('PMA.PMA_BookMark.ENGINE', null, "ISDB")
array(array('PMA', 'PMA_BookMark'), null, array('ENGINE' => "ISDB")),
array(array('PMA', 'PMA_BookMark', 'ENGINE'), null, "ISDB")
);
$GLOBALS['dbi']->expects($this->any())
->method('getCachedTableContent')
@ -956,11 +956,11 @@ class TableTest extends PMATestCase
{
$map = array(
array(
'PMA.PMA_BookMark',
array('PMA', 'PMA_BookMark'),
null,
array('Comment' => "Comment222", 'TABLE_TYPE' => "VIEW"),
),
array('PMA.PMA_BookMark.TABLE_TYPE', null, 'VIEW'),
array(array('PMA', 'PMA_BookMark', 'TABLE_TYPE'), null, 'VIEW'),
);
$GLOBALS['dbi']->expects($this->any())
->method('getCachedTableContent')

View File

@ -138,7 +138,7 @@ class PMA_DisplayExport_Test extends PHPUnit_Framework_TestCase
$num_tables_str = "10";
$unlim_num_rows_str = "unlim_num_rows_str";
$single_table = "single_table";
$GLOBALS['dbi']->cacheTableContent("${db}.${table}.ENGINE", 'MERGE');
$GLOBALS['dbi']->cacheTableContent(array($db, $table, 'ENGINE'), 'MERGE');
$columns_info = array(
'test_column1' => array(