make the database list more magic:

load/fetch only if really required
use SPL ArrayObject to behave like an array
This commit is contained in:
Sebastian Mendel
2008-05-09 10:41:16 +00:00
parent 91007aa3d6
commit fa21fe3ea5
13 changed files with 183 additions and 138 deletions

View File

@@ -53,7 +53,7 @@ if (strlen($db) && (! empty($db_rename) || ! empty($db_copy))) {
// rebuild the database list because PMA_Table::moveCopy
// checks in this list if the target db exists
$GLOBALS['PMA_List_Database']->build();
$GLOBALS['pma']->databases->build();
}
if (isset($GLOBALS['add_constraints'])) {

View File

@@ -417,7 +417,7 @@ if ($export_type == 'server') {
$tmp_select = '|' . $tmp_select . '|';
}
// Walk over databases
foreach ($GLOBALS['PMA_List_Database']->items as $current_db) {
foreach ($GLOBALS['pma']->databases as $current_db) {
if ((isset($tmp_select) && strpos(' ' . $tmp_select, '|' . $current_db . '|'))
|| !isset($tmp_select)) {
if (!PMA_exportDBHeader($current_db)) {

View File

@@ -11,86 +11,49 @@
* @since phpMyAdmin 2.9.10
* @abstract
*/
/* abstract public */ class PMA_List
abstract class PMA_List extends ArrayObject
{
/**
* @var array the list items
* @access public
*/
var $items = array();
/**
* @var array details for list items
* @access public
*/
var $details = array();
/**
* @var bool whether we need to re-index the database list for consistency keys
* @access protected
*/
var $_need_to_reindex = false;
/**
* @var mixed empty item
*/
var $item_empty = '';
protected $item_empty = '';
/**
* returns first item from list
*
* @uses PMA_List::$items to get first item
* @uses reset() to retrive first item from PMA_List::$items array
* @return string value of first item
*/
function getFirst()
public function __construct($array = array(), $flags = 0, $iterator_class = "ArrayIterator")
{
return reset($this->items);
parent::__construct($array, $flags, $iterator_class);
}
/**
* returns item only if there is only one in the list
*
* @uses PMA_List::count() to decide what to return
* @uses PMA_List::getFirst() to return it
* @uses count()
* @uses reset()
* @uses PMA_List::getEmpty() to return it
* @return single item
*/
function getSingleItem()
public function getSingleItem()
{
if ($this->count() === 1) {
return $this->getFirst();
if (count($this) === 1) {
return reset($this);
}
return $this->getEmpty();
}
/**
* returns list item count
*
* @uses PMA_List::$items to count it items
* @uses count() to count items in PMA_List::$items
* @return integer PMA_List::$items count
*/
function count()
{
return count($this->items);
}
/**
* defines what is an empty item (0, '', false or null)
*
* @uses PMA_List::$item_empty as return value
* @return mixed an empty item
*/
function getEmpty()
public function getEmpty()
{
return $this->item_empty;
}
/**
* checks if the given db names exists in the current list, if there is
* missing at least one item it reutrns false other wise true
* missing at least one item it returns false other wise true
*
* @uses PMA_List::$items to check for existence of specific item
* @uses func_get_args()
@@ -98,10 +61,10 @@
* @param string $db_name,.. one or more mysql result resources
* @return boolean true if all items exists, otheriwse false
*/
function exists()
public function exists()
{
foreach (func_get_args() as $result) {
if (! in_array($result, $this->items)) {
if (! in_array($result, $this)) {
return false;
}
}
@@ -119,22 +82,22 @@
* @param boolean $include_information_schema
* @return string HTML option tags
*/
function getHtmlOptions($selected = '', $include_information_schema = true)
public function getHtmlOptions($selected = '', $include_information_schema = true)
{
if (true === $selected) {
$selected = $this->getDefault();
}
$options = '';
foreach ($this->items as $each_db) {
if (false === $include_information_schema && 'information_schema' === $each_db) {
foreach ($this as $each_item) {
if (false === $include_information_schema && 'information_schema' === $each_item) {
continue;
}
$options .= '<option value="' . htmlspecialchars($each_db) . '"';
if ($selected === $each_db) {
$options .= '<option value="' . htmlspecialchars($each_item) . '"';
if ($selected === $each_item) {
$options .= ' selected="selected"';
}
$options .= '>' . htmlspecialchars($each_db) . '</option>' . "\n";
$options .= '>' . htmlspecialchars($each_item) . '</option>' . "\n";
}
return $options;
@@ -146,7 +109,7 @@
* @uses PMA_List::getEmpty() as fallback
* @return string default item
*/
function getDefault()
public function getDefault()
{
return $this->getEmpty();
}
@@ -154,8 +117,7 @@
/**
* builds up the list
*
* @abstract
*/
/* abstract public */ function build() {}
abstract public function build();
}
?>

View File

@@ -28,33 +28,29 @@ require_once './libraries/List.class.php';
{
/**
* @var mixed database link resource|object to be used
* @access protected
*/
var $_db_link = null;
protected $_db_link = null;
/**
* @var mixed user database link resource|object
* @access protected
*/
var $_db_link_user = null;
protected $_db_link_user = null;
/**
* @var mixed controluser database link resource|object
* @access protected
*/
var $_db_link_control = null;
protected $_db_link_control = null;
/**
* @var boolean whether SHOW DATABASES is disabled or not
* @access protected
*/
var $_show_databases_disabled = false;
protected $_show_databases_disabled = false;
/**
* @var string command to retrieve databases from server
* @access protected
*/
var $_command = null;
protected $_command = null;
/**
* Constructor
@@ -66,11 +62,13 @@ require_once './libraries/List.class.php';
* @param mixed $db_link_user user database link resource|object
* @param mixed $db_link_control control database link resource|object
*/
function __construct($db_link_user = null, $db_link_control = null) {
public function __construct($db_link_user = null, $db_link_control = null)
{
$this->_db_link = $db_link_user;
$this->_db_link_user = $db_link_user;
$this->_db_link_control = $db_link_control;
parent::__construct();
$this->build();
}
@@ -78,32 +76,27 @@ require_once './libraries/List.class.php';
* checks if the configuration wants to hide some databases
*
* @todo temporaly use this docblock to test how to doc $GLOBALS
* @access protected
* @uses PMA_List_Database::$items
* @uses PMA_List_Database::$_need_to_reindex to set it if reuqired
* @uses preg_match()
* @uses $cfg['Server']['hide_db']
*/
function _checkHideDatabase()
protected function _checkHideDatabase()
{
if (empty($GLOBALS['cfg']['Server']['hide_db'])) {
return;
}
foreach ($this->items as $key => $db) {
foreach ($this as $key => $db) {
if (preg_match('/' . $GLOBALS['cfg']['Server']['hide_db'] . '/', $db)) {
unset($this->items[$key]);
$this->offsetUnset($key);
}
}
// re-index values
$this->_need_to_reindex = true;
}
/**
* retrieves database list from server
*
* @todo we could also search mysql tables if all fail?
* @access protected
* @uses PMA_List_Database::$_show_databases_disabled for not retrying if SHOW DATABASES is disabled
* @uses PMA_List_Database::$_db_link
* @uses PMA_List_Database::$_db_link_control in case of SHOW DATABASES is disabled for userlink
@@ -113,7 +106,7 @@ require_once './libraries/List.class.php';
* @uses $GLOBALS['errno']
* @param string $like_db_name usally a db_name containing wildcards
*/
function _retrieve($like_db_name = null)
protected function _retrieve($like_db_name = null)
{
if ($this->_show_databases_disabled) {
return array();
@@ -156,7 +149,6 @@ require_once './libraries/List.class.php';
* builds up the list
*
* @uses PMA_List_Database::$items to initialize it
* @uses PMA_List_Database::$_need_to_reindex
* @uses PMA_List_Database::_checkOnlyDatabase()
* @uses PMA_List_Database::_retrieve()
* @uses PMA_List_Database::_checkHideDatabase()
@@ -164,23 +156,17 @@ require_once './libraries/List.class.php';
* @uses natsort()
* @uses $cfg['NaturalOrder']
*/
function build()
public function build()
{
$this->items = array();
if (! $this->_checkOnlyDatabase()) {
$this->items = $this->_retrieve();
$items = $this->_retrieve();
if ($GLOBALS['cfg']['NaturalOrder']) {
natsort($this->items);
$this->_need_to_reindex = true;
natsort($items);
}
$this->exchangeArray($items);
}
$this->_checkHideDatabase();
if ($this->_need_to_reindex) {
$this->items = array_values($this->items);
}
}
/**
@@ -199,7 +185,7 @@ require_once './libraries/List.class.php';
* @uses $cfg['Server']['only_db']
* @return boolean false if there is no only_db, otherwise true
*/
function _checkOnlyDatabase()
protected function _checkOnlyDatabase()
{
if (is_string($GLOBALS['cfg']['Server']['only_db'])
&& strlen($GLOBALS['cfg']['Server']['only_db'])) {
@@ -211,12 +197,14 @@ require_once './libraries/List.class.php';
if (! is_array($GLOBALS['cfg']['Server']['only_db'])) {
return false;
}
$items = array();
foreach ($GLOBALS['cfg']['Server']['only_db'] as $each_only_db) {
if ($each_only_db === '*' && ! $this->_show_databases_disabled) {
// append all not already listed dbs to the list
$this->items = array_merge($this->items,
array_diff($this->_retrieve(), $this->items));
$items = array_merge($items,
array_diff($this->_retrieve(), $items));
// there can only be one '*', and this can only be last
break;
}
@@ -225,17 +213,19 @@ require_once './libraries/List.class.php';
// thus containing not escaped _ or %
if (! preg_match('/(^|[^\\\\])(_|%)/', $each_only_db)) {
// ... not contains wildcard
$this->items[] = PMA_unescape_mysql_wildcards($each_only_db);
$items[] = PMA_unescape_mysql_wildcards($each_only_db);
continue;
}
if (! $this->_show_databases_disabled) {
$this->items = array_merge($this->items, $this->_retrieve($each_only_db));
$items = array_merge($items, $this->_retrieve($each_only_db));
continue;
}
// @todo induce error, about not using wildcards with SHOW DATABASE disabled?
}
$this->exchangeArray($items);
return true;
}
@@ -248,7 +238,7 @@ require_once './libraries/List.class.php';
* @uses strlen()
* @return string default item
*/
function getDefault()
public function getDefault()
{
if (strlen($GLOBALS['db'])) {
return $GLOBALS['db'];
@@ -276,7 +266,7 @@ require_once './libraries/List.class.php';
* @param integer $count
* @return array db list
*/
function getGroupedDetails($offset, $count)
public function getGroupedDetails($offset, $count)
{
$dbgroups = array();
$parts = array();
@@ -334,15 +324,14 @@ require_once './libraries/List.class.php';
/**
* returns a part of the items
*
* @uses PMA_List_Database::$items
* @uses array_slice()
* @param integer $offset
* @param integer $count
* @return array some items
*/
function getLimitedItems($offset, $count)
public function getLimitedItems($offset, $count)
{
return(array_slice($this->items, $offset, $count));
return array_slice($this->getArrayCopy(), $offset, $count);
}
/**
@@ -350,7 +339,7 @@ require_once './libraries/List.class.php';
*
* @return string html code list
*/
function getHtmlListGrouped($selected = '', $offset, $count)
public function getHtmlListGrouped($selected = '', $offset, $count)
{
if (true === $selected) {
$selected = $this->getDefault();
@@ -406,7 +395,7 @@ require_once './libraries/List.class.php';
*
* @return string html code select
*/
function getHtmlSelectGrouped($selected = '', $offset, $count)
public function getHtmlSelectGrouped($selected = '', $offset, $count)
{
if (true === $selected) {
$selected = $this->getDefault();
@@ -451,9 +440,8 @@ require_once './libraries/List.class.php';
* this is just a backup, if all is fine this can be deleted later
*
* @deprecated
* @access protected
*/
function _checkAgainstPrivTables()
protected function _checkAgainstPrivTables()
{
// 1. get allowed dbs from the "mysql.db" table
// lem9: User can be blank (anonymous user)

94
libraries/PMA.php Normal file
View File

@@ -0,0 +1,94 @@
<?php
/**
* Enter description here...
*
*/
require_once './libraries/List_Database.class.php';
/**
* phpMyAdmin mian Controller
*
*
*
*/
class PMA
{
/**
* Holds database list
*
* @var PMA_List_Datase
*/
protected $databases = null;
/**
* DBMS user link
*
* @var resource
*/
protected $userlink = null;
/**
* DBMS control link
*
* @var resource
*/
protected $controllink = null;
/**
* magic access to protected/inaccessible members/properties
*
* @see http://php.net/language.oop5.overloading
*/
public function __get($param)
{
switch ($param) {
case 'databases' :
return $this->getDatabaseList();
break;
case 'userlink' :
return $this->userlink;
break;
case 'controllink' :
return $this->controllink;
break;
}
return null;
}
/**
* magic access to protected/inaccessible members/properties
*
* @see http://php.net/language.oop5.overloading
*/
public function __set($param, $value)
{
switch ($param) {
case 'userlink' :
$this->userlink = $value;
break;
case 'controllink' :
$this->controllink = $value;
break;
}
}
/**
* Accessor to PMA::$databases
*
* @uses PMA::$databases
* @uses PMA::$userlink
* @uses PMA::$controllink
* @uses PMA_List_Database
* @return PMA_List_Databases
*/
public function getDatabaseList()
{
if (null === $this->databases) {
$this->databases = new PMA_List_Database($this->userlink, $this->controllink);
}
return $this->databases;
}
}
?>

View File

@@ -559,12 +559,12 @@ class PMA_Table {
$GLOBALS['asfile'] = 1;
// Ensure the target is valid
if (! $GLOBALS['PMA_List_Database']->exists($source_db, $target_db)) {
if (! $GLOBALS['PMA_List_Database']->exists($source_db)) {
if (! $GLOBALS['pma']->databases->exists($source_db, $target_db)) {
if (! $GLOBALS['pma']->databases->exists($source_db)) {
$GLOBALS['message'] = PMA_Message::rawError('source database `'
. htmlspecialchars($source_db) . '` not found');
}
if (! $GLOBALS['PMA_List_Database']->exists($target_db)) {
if (! $GLOBALS['pma']->databases->exists($target_db)) {
$GLOBALS['message'] = PMA_Message::rawError('target database `'
. htmlspecialchars($target_db) . '` not found');
}
@@ -951,7 +951,7 @@ class PMA_Table {
{
if (null !== $new_db && $new_db !== $this->getDbName()) {
// Ensure the target is valid
if (! $GLOBALS['PMA_List_Database']->exists($new_db)) {
if (! $GLOBALS['pma']->databases->exists($new_db)) {
$this->errors[] = $GLOBALS['strInvalidDatabase'] . ': ' . $new_db;
return false;
}

View File

@@ -907,9 +907,11 @@ if (! defined('PMA_MINIMUM_COMMON')) {
/**
* the PMA_List_Database class
*/
require_once './libraries/List_Database.class.php';
$PMA_List_Database = new PMA_List_Database($userlink, $controllink);
require_once './libraries/PMA.php';
$pma = new PMA;
$pma->userlink = $userlink;
$pma->controllink = $controllink;
/**
* some resetting has to be done when switching servers
*/

View File

@@ -487,7 +487,7 @@ function PMA_DBI_get_databases_full($database = null, $force_stats = false,
// display only databases also in official database list
// f.e. to apply hide_db and only_db
$drops = array_diff(array_keys($databases), $GLOBALS['PMA_List_Database']->items);
$drops = array_diff(array_keys($databases), $GLOBALS['pma']->databases);
if (count($drops)) {
foreach ($drops as $drop) {
unset($databases[$drop]);
@@ -496,7 +496,7 @@ function PMA_DBI_get_databases_full($database = null, $force_stats = false,
}
unset($sql_where_schema, $sql, $drops);
} else {
foreach ($GLOBALS['PMA_List_Database']->items as $database_name) {
foreach ($GLOBALS['pma']->databases as $database_name) {
// MySQL forward compatibility
// so pma could use this array as if every server is of version >5.0
$databases[$database_name]['SCHEMA_NAME'] = $database_name;
@@ -630,7 +630,7 @@ function PMA_DBI_get_columns_full($database = null, $table = null,
unset($sql_wheres, $sql);
} else {
if (null === $database) {
foreach ($GLOBALS['PMA_List_Database']->items as $database) {
foreach ($GLOBALS['pma']->databases as $database) {
$columns[$database] = PMA_DBI_get_columns_full($database, null,
null, $link);
}

View File

@@ -420,7 +420,7 @@ elseif ($mult_btn == $strYes) {
if ($rebuild_database_list) {
// avoid a problem with the database list navigator
// when dropping a db from server_databases
$GLOBALS['PMA_List_Database']->build();
$GLOBALS['pma']->databases->build();
}
}
?>

View File

@@ -4,7 +4,7 @@
* the navigation frame - displays server, db and table selection tree
*
* @version $Id$
* @uses $GLOBALS['PMA_List_Database']
* @uses $GLOBALS['pma']->databases
* @uses $GLOBALS['server']
* @uses $GLOBALS['db']
* @uses $GLOBALS['table']
@@ -24,7 +24,6 @@
* @uses $GLOBALS['cfg']['DefaultTabDatabase']
* @uses $GLOBALS['cfgRelation']['commwork']) {
* @uses PMA_List_Database::getSingleItem()
* @uses PMA_List_Database::count()
* @uses PMA_List_Database::getHtmlSelectGrouped()
* @uses PMA_List_Database::getGroupedDetails()
* @uses PMA_generate_common_url()
@@ -86,7 +85,7 @@ PMA_outBufferPre();
* selects the database if there is only one on current server
*/
if ($GLOBALS['server'] && ! strlen($GLOBALS['db'])) {
$GLOBALS['db'] = $GLOBALS['PMA_List_Database']->getSingleItem();
$GLOBALS['db'] = $GLOBALS['pma']->databases->getSingleItem();
}
$db_start = $GLOBALS['db'];
@@ -188,11 +187,11 @@ require './libraries/navigation_header.inc.php';
if (! $GLOBALS['server']) {
// no server selected
PMA_exitNavigationFrame();
} elseif (! $GLOBALS['PMA_List_Database']->count()) {
} elseif (! count($GLOBALS['pma']->databases)) {
// no database available, so we break here
echo '<p>' . $GLOBALS['strNoDatabases'] . '</p>';
PMA_exitNavigationFrame();
} elseif ($GLOBALS['cfg']['LeftFrameLight'] && $GLOBALS['PMA_List_Database']->count() > 1) {
} elseif ($GLOBALS['cfg']['LeftFrameLight'] && count($GLOBALS['pma']->databases) > 1) {
$list = $cfg['DisplayDatabasesList'];
if ($list === 'auto') {
if (empty($GLOBALS['db'])) {
@@ -216,7 +215,7 @@ if (! $GLOBALS['server']) {
<label for="lightm_db"><?php echo $GLOBALS['strDatabase']; ?></label>
<?php
echo PMA_generate_common_hidden_inputs() . "\n";
echo $GLOBALS['PMA_List_Database']->getHtmlSelectGrouped(true, $_SESSION['userconf']['navi_limit_offset'], $GLOBALS['cfg']['MaxDbList']) . "\n";
echo $GLOBALS['pma']->databases->getHtmlSelectGrouped(true, $_SESSION['userconf']['navi_limit_offset'], $GLOBALS['cfg']['MaxDbList']) . "\n";
echo '<noscript>' . "\n"
.'<input type="submit" name="Go" value="' . $GLOBALS['strGo'] . '" />' . "\n"
.'</noscript>' . "\n"
@@ -225,10 +224,10 @@ if (! $GLOBALS['server']) {
if (! empty($db)) {
echo '<div id="databaseList">' . "\n";
}
echo $GLOBALS['PMA_List_Database']->getHtmlListGrouped(true, $_SESSION['userconf']['navi_limit_offset'], $GLOBALS['cfg']['MaxDbList']) . "\n";
echo $GLOBALS['pma']->databases->getHtmlListGrouped(true, $_SESSION['userconf']['navi_limit_offset'], $GLOBALS['cfg']['MaxDbList']) . "\n";
}
$_url_params = array('pos' => $pos);
PMA_listNavigator($GLOBALS['PMA_List_Database']->count(), $pos, $_url_params, 'navigation.php', 'frame_navigation', $GLOBALS['cfg']['MaxDbList']);
PMA_listNavigator(count($GLOBALS['pma']->databases), $pos, $_url_params, 'navigation.php', 'frame_navigation', $GLOBALS['cfg']['MaxDbList']);
if (! empty($db)) {
echo '</div>' . "\n";
}
@@ -321,11 +320,11 @@ if ($GLOBALS['cfg']['LeftFrameLight'] && strlen($GLOBALS['db'])) {
} else {
echo '<div id="databaseList">' . "\n";
$_url_params = array('pos' => $pos);
PMA_listNavigator($GLOBALS['PMA_List_Database']->count(), $pos, $_url_params, 'navigation.php', 'frame_navigation', $GLOBALS['cfg']['MaxDbList']);
PMA_listNavigator(count($GLOBALS['pma']->databases), $pos, $_url_params, 'navigation.php', 'frame_navigation', $GLOBALS['cfg']['MaxDbList']);
echo '</div>' . "\n";
$common_url_query = PMA_generate_common_url();
PMA_displayDbList($GLOBALS['PMA_List_Database']->getGroupedDetails($_SESSION['userconf']['navi_limit_offset'],$GLOBALS['cfg']['MaxDbList']), $_SESSION['userconf']['navi_limit_offset'],$GLOBALS['cfg']['MaxDbList']);
PMA_displayDbList($GLOBALS['pma']->databases->getGroupedDetails($_SESSION['userconf']['navi_limit_offset'],$GLOBALS['cfg']['MaxDbList']), $_SESSION['userconf']['navi_limit_offset'],$GLOBALS['cfg']['MaxDbList']);
}
/**
@@ -357,13 +356,13 @@ function PMA_displayDbList($ext_dblist, $offset, $count) {
// get table list, for all databases
// doing this in one step takes advantage of a single query with information_schema!
$tables_full = PMA_DBI_get_tables_full($GLOBALS['PMA_List_Database']->getLimitedItems($offset, $count));
$tables_full = PMA_DBI_get_tables_full($GLOBALS['pma']->databases->getLimitedItems($offset, $count));
$url_dbgroup = '';
echo '<ul id="leftdatabaselist">';
$close_db_group = false;
foreach ($ext_dblist as $group => $db_group) {
if ($GLOBALS['PMA_List_Database']->count() > 1) {
if (count($GLOBALS['pma']->databases) > 1) {
if ($close_db_group) {
$url_dbgroup = '';
echo '</ul>';
@@ -402,7 +401,7 @@ function PMA_displayDbList($ext_dblist, $offset, $count) {
// Displays the database name
echo '<li>' . "\n";
if ($GLOBALS['PMA_List_Database']->count() > 1) {
if (count($GLOBALS['pma']->databases) > 1) {
// only with more than one db we need collapse ...
if ($db_start != $db['name'] || $db['num_tables'] < 1) {
// display + only if this db is not preselected
@@ -475,7 +474,7 @@ function PMA_displayDbList($ext_dblist, $offset, $count) {
$tables = PMA_getTableList($db['name']);
}
$child_visible =
(bool) ($GLOBALS['PMA_List_Database']->count() === 1 || $db_start == $db['name']);
(bool) (count($GLOBALS['pma']->databases) === 1 || $db_start == $db['name']);
PMA_displayTableList($tables, $child_visible, '', $db['name']);
} elseif ($GLOBALS['cfg']['LeftFrameLight']) {
// no tables and LeftFrameLight:

View File

@@ -92,7 +92,7 @@ echo '<h2>' . "\n"
if ($server > 0) {
$databases = PMA_DBI_get_databases_full(null, $dbstats, null, $sort_by,
$sort_order, $pos, true);
$databases_count = $PMA_List_Database->count();
$databases_count = count($GLOBALS['pma']->databases);
} else {
$databases_count = 0;
}

View File

@@ -30,7 +30,7 @@ $multi_values .= '<a href="' . $checkall_url . '&amp;selectall=1" onclick="setSe
$multi_values .= '<select name="db_select[]" size="6" multiple="multiple">';
$multi_values .= "\n";
foreach ($GLOBALS['PMA_List_Database']->items as $current_db) {
foreach ($GLOBALS['pma']->databases as $current_db) {
if (!empty($selectall) || (isset($tmp_select) && strpos(' ' . $tmp_select, '|' . $current_db . '|'))) {
$is_selected = ' selected="selected"';
} else {

View File

@@ -258,14 +258,14 @@ unset($columns);
<input type="hidden" name="what" value="data" />
<fieldset id="fieldset_table_rename">
<legend><?php echo $strMoveTable; ?></legend>
<?php if ($GLOBALS['PMA_List_Database']->count() > $GLOBALS['cfg']['MaxDbList']) {
<?php if (count($GLOBALS['pma']->databases) > $GLOBALS['cfg']['MaxDbList']) {
?>
<input type="text" maxlength="100" size="30" name="target_db" value="<?php echo htmlspecialchars($GLOBALS['db']); ?>"/>
<?php
} else {
?>
<select name="target_db">
<?php echo $GLOBALS['PMA_List_Database']->getHtmlOptions(true, false); ?>
<?php echo $GLOBALS['pma']->databases->getHtmlOptions(true, false); ?>
</select>
<?php
} // end if
@@ -462,14 +462,14 @@ if (isset($possible_row_formats[$tbl_type])) {
<input type="hidden" name="reload" value="1" />
<fieldset>
<legend><?php echo $strCopyTable; ?></legend>
<?php if ($GLOBALS['PMA_List_Database']->count() > $GLOBALS['cfg']['MaxDbList']) {
<?php if (count($GLOBALS['pma']->databases) > $GLOBALS['cfg']['MaxDbList']) {
?>
<input type="text" maxlength="100" size="30" name="target_db" value="<?php echo htmlspecialchars($GLOBALS['db']); ?>"/>
<?php
} else {
?>
<select name="target_db">
<?php echo $GLOBALS['PMA_List_Database']->getHtmlOptions(true, false); ?>
<?php echo $GLOBALS['pma']->databases->getHtmlOptions(true, false); ?>
</select>
<?php
} // end if