Merge commit '6d890c362698ca74b9aa5c928923c5f8aa22267b' into QA_4_0

Conflicts:
	ChangeLog
This commit is contained in:
Michal Čihař 2013-05-21 13:59:29 +02:00
commit a638fc863e
7 changed files with 2 additions and 263 deletions

View File

@ -19,6 +19,7 @@ phpMyAdmin - ChangeLog
- bug #3924 Show warning when CSV file does not contain data for all columns
- bug #3947 Missing Sql Query after modify structure
- bug #3948 Server export problems
- bug #3917 CountTables directive is deprecated
4.0.1.0 (2013-05-14)
- bug #3879 Import broken for CSV using LOAD DATA

View File

@ -915,14 +915,6 @@ Server connection settings
* ``'SELECT SCHEMA_NAME FROM information_schema.SCHEMATA'``
* ``false``
.. config:option:: $cfg['Servers'][$i]['CountTables']
:type: boolean
:default: false
Whether to count the number of tables for each database when preparing
the list of databases for the navigation panel.
.. config:option:: $cfg['Servers'][$i]['SignonScript']
:type: string

View File

@ -229,200 +229,6 @@ class PMA_List_Database extends PMA_List
return $this->getEmpty();
}
/**
* returns array with dbs grouped with extended infos
*
* @param integer $offset
* @param integer $count
*
* @return array db list
*/
public function getGroupedDetails($offset, $count)
{
$dbgroups = array();
if ($GLOBALS['cfg']['ShowTooltip']
&& $GLOBALS['cfgRelation']['commwork']
) {
$db_tooltips = PMA_getDbComments();
}
if (!$GLOBALS['cfg']['NavigationTreeEnableGrouping']) {
$separators = array();
} elseif (is_array($GLOBALS['cfg']['NavigationTreeDbSeparator'])) {
$separators = $GLOBALS['cfg']['NavigationTreeDbSeparator'];
} elseif (!empty($GLOBALS['cfg']['NavigationTreeDbSeparator'])) {
$separators = array($GLOBALS['cfg']['NavigationTreeDbSeparator']);
} else {
$separators = array();
}
foreach ($this->getLimitedItems($offset, $count) as $db) {
// Get comments from PMA comments table
$db_tooltip = '';
if (isset($db_tooltips[$db])) {
$db_tooltip = $db_tooltips[$db];
}
$pos = false;
foreach ($separators as $separator) {
// use strpos instead of strrpos; it seems more common to
// have the db name, the separator, then the rest which
// might contain a separator
// like dbname_the_rest
$pos = strpos($db, $separator, 1);
if ($pos !== false) {
break;
}
}
if ($pos !== false) {
$group = substr($db, 0, $pos);
$disp_name_cut = substr($db, $pos);
} else {
$group = $db;
$disp_name_cut = $db;
}
$disp_name = $db;
$dbgroups[$group][$db] = array(
'name' => $db,
'disp_name_cut' => $disp_name_cut,
'disp_name' => $disp_name,
'comment' => $db_tooltip,
);
if ($GLOBALS['cfg']['Server']['CountTables']) {
$dbgroups[$group][$db]['num_tables'] = PMA_getTableCount($db);
}
} // end foreach ($GLOBALS['PMA_List_Database']->items as $db)
return $dbgroups;
}
/**
* returns a part of the items
*
* @param integer $offset
* @param integer $count
*
* @return array some items
*/
public function getLimitedItems($offset, $count)
{
return array_slice($this->getArrayCopy(), $offset, $count);
}
/**
* returns html code for list with dbs
*
* @return string html code list
*/
public function getHtmlListGrouped($selected = '', $offset = 0, $count = 0)
{
if (true === $selected) {
$selected = $this->getDefault();
}
$return = '<ul id="databaseList" lang="en" dir="ltr">' . "\n";
foreach ($this->getGroupedDetails($offset, $count) as $group => $dbs) {
if (count($dbs) > 1) {
$return .= '<li class="dbgroup"><span>' . htmlspecialchars($group)
. '</span><ul>' . "\n";
// whether display db_name cut by the group part
$cut = true;
} else {
// .. or full
$cut = false;
}
foreach ($dbs as $db) {
$return .= '<li';
if ($db['name'] == $selected) {
$return .= ' class="selected"';
}
$return .= '><a';
if (! empty($db['comment'])) {
$return .= ' title="' . htmlspecialchars($db['comment']) . '"';
}
$return .= ' href="' . $GLOBALS['cfg']['DefaultTabDatabase']
. '?' . PMA_generate_common_url($db['name'])
. '">';
if ($cut) {
$return .= htmlspecialchars($db['disp_name_cut']);
} else {
$return .= htmlspecialchars($db['disp_name']);
}
if (! empty($db['num_tables'])) {
$return .= ' (' . $db['num_tables'] . ')';
}
$return .= '</a></li>' . "\n";
}
if (count($dbs) > 1) {
$return .= '</ul></li>' . "\n";
}
}
$return .= '</ul>';
return $return;
}
/**
* returns html code for select form element with dbs
*
* @todo IE can not handle different text directions in select boxes so,
* as mostly names will be in english, we set the whole selectbox to LTR
* and EN
*
* @return string html code select
*/
public function getHtmlSelectGrouped($selected = '', $offset = 0, $count = 0)
{
if (true === $selected) {
$selected = $this->getDefault();
}
$return = '<select name="db" id="lightm_db" lang="en" dir="ltr"'
. ' onchange="if (this.value != \'\') PMA_commonActions.openDb(this.value);">' . "\n"
. '<option value="" dir="' . htmlspecialchars($GLOBALS['text_dir']) . '">'
. '(' . __('Databases') . ') ...</option>' . "\n";
foreach ($this->getGroupedDetails($offset, $count) as $group => $dbs) {
if (count($dbs) > 1) {
$return .= '<optgroup label="' . htmlspecialchars($group)
. '">' . "\n";
// whether display db_name cuted by the group part
$cut = true;
} else {
// .. or full
$cut = false;
}
foreach ($dbs as $db) {
$return .= '<option value="' . htmlspecialchars($db['name']) . '"'
.' title="' . htmlspecialchars($db['comment']) . '"';
if ($db['name'] == $selected
|| (PMA_DRIZZLE
&& strtolower($db['name']) == strtolower($selected))
) {
$return .= ' selected="selected"';
}
$return .= '>' . htmlspecialchars($cut ? $db['disp_name_cut'] : $db['disp_name']);
if (! empty($db['num_tables'])) {
$return .= ' (' . htmlspecialchars($db['num_tables']) . ')';
}
$return .= '</option>' . "\n";
}
if (count($dbs) > 1) {
$return .= '</optgroup>' . "\n";
}
}
$return .= '</select>';
return $return;
}
/**
* this is just a backup, if all is fine this can be deleted later
*

View File

@ -469,13 +469,6 @@ $cfg['Servers'][$i]['DisableIS'] = true;
*/
$cfg['Servers'][$i]['ShowDatabasesCommand'] = 'SHOW DATABASES';
/**
* Whether to count tables when showing database list
*
* @global array $cfg['Servers'][$i]['CountTables']
*/
$cfg['Servers'][$i]['CountTables'] = false;
/**
* Whether the tracking mechanism creates
* versions for tables and views automatically.

View File

@ -386,8 +386,6 @@ $strConfigServers_controluser_desc = __('A special MySQL user configured with li
$strConfigServers_controluser_name = __('Control user');
$strConfigServers_controlhost_desc = __('An alternate host to hold the configuration storage; leave blank to use the already defined host');
$strConfigServers_controlhost_name = __('Control host');
$strConfigServers_CountTables_desc = __('Count tables when showing database list');
$strConfigServers_CountTables_name = __('Count tables');
$strConfigServers_designer_coords_desc = __('Leave blank for no Designer support, suggested: [kbd]pma__designer_coords[/kbd]');
$strConfigServers_designer_coords_name = __('Designer table');
$strConfigServers_DisableIS_desc = __('More information on [a@https://sourceforge.net/p/phpmyadmin/bugs/2606/]PMA bug tracker[/a] and [a@http://bugs.mysql.com/19588]MySQL Bugs[/a]');

View File

@ -60,8 +60,7 @@ $forms['Servers']['Server_config'] = array('Servers' => array(1 => array(
'DisableIS',
'AllowDeny/order',
'AllowDeny/rules',
'ShowDatabasesCommand',
'CountTables')));
'ShowDatabasesCommand')));
$forms['Servers']['Server_pmadb'] = array('Servers' => array(1 => array(
'pmadb' => 'phpmyadmin',
'controlhost',

View File

@ -55,18 +55,6 @@ class PMA_List_Database_test extends PHPUnit_Framework_TestCase
$this->assertEquals(true, $arr->exists('single_db'));
}
public function testLimitedItems()
{
$arr = new PMA_List_Database;
$this->assertEquals(array('single_db'), $arr->getLimitedItems(0, 1));
}
public function testLimitedItems_empty()
{
$arr = new PMA_List_Database;
$this->assertEquals(array(), $arr->getLimitedItems(1, 1));
}
public function testHtmlOptions()
{
$arr = new PMA_List_Database;
@ -110,43 +98,5 @@ class PMA_List_Database_test extends PHPUnit_Framework_TestCase
);
}
/**
* Test for getGroupedDetails
*
* @return void
*/
public function testGetGroupedDetails()
{
$GLOBALS['cfg']['ShowTooltip'] = true;
$GLOBALS['cfgRelation']['commwork'] = true;
$GLOBALS['server'] = 1;
$GLOBALS['cfg']['NavigationTreeEnableGrouping'] = true;
$GLOBALS['cfg']['NavigationTreeDbSeparator'] = array('|',',');
$this->assertEquals(
$this->object->getGroupedDetails(10, 100),
array()
);
}
/**
* Test for getHtmlListGrouped
*
* @return void
*/
public function testGetHtmlListGrouped()
{
$GLOBALS['cfg']['ShowTooltip'] = true;
$GLOBALS['cfgRelation']['commwork'] = true;
$GLOBALS['server'] = 1;
$GLOBALS['cfg']['NavigationTreeEnableGrouping'] = true;
$GLOBALS['cfg']['NavigationTreeDbSeparator'] = array('|',',');
$this->assertEquals(
$this->object->getHtmlListGrouped(true, 5, 5),
'<ul id="databaseList" lang="en" dir="ltr">
</ul>'
);
}
}
?>