From 1084e4dfddf6872f9eb11d9ce5375ba4f484f2e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Tue, 27 Aug 2013 11:06:21 +0200 Subject: [PATCH] Do not show tooltip in table navigation Most tables don't have any comment set and this causes serious slow down of a navigation. --- doc/config.rst | 8 ------ libraries/config.default.php | 7 ----- libraries/config/messages.inc.php | 1 - libraries/config/setup.forms.php | 2 +- libraries/config/user_preferences.forms.php | 2 +- libraries/db_info.inc.php | 14 ---------- libraries/navigation/NavigationTree.class.php | 12 +-------- libraries/navigation/Nodes/Node.class.php | 19 +++---------- .../navigation/Nodes/Node_Column.class.php | 25 ----------------- .../navigation/Nodes/Node_Database.class.php | 12 --------- .../navigation/Nodes/Node_Event.class.php | 21 --------------- .../navigation/Nodes/Node_Function.class.php | 22 --------------- .../navigation/Nodes/Node_Procedure.class.php | 22 --------------- .../navigation/Nodes/Node_Table.class.php | 27 ------------------- test/classes/navigation/PMA_Node_test.php | 9 ------- 15 files changed, 7 insertions(+), 196 deletions(-) diff --git a/doc/config.rst b/doc/config.rst index 6a5d7cf813..fffa073256 100644 --- a/doc/config.rst +++ b/doc/config.rst @@ -1312,14 +1312,6 @@ Navigation panel setup The maximum number of recently used tables shown in the navigation panel. Set this to 0 (zero) to disable the listing of recent tables. -.. config:option:: $cfg['ShowTooltip'] - - :type: boolean - :default: true - - Defines whether to display item comments as tooltips in navigation - panel or not. - .. config:option:: $cfg['NavigationDisplayLogo'] :type: boolean diff --git a/libraries/config.default.php b/libraries/config.default.php index d164d768e9..07214d778f 100644 --- a/libraries/config.default.php +++ b/libraries/config.default.php @@ -826,13 +826,6 @@ $cfg['NavigationTreeTableSeparator'] = '__'; */ $cfg['NavigationTreeTableLevel'] = 1; -/** - * display table comment as tooltip in navigation panel - * - * @global boolean $cfg['ShowTooltip'] - */ -$cfg['ShowTooltip'] = true; - /** * display logo at top of navigation panel * diff --git a/libraries/config/messages.inc.php b/libraries/config/messages.inc.php index 350bb0df0f..a2036fc456 100644 --- a/libraries/config/messages.inc.php +++ b/libraries/config/messages.inc.php @@ -482,7 +482,6 @@ $strConfigRetainQueryBox_desc = __('Defines whether the query box should stay on $strConfigRetainQueryBox_name = __('Retain query box'); $strConfigShowStats_desc = __('Allow to display database and table statistics (eg. space usage)'); $strConfigShowStats_name = __('Show statistics'); -$strConfigShowTooltip_name = __('Display table comments in tooltips'); $strConfigSkipLockedTables_desc = __('Mark used tables and make it possible to show databases with locked tables'); $strConfigSkipLockedTables_name = __('Skip locked tables'); $strConfigSQLQuery_Edit_name = __('Edit'); diff --git a/libraries/config/setup.forms.php b/libraries/config/setup.forms.php index f172462d7d..1d40e0f20b 100644 --- a/libraries/config/setup.forms.php +++ b/libraries/config/setup.forms.php @@ -178,7 +178,7 @@ $forms['Navi_panel']['Navi_tables'] = array( 'NavigationTreeDefaultTabTable', 'NavigationTreeTableSeparator', 'NavigationTreeTableLevel', - 'ShowTooltip'); +); $forms['Main_panel']['Startup'] = array( 'ShowCreateDb', 'ShowStats', diff --git a/libraries/config/user_preferences.forms.php b/libraries/config/user_preferences.forms.php index eeacd1c79a..ede3d2ca18 100644 --- a/libraries/config/user_preferences.forms.php +++ b/libraries/config/user_preferences.forms.php @@ -93,7 +93,7 @@ $forms['Navi_panel']['Navi_tables'] = array( 'NavigationTreeDefaultTabTable', 'NavigationTreeTableSeparator', 'NavigationTreeTableLevel', - 'ShowTooltip'); +); $forms['Main_panel']['Startup'] = array( 'ShowCreateDb', 'ShowStats', diff --git a/libraries/db_info.inc.php b/libraries/db_info.inc.php index 569cb4a16f..61df7e7b6d 100644 --- a/libraries/db_info.inc.php +++ b/libraries/db_info.inc.php @@ -106,12 +106,6 @@ if (true === $cfg['SkipLockedTables']) { continue; } - if ($cfg['ShowTooltip']) { - PMA_Util::fillTooltip( - $tooltip_truename, $tooltip_aliasname, $sts_tmp - ); - } - $tables[$sts_tmp['Name']] = $sts_tmp; } else { // table in use $tables[$tmp[0]] = array('Name' => $tmp[0]); @@ -190,14 +184,6 @@ if (! isset($sot_ready)) { ); } } - - if ($cfg['ShowTooltip']) { - foreach ($tables as $each_table) { - PMA_Util::fillTooltip( - $tooltip_truename, $tooltip_aliasname, $each_table - ); - } - } } /** diff --git a/libraries/navigation/NavigationTree.class.php b/libraries/navigation/NavigationTree.class.php index 98cdcb8370..bb6e1d1d4f 100644 --- a/libraries/navigation/NavigationTree.class.php +++ b/libraries/navigation/NavigationTree.class.php @@ -933,17 +933,7 @@ class PMA_NavigationTree $retval .= htmlspecialchars($node->name); $retval .= ""; } else { - if ($GLOBALS['cfg']['ShowTooltip']) { - $title = $node->getComment(); - if ($title) { - $title = ' title="' - . htmlentities($title, ENT_QUOTES, 'UTF-8') - . '"'; - } - } else { - $title = ''; - } - $retval .= ""; + $retval .= ""; $retval .= htmlspecialchars($node->real_name); $retval .= ""; } diff --git a/libraries/navigation/Nodes/Node.class.php b/libraries/navigation/Nodes/Node.class.php index a1f0e3b442..c7593bb01d 100644 --- a/libraries/navigation/Nodes/Node.class.php +++ b/libraries/navigation/Nodes/Node.class.php @@ -362,23 +362,12 @@ class Node // @todo obey the DisableIS directive $query = "SELECT `SCHEMA_NAME` "; $query .= "FROM `INFORMATION_SCHEMA`.`SCHEMATA` "; - $query .= $this->_getWhereClause($searchClause); + $query .= $this->_getWhereClause($searchClause); $query .= "ORDER BY `SCHEMA_NAME` ASC "; $query .= "LIMIT $pos, {$GLOBALS['cfg']['MaxNavigationItems']}"; return PMA_DBI_fetch_result($query); } - /** - * Returns the comment associated with node - * This method should be overridden by specific type of nodes - * - * @return string - */ - public function getComment() - { - return ''; - } - /** * Returns the number of children of type $type present inside this container * This method is overridden by the Node_Database and Node_Table classes @@ -394,7 +383,7 @@ class Node if (! $GLOBALS['cfg']['Servers'][$GLOBALS['server']]['DisableIS']) { $query = "SELECT COUNT(*) "; $query .= "FROM `INFORMATION_SCHEMA`.`SCHEMATA` "; - $query .= $this->_getWhereClause($searchClause); + $query .= $this->_getWhereClause($searchClause); $retval = (int)PMA_DBI_fetch_value($query); } else { $query = "SHOW DATABASES "; @@ -412,11 +401,11 @@ class Node /** * Returns the WHERE clause depending on the $searchClause parameter - * and the hide_db directive + * and the hide_db directive * * @param string $searchClause A string used to filter the results of the query * - * @return string + * @return string */ private function _getWhereClause($searchClause = '') { diff --git a/libraries/navigation/Nodes/Node_Column.class.php b/libraries/navigation/Nodes/Node_Column.class.php index 9c663e7ad0..083c6e41d5 100644 --- a/libraries/navigation/Nodes/Node_Column.class.php +++ b/libraries/navigation/Nodes/Node_Column.class.php @@ -41,31 +41,6 @@ class Node_Column extends Node . '&token=' . $GLOBALS['token'] ); } - - /** - * Returns the comment associated with node - * This method should be overridden by specific type of nodes - * - * @return string - */ - public function getComment() - { - $db = PMA_Util::sqlAddSlashes( - $this->realParent()->realParent()->real_name - ); - $table = PMA_Util::sqlAddSlashes( - $this->realParent()->real_name - ); - $column = PMA_Util::sqlAddSlashes( - $this->real_name - ); - $query = "SELECT `COLUMN_COMMENT` "; - $query .= "FROM `INFORMATION_SCHEMA`.`COLUMNS` "; - $query .= "WHERE `TABLE_SCHEMA`='$db' "; - $query .= "AND `TABLE_NAME`='$table' "; - $query .= "AND `COLUMN_NAME`='$column' "; - return PMA_DBI_fetch_value($query); - } } ?> diff --git a/libraries/navigation/Nodes/Node_Database.class.php b/libraries/navigation/Nodes/Node_Database.class.php index 5c0815f408..45ff0c12a0 100644 --- a/libraries/navigation/Nodes/Node_Database.class.php +++ b/libraries/navigation/Nodes/Node_Database.class.php @@ -430,18 +430,6 @@ class Node_Database extends Node } return $retval; } - - - /** - * Returns the comment associated with node - * This method should be overridden by specific type of nodes - * - * @return string - */ - public function getComment() - { - return PMA_getDbComment($this->real_name); - } } ?> diff --git a/libraries/navigation/Nodes/Node_Event.class.php b/libraries/navigation/Nodes/Node_Event.class.php index 5b82999608..021521b07e 100644 --- a/libraries/navigation/Nodes/Node_Event.class.php +++ b/libraries/navigation/Nodes/Node_Event.class.php @@ -40,27 +40,6 @@ class Node_Event extends Node ); $this->classes = 'event'; } - - /** - * Returns the comment associated with node - * This method should be overridden by specific type of nodes - * - * @return string - */ - public function getComment() - { - $db = PMA_Util::sqlAddSlashes( - $this->realParent()->real_name - ); - $event = PMA_Util::sqlAddSlashes( - $this->real_name - ); - $query = "SELECT `EVENT_COMMENT` "; - $query .= "FROM `INFORMATION_SCHEMA`.`EVENTS` "; - $query .= "WHERE `EVENT_SCHEMA`='$db' "; - $query .= "AND `EVENT_NAME`='$event' "; - return PMA_DBI_fetch_value($query); - } } ?> diff --git a/libraries/navigation/Nodes/Node_Function.class.php b/libraries/navigation/Nodes/Node_Function.class.php index f6e01a5e45..98ac61f767 100644 --- a/libraries/navigation/Nodes/Node_Function.class.php +++ b/libraries/navigation/Nodes/Node_Function.class.php @@ -40,28 +40,6 @@ class Node_Function extends Node ); $this->classes = 'function'; } - - /** - * Returns the comment associated with node - * This method should be overridden by specific type of nodes - * - * @return string - */ - public function getComment() - { - $db = PMA_Util::sqlAddSlashes( - $this->realParent()->real_name - ); - $routine = PMA_Util::sqlAddSlashes( - $this->real_name - ); - $query = "SELECT `ROUTINE_COMMENT` "; - $query .= "FROM `INFORMATION_SCHEMA`.`ROUTINES` "; - $query .= "WHERE `ROUTINE_SCHEMA`='$db' "; - $query .= "AND `ROUTINE_NAME`='$routine' "; - $query .= "AND `ROUTINE_TYPE`='FUNCTION' "; - return PMA_DBI_fetch_value($query); - } } ?> diff --git a/libraries/navigation/Nodes/Node_Procedure.class.php b/libraries/navigation/Nodes/Node_Procedure.class.php index e89fe2f98d..5b13f8d06d 100644 --- a/libraries/navigation/Nodes/Node_Procedure.class.php +++ b/libraries/navigation/Nodes/Node_Procedure.class.php @@ -40,28 +40,6 @@ class Node_Procedure extends Node ); $this->classes = 'procedure'; } - - /** - * Returns the comment associated with node - * This method should be overridden by specific type of nodes - * - * @return string - */ - public function getComment() - { - $db = PMA_Util::sqlAddSlashes( - $this->realParent()->real_name - ); - $routine = PMA_Util::sqlAddSlashes( - $this->real_name - ); - $query = "SELECT `ROUTINE_COMMENT` "; - $query .= "FROM `INFORMATION_SCHEMA`.`ROUTINES` "; - $query .= "WHERE `ROUTINE_SCHEMA`='$db' "; - $query .= "AND `ROUTINE_NAME`='$routine' "; - $query .= "AND `ROUTINE_TYPE`='PROCEDURE' "; - return PMA_DBI_fetch_value($query); - } } ?> diff --git a/libraries/navigation/Nodes/Node_Table.class.php b/libraries/navigation/Nodes/Node_Table.class.php index c5449d9228..08d620888f 100644 --- a/libraries/navigation/Nodes/Node_Table.class.php +++ b/libraries/navigation/Nodes/Node_Table.class.php @@ -197,33 +197,6 @@ class Node_Table extends Node } return $retval; } - - /** - * Returns the comment associated with node - * This method should be overridden by specific type of nodes - * - * @return string - */ - public function getComment() - { - $db = $this->realParent()->real_name; - $table = PMA_Util::sqlAddSlashes($this->real_name); - if (! $GLOBALS['cfg']['Servers'][$GLOBALS['server']]['DisableIS']) { - $db = PMA_Util::sqlAddSlashes($db); - $query = "SELECT `TABLE_COMMENT` "; - $query .= "FROM `INFORMATION_SCHEMA`.`TABLES` "; - $query .= "WHERE `TABLE_SCHEMA`='$db' "; - $query .= "AND `TABLE_NAME`='$table' "; - $retval = PMA_DBI_fetch_value($query); - } else { - $db = PMA_Util::backquote($db); - $query = "SHOW TABLE STATUS FROM $db "; - $query .= "WHERE Name = '$table'"; - $arr = PMA_DBI_fetch_assoc(PMA_DBI_try_query($query)); - $retval = $arr['Comment']; - } - return $retval; - } } ?> diff --git a/test/classes/navigation/PMA_Node_test.php b/test/classes/navigation/PMA_Node_test.php index c72c7fcfe3..24e5094ba1 100644 --- a/test/classes/navigation/PMA_Node_test.php +++ b/test/classes/navigation/PMA_Node_test.php @@ -155,14 +155,5 @@ class Node_test extends PHPUnit_Framework_TestCase $parent->addChild($child); $this->assertEquals($child->hasSiblings(), false); } - - public function testComment() - { - // A non-qualified Node shouldn't have a comment - $this->assertEquals( - PMA_NodeFactory::getInstance()->getComment(), - '' - ); - } } ?>