diff --git a/ChangeLog b/ChangeLog index d04e5ad50..3bc87aa69 100755 --- a/ChangeLog +++ b/ChangeLog @@ -42,6 +42,8 @@ $Source$ indicators. * libraries/mysql_charsets.lib.php: Don't check the character set of the virtual database "information_schema" (MySQL 5.0). + * db_details_links.php, db_details_structure.php: Don't allow the user to + change anything in MySQL 5.0's information_schema database. 2005-03-05 Marc Delisle * tbl_alter.php, tbl_addfield.php, db_datadict.php, pdf_schema.php, diff --git a/db_details_links.php b/db_details_links.php index 749aa8a64..c5bc36386 100644 --- a/db_details_links.php +++ b/db_details_links.php @@ -40,6 +40,9 @@ if (!$cfg['AllowUserDropDatabase']) { $cfg['AllowUserDropDatabase'] = PMA_DBI_select_db('mysql'); PMA_DBI_select_db($db); } +// rabus: Don't even try to drop information_schema. You won't be able to. +// Believe me. You won't. +$cfg['AllowUserDropDatabase'] = $cfg['AllowUserDropDatabase'] && !(PMA_MYSQL_INT_VERSION >= 50000 && $db == 'information_schema'); if ($cfg['AllowUserDropDatabase']) { $lnk5 = 'sql.php'; $arg5 = $url_query . '&sql_query=' diff --git a/db_details_structure.php b/db_details_structure.php index 984aabcc3..01ebd9242 100644 --- a/db_details_structure.php +++ b/db_details_structure.php @@ -34,7 +34,7 @@ if (PMA_MYSQL_INT_VERSION >= 40101) { // Display function -function pma_TableHeader($alternate = FALSE) { +function pma_TableHeader($alternate = FALSE, $record_count = TRUE) { $cnt = 0; // Let's count the columns... echo ' ' . "\n" . ' ' . "\n" @@ -44,11 +44,14 @@ function pma_TableHeader($alternate = FALSE) { . ' ' . "\n" . ' ' . "\n" - . ' ' . "\n"; - $cnt += 4; + $cnt += 3; + if ($record_count) { + echo ' ' . "\n"; + $cnt++; + } if (!$alternate) { if (!($GLOBALS['cfg']['PropertiesNumColumns'] > 1)) { echo ' > - + @@ -314,18 +338,27 @@ else { $drop_message = sprintf(($is_view ? $strViewHasBeenDropped : $strTableHasBeenDropped), htmlspecialchars($table)); ?> - to get valid // statistics whatever is the table type - if (isset($sts_data['Rows'])) { + if (isset($sts_data['Rows']) || (PMA_MYSQL_INT_VERSION >= 50000 && $db == 'information_schema')) { // MyISAM, ISAM or Heap table: Row count, data size and index size // is accurate. if (isset($sts_data['Type']) && preg_match('@^(MyISAM|ISAM|HEAP)$@', $sts_data['Type'])) { @@ -386,13 +419,16 @@ else { } $display_rows = 'unknown'; } - ?> + // Don't display number of rows for information_schema tables. + if (!(PMA_MYSQL_INT_VERSION >= 50000 && $db == 'information_schema')) { + ?> - 1)) { echo ' - + - - + + @@ -473,13 +509,21 @@ else { + = 50000 && $db == 'information_schema') { + ?> + + - 1)) { echo '
' . "\n" . '  ' . $GLOBALS['strAction'] . ' ' . "\n" - . ' ' . "\n" - . '  ' . $GLOBALS['strRecords'] . PMA_showHint($GLOBALS['strApproximateCount']) . ' ' . "\n" . ' ' . "\n" + . '  ' . $GLOBALS['strRecords'] . PMA_showHint($GLOBALS['strApproximateCount']) . ' ' . "\n" + . ' ' . "\n" @@ -108,8 +111,10 @@ if ($cfg['PropertiesIconic'] == true) { $titles['NoBrowse'] = $iconic_spacer . '' . $strBrowse . ''; $titles['NoSearch'] = $iconic_spacer . '' . $strSearch . ''; $titles['Insert'] = $iconic_spacer . '' . $strInsert . ''; + $titles['NoInsert'] = $iconic_spacer . '' . $strInsert . ''; //TODO: we need a proper disabled icon here. $titles['Structure'] = $iconic_spacer . '' . $strStructure . ''; $titles['Drop'] = $iconic_spacer . '' . $strDrop . ''; + $titles['NoDrop'] = $iconic_spacer . '' . $strDrop . ''; $titles['Empty'] = $iconic_spacer . '' . $strEmpty . ''; $titles['NoEmpty'] = $iconic_spacer . '' . $strEmpty . ''; @@ -119,8 +124,10 @@ if ($cfg['PropertiesIconic'] == true) { $titles['NoBrowse'] .= ' ' . $strBrowse . ''; $titles['NoSearch'] .= ' ' . $strSearch . ''; $titles['Insert'] .= ' ' . $strInsert . ''; + $titles['NoInsert'] .= ' ' . $strInsert . ''; $titles['Structure'] .= ' ' . $strStructure . ''; $titles['Drop'] .= ' ' . $strDrop . ''; + $titles['NoDrop'] .= ' ' . $strDrop . ''; $titles['Empty'] .= ' ' . $strEmpty . ''; $titles['NoEmpty'] .= ' ' . $strEmpty . ''; } @@ -130,8 +137,10 @@ if ($cfg['PropertiesIconic'] == true) { $titles['NoBrowse'] = $strBrowse; $titles['NoSearch'] = $strSearch; $titles['Insert'] = $strInsert; + $titles['NoInsert'] = $strInsert; $titles['Structure'] = $strStructure; $titles['Drop'] = $strDrop; + $titles['NoDrop'] = $strDrop; $titles['Empty'] = $strEmpty; $titles['NoEmpty'] = $strEmpty; } @@ -171,7 +180,13 @@ else { = 50000 && $db == 'information_schema') { + $cfg['ShowStats'] = FALSE; + pma_TableHeader(FALSE, FALSE); + } else { + pma_TableHeader(); + } $i = $sum_entries = 0; (double) $sum_size = 0; @@ -199,9 +214,9 @@ else { $table = $sts_data['Name']; $table_encoded = urlencode($table); $table_name = htmlspecialchars($table); - $is_view = (PMA_MYSQL_INT_VERSION >= 50000 - && !isset($sts_data['Type']) - && $sts_data['Comment'] == 'view'); + $is_view = (PMA_MYSQL_INT_VERSION >= 50000 + && !isset($sts_data['Type']) + && $sts_data['Comment'] == 'view'); $alias = (!empty($tooltip_aliasname) && isset($tooltip_aliasname[$table])) ? htmlspecialchars($tooltip_aliasname[$table]) @@ -238,16 +253,16 @@ else { = 50000 && $db == 'information_schema')); } ?>
/> - + if ($is_view) { + ?> + @@ -260,7 +275,7 @@ else { require_once('./libraries/bookmark.lib.php'); $book_sql_query = PMA_queryBookmarks($db, $cfg['Bookmark'], '\'' . PMA_sqlAddslashes($table) . '\'', 'label'); - if (!empty($sts_data['Rows']) || $is_view) { + if (!empty($sts_data['Rows']) || $is_view || (PMA_MYSQL_INT_VERSION >= 50000 && $db == 'information_schema')) { echo '' . $titles['Browse'] . ''; @@ -271,7 +286,7 @@ else { = 50000 && $db == 'information_schema')) { echo '' . $titles['Search'] . ''; } else { @@ -280,10 +295,19 @@ else { ?> + = 50000 && $db == 'information_schema') { + // rabus: We cannot insert into information_schema tables! + echo $titles['NoInsert']; + } else { + ?> - + + + + = 50000 && $db == 'information_schema') { + echo $titles['NoDrop']; + } else { + ?> + > - + ' . "\n" . '  ' . (isset($sts_data['Type']) ? $sts_data['Type'] : ' ') . ' ' . "\n" @@ -426,21 +462,21 @@ else { = 50000 && $sts_data['Comment'] == 'view') { - // rabus: We've found a view - ?> - -  -  - + } else if (PMA_MYSQL_INT_VERSION >= 50000 && $sts_data['Comment'] == 'view') { + // rabus: We've found a view + ?> + +  -  +    -  ---  - +  ---  +  -       ' . "\n" . ' --' . "\n"