Do not check for the validity of all recent tables on initial loading.
Signed-off-by: Madhura Jayaratne <madhura.cj@gmail.com>
This commit is contained in:
parent
9680410019
commit
72b6d68d34
@ -716,12 +716,10 @@ class PMA_Header
|
||||
&& $GLOBALS['PMA_String']->strlen($table)
|
||||
&& $GLOBALS['cfg']['NumRecentTables'] > 0
|
||||
) {
|
||||
$tmp_result = PMA_RecentFavoriteTable::getInstance('recent')->add($db, $table);
|
||||
$tmp_result = PMA_RecentFavoriteTable::getInstance('recent')
|
||||
->add($db, $table);
|
||||
if ($tmp_result === true) {
|
||||
$params = array('ajax_request' => true, 'recent_table' => true);
|
||||
$url = 'index.php' . PMA_URL_getCommon($params);
|
||||
$retval = '<a class="hide" id="update_recent_tables"';
|
||||
$retval .= ' href="' . $url . '"></a>';
|
||||
$retval = PMA_RecentFavoriteTable::getHtmlUpdateRecentTables();
|
||||
} else {
|
||||
$error = $tmp_result;
|
||||
$retval = $error->getDisplay();
|
||||
|
||||
@ -195,13 +195,6 @@ class PMA_RecentFavoriteTable
|
||||
*/
|
||||
public function getHtmlList()
|
||||
{
|
||||
// Remove Recent/Favorite tables that don't exist.
|
||||
foreach ($this->_tables as $tbl) {
|
||||
if (! $GLOBALS['dbi']->getColumns($tbl['db'], $tbl['table'])) {
|
||||
$this->remove($tbl['db'], $tbl['table']);
|
||||
}
|
||||
}
|
||||
|
||||
$html = '';
|
||||
if (count($this->_tables)) {
|
||||
if ($this->_tableType == 'recent') {
|
||||
@ -211,7 +204,7 @@ class PMA_RecentFavoriteTable
|
||||
'db' => $table['db'],
|
||||
'table' => $table['table']
|
||||
);
|
||||
$recent_url = 'sql.php'
|
||||
$recent_url = 'tbl_recent_favorite.php'
|
||||
. PMA_URL_getCommon($recent_params);
|
||||
$html .= '<a href="' . $recent_url . '">`'
|
||||
. htmlspecialchars($table['db']) . '`.`'
|
||||
@ -243,7 +236,7 @@ class PMA_RecentFavoriteTable
|
||||
'db' => $table['db'],
|
||||
'table' => $table['table']
|
||||
);
|
||||
$table_url = 'sql.php'
|
||||
$table_url = 'tbl_recent_favorite.php'
|
||||
. PMA_URL_getCommon($fav_params);
|
||||
$html .= '<a href="' . $table_url . '">`'
|
||||
. htmlspecialchars($table['db']) . '`.`'
|
||||
@ -314,6 +307,28 @@ class PMA_RecentFavoriteTable
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes recent/favorite tables that don't exist.
|
||||
*
|
||||
* @param string $db database
|
||||
* @param string $table table
|
||||
*
|
||||
* @return booean|PMA_Message True if invalid and removed, False if not invalid,
|
||||
* PMA_Message if error while removing
|
||||
*/
|
||||
public function removeIfInvalid($db, $table)
|
||||
{
|
||||
foreach ($this->_tables as $tbl) {
|
||||
if ($tbl['db'] == $db && $tbl['table'] == $table) {
|
||||
// TODO Figure out a better way to find the existance of a table
|
||||
if (! $GLOBALS['dbi']->getColumns($tbl['db'], $tbl['table'])) {
|
||||
return $this->remove($tbl['db'], $tbl['table']);
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove favorite tables.
|
||||
*
|
||||
@ -359,5 +374,19 @@ class PMA_RecentFavoriteTable
|
||||
}
|
||||
return $retval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate Html to update recent tables.
|
||||
*
|
||||
* @return string html
|
||||
*/
|
||||
public static function getHtmlUpdateRecentTables()
|
||||
{
|
||||
$params = array('ajax_request' => true, 'recent_table' => true);
|
||||
$url = 'index.php' . PMA_URL_getCommon($params);
|
||||
$retval = '<a class="hide" id="update_recent_tables"';
|
||||
$retval .= ' href="' . $url . '"></a>';
|
||||
return $retval;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
19
tbl_recent_favorite.php
Normal file
19
tbl_recent_favorite.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
* Browse recent and favourite tables chosen from navigation
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
|
||||
require_once 'libraries/common.inc.php';
|
||||
require_once 'libraries/RecentFavoriteTable.class.php';
|
||||
|
||||
PMA_RecentFavoriteTable::getInstance('recent')
|
||||
->removeIfInvalid($_REQUEST['db'], $_REQUEST['table']);
|
||||
|
||||
PMA_RecentFavoriteTable::getInstance('favorite')
|
||||
->removeIfInvalid($_REQUEST['db'], $_REQUEST['table']);
|
||||
|
||||
require 'sql.php';
|
||||
?>
|
||||
Loading…
Reference in New Issue
Block a user