Skip to content

Commit

Permalink
Remove Drizzle support from navigation and menu
Browse files Browse the repository at this point in the history
Signed-off-by: Madhura Jayaratne <madhura.cj@gmail.com>
  • Loading branch information
madhuracj committed Sep 9, 2015
1 parent 8dcb93c commit 81b54ee
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 60 deletions.
72 changes: 27 additions & 45 deletions libraries/Menu.class.php
Expand Up @@ -352,7 +352,7 @@ private function _getTableTabs()
$tabs['import']['text'] = __('Import');
}
if (($is_superuser || $isCreateOrGrantUser)
&& ! PMA_DRIZZLE && ! $db_is_system_schema
&& ! $db_is_system_schema
) {
$tabs['privileges']['link'] = 'server_privileges.php';
$tabs['privileges']['args']['checkprivsdb'] = $this->_db;
Expand Down Expand Up @@ -385,7 +385,6 @@ private function _getTableTabs()
$tabs['tracking']['link'] = 'tbl_tracking.php';
}
if (! $db_is_system_schema
&& ! PMA_DRIZZLE
&& PMA_Util::currentUserHasPrivilege(
'TRIGGER',
$this->_db,
Expand Down Expand Up @@ -459,29 +458,26 @@ private function _getDbTabs()
$tabs['operation']['text'] = __('Operations');
$tabs['operation']['icon'] = 'b_tblops.png';

if (($is_superuser || $isCreateOrGrantUser) && ! PMA_DRIZZLE) {
if (($is_superuser || $isCreateOrGrantUser)) {
$tabs['privileges']['link'] = 'server_privileges.php';
$tabs['privileges']['args']['checkprivsdb'] = $this->_db;
// stay on database view
$tabs['privileges']['args']['viewing_mode'] = 'db';
$tabs['privileges']['text'] = __('Privileges');
$tabs['privileges']['icon'] = 's_rights.png';
}
if (! PMA_DRIZZLE) {
$tabs['routines']['link'] = 'db_routines.php';
$tabs['routines']['text'] = __('Routines');
$tabs['routines']['icon'] = 'b_routines.png';
}
if (! PMA_DRIZZLE
&& PMA_Util::currentUserHasPrivilege('EVENT', $this->_db)
) {

$tabs['routines']['link'] = 'db_routines.php';
$tabs['routines']['text'] = __('Routines');
$tabs['routines']['icon'] = 'b_routines.png';

if (PMA_Util::currentUserHasPrivilege('EVENT', $this->_db)) {
$tabs['events']['link'] = 'db_events.php';
$tabs['events']['text'] = __('Events');
$tabs['events']['icon'] = 'b_events.png';
}
if (! PMA_DRIZZLE
&& PMA_Util::currentUserHasPrivilege('TRIGGER', $this->_db)
) {

if (PMA_Util::currentUserHasPrivilege('TRIGGER', $this->_db)) {
$tabs['triggers']['link'] = 'db_triggers.php';
$tabs['triggers']['text'] = __('Triggers');
$tabs['triggers']['icon'] = 'b_triggers.png';
Expand Down Expand Up @@ -522,19 +518,17 @@ private function _getServerTabs()
$isCreateOrGrantUser = $GLOBALS['dbi']->isUserType('grant')
|| $GLOBALS['dbi']->isUserType('create');
$binary_logs = null;
if (! defined('PMA_DRIZZLE') || ! PMA_DRIZZLE) {
if (PMA_Util::cacheExists('binary_logs')) {
$binary_logs = PMA_Util::cacheGet('binary_logs');
} else {
$binary_logs = $GLOBALS['dbi']->fetchResult(
'SHOW MASTER LOGS',
'Log_name',
null,
null,
PMA_DatabaseInterface::QUERY_STORE
);
PMA_Util::cacheSet('binary_logs', $binary_logs);
}
if (PMA_Util::cacheExists('binary_logs')) {
$binary_logs = PMA_Util::cacheGet('binary_logs');
} else {
$binary_logs = $GLOBALS['dbi']->fetchResult(
'SHOW MASTER LOGS',
'Log_name',
null,
null,
PMA_DatabaseInterface::QUERY_STORE
);
PMA_Util::cacheSet('binary_logs', $binary_logs);
}

$tabs = array();
Expand Down Expand Up @@ -562,7 +556,7 @@ private function _getServerTabs()
)
);

if (($is_superuser || $isCreateOrGrantUser) && ! PMA_DRIZZLE) {
if ($is_superuser || $isCreateOrGrantUser) {
$tabs['rights']['icon'] = 's_rights.png';
$tabs['rights']['link'] = 'server_privileges.php';
$tabs['rights']['text'] = __('User accounts');
Expand Down Expand Up @@ -595,7 +589,7 @@ private function _getServerTabs()
$tabs['binlog']['text'] = __('Binary log');
}

if ($is_superuser && ! PMA_DRIZZLE) {
if ($is_superuser) {
$tabs['replication']['icon'] = 's_replication.png';
$tabs['replication']['link'] = 'server_replication.php';
$tabs['replication']['text'] = __('Replication');
Expand All @@ -609,22 +603,10 @@ private function _getServerTabs()
$tabs['charset']['link'] = 'server_collations.php';
$tabs['charset']['text'] = __('Charsets');

if (defined('PMA_DRIZZLE') && PMA_DRIZZLE) {
$tabs['plugins']['icon'] = 'b_engine.png';
$tabs['plugins']['link'] = 'server_plugins.php';
$tabs['plugins']['text'] = __('Plugins');
$tabs['plugins']['active'] = in_array(
basename($GLOBALS['PMA_PHP_SELF']),
array(
'server_plugins.php',
'server_modules.php',
)
);
} else {
$tabs['engine']['icon'] = 'b_engine.png';
$tabs['engine']['link'] = 'server_engines.php';
$tabs['engine']['text'] = __('Engines');
}
$tabs['engine']['icon'] = 'b_engine.png';
$tabs['engine']['link'] = 'server_engines.php';
$tabs['engine']['text'] = __('Engines');

return $tabs;
}

Expand Down
4 changes: 1 addition & 3 deletions libraries/navigation/NavigationTree.class.php
Expand Up @@ -1249,9 +1249,7 @@ public function renderDbSelect()
. ' apath="' . $paths['aPath'] . '"'
. ' vpath="' . $paths['vPath'] . '"'
. ' pos="' . $this->_pos . '"';
if ($node->real_name == $selected
|| (PMA_DRIZZLE && strtolower($node->real_name) == strtolower($selected))
) {
if ($node->real_name == $selected) {
$retval .= ' selected="selected"';
}
$retval .= '>' . htmlspecialchars($node->real_name);
Expand Down
16 changes: 4 additions & 12 deletions libraries/navigation/Nodes/Node_Database.class.php
Expand Up @@ -111,16 +111,12 @@ private function _getTableOrViewCount($which, $searchClause, $singleItem)
$condition = '!=';
}

if (! $GLOBALS['cfg']['Server']['DisableIS'] || PMA_DRIZZLE) {
if (! $GLOBALS['cfg']['Server']['DisableIS']) {
$db = PMA_Util::sqlAddSlashes($db);
$query = "SELECT COUNT(*) ";
$query .= "FROM `INFORMATION_SCHEMA`.`TABLES` ";
$query .= "WHERE `TABLE_SCHEMA`='$db' ";
if (PMA_DRIZZLE) {
$query .= "AND `TABLE_TYPE`" . $condition . "'BASE' ";
} else {
$query .= "AND `TABLE_TYPE`" . $condition . "'BASE TABLE' ";
}
$query .= "AND `TABLE_TYPE`" . $condition . "'BASE TABLE' ";
if (! empty($searchClause)) {
$query .= "AND " . $this->_getWhereClauseForSearch(
$searchClause, $singleItem, 'TABLE_NAME'
Expand Down Expand Up @@ -421,16 +417,12 @@ private function _getTablesOrViews($which, $pos, $searchClause)
$maxItems = $GLOBALS['cfg']['MaxNavigationItems'];
$retval = array();
$db = $this->real_name;
if (! $GLOBALS['cfg']['Server']['DisableIS'] || PMA_DRIZZLE) {
if (! $GLOBALS['cfg']['Server']['DisableIS']) {
$escdDb = PMA_Util::sqlAddSlashes($db);
$query = "SELECT `TABLE_NAME` AS `name` ";
$query .= "FROM `INFORMATION_SCHEMA`.`TABLES` ";
$query .= "WHERE `TABLE_SCHEMA`='$escdDb' ";
if (PMA_DRIZZLE) {
$query .= "AND `TABLE_TYPE`" . $condition . "'BASE' ";
} else {
$query .= "AND `TABLE_TYPE`" . $condition . "'BASE TABLE' ";
}
$query .= "AND `TABLE_TYPE`" . $condition . "'BASE TABLE' ";
if (! empty($searchClause)) {
$query .= "AND `TABLE_NAME` LIKE '%";
$query .= PMA_Util::sqlAddSlashes(
Expand Down

0 comments on commit 81b54ee

Please sign in to comment.