diff --git a/libraries/structure.lib.php b/libraries/structure.lib.php index 837ec0e532..51ef798b21 100644 --- a/libraries/structure.lib.php +++ b/libraries/structure.lib.php @@ -13,15 +13,15 @@ if (!defined('PHPMYADMIN')) { /** * Get the HTML links for action links * Actions are, Browse, Search, Browse table label, empty table - * - * @param array $current_table current table + * + * @param array $current_table current table * @param boolean $table_is_view Is table view or not - * @param string $tbl_url_query table url query - * @param array $titles titles and icons for action links - * @param string $truename table name + * @param string $tbl_url_query table url query + * @param array $titles titles and icons for action links + * @param string $truename table name * @param boolean $db_is_information_schema is database information schema or not - * @param string $url_query url query - * + * @param string $url_query url query + * * @return array ($browse_table, $search_table, $browse_table_label, $empty_table, $tracking_icon) */ @@ -30,7 +30,7 @@ function PMA_getHtmlForActionLinks($current_table, $table_is_view, $tbl_url_quer ) { $common_functions = PMA_CommonFunctions::getInstance(); $empty_table = ''; - + if ($current_table['TABLE_ROWS'] > 0 || $table_is_view) { $may_have_rows = true; } else { @@ -54,7 +54,7 @@ function PMA_getHtmlForActionLinks($current_table, $table_is_view, $tbl_url_quer $search_table .= ''; $browse_table_label = '' - . $truename . ''; + . $truename . ''; if (!$db_is_information_schema) { $empty_table = 'backquote($current_table['TABLE_NAME']) - ) - . '&message_to_show=' + 'TRUNCATE ' . $common_functions->backquote($current_table['TABLE_NAME']) + ); + $empty_table .= '&message_to_show=' . urlencode( - sprintf(__('Table %s has been emptied'), - htmlspecialchars($current_table['TABLE_NAME'])) + sprintf( + __('Table %s has been emptied'), + htmlspecialchars($current_table['TABLE_NAME']) + ) ) . '">'; if ($may_have_rows) { @@ -114,10 +115,10 @@ function PMA_getHtmlForActionLinks($current_table, $table_is_view, $tbl_url_quer /** * Get table drop query and drop message - * - * @param boolean $table_is_view Is table view or not - * @param string $current_table current table - * + * + * @param boolean $table_is_view Is table view or not + * @param string $current_table current table + * * @return array ($drop_query, $drop_message) */ function PMA_getTableDropQueryAndMessage($table_is_view, $current_table) @@ -142,20 +143,20 @@ function PMA_getTableDropQueryAndMessage($table_is_view, $current_table) /** * Get HTML body for table summery - * - * @param integer $num_tables number of tables - * @param boolean $server_slave_status server slave state - * @param boolean $db_is_information_schema whether database is information schema or not - * @param integer $sum_entries sum entries - * @param string $db_collation collation of given db - * @param boolean $is_show_stats whether stats is show or not - * @param double $sum_size sum size - * @param double $overhead_size overhead size - * @param string $create_time_all create time - * @param string $update_time_all update time - * @param string $check_time_all check time - * @param integer $sum_row_count_pre sum row count pre - * + * + * @param integer $num_tables number of tables + * @param boolean $server_slave_status server slave state + * @param boolean $db_is_information_schema whether database is information schema or not + * @param integer $sum_entries sum entries + * @param string $db_collation collation of given db + * @param boolean $is_show_stats whether stats is show or not + * @param double $sum_size sum size + * @param double $overhead_size overhead size + * @param string $create_time_all create time + * @param string $update_time_all update time + * @param string $check_time_all check time + * @param integer $sum_row_count_pre sum row count pre + * * @return string $html_output */ function PMA_getHtmlBodyForTableSummary($num_tables, $server_slave_status, @@ -210,27 +211,27 @@ function PMA_getHtmlBodyForTableSummary($num_tables, $server_slave_status, if (! empty($db_collation)) { $html_output .= '' + . PMA_getCollationDescr($db_collation) + . ' (' . __('Default') . ')">' . $db_collation . ''; } $html_output .= ''; } if ($is_show_stats) { - $html_output .= '
| ' . "\n" - .' | ' - . PMA_sortableTableHeader(__('Table'), 'table') + .' | ' + . PMA_sortableTableHeader(__('Table'), 'table') . ' | ' . "\n"; if ($replication) { $html_output .= '' . "\n" @@ -782,42 +785,42 @@ function PMA_TableHeader($db_is_information_schema = false, $replication = false ) . "\n" .' | ' . "\n"; if (!($GLOBALS['cfg']['PropertiesNumColumns'] > 1)) { - $html_output .= '' . PMA_sortableTableHeader(__('Type'), 'type') + $html_output .= ' | ' . PMA_sortableTableHeader(__('Type'), 'type') . ' | ' . "\n"; $cnt++; - $html_output .= '' - . PMA_sortableTableHeader(__('Collation'), 'collation') + $html_output .= ' | ' + . PMA_sortableTableHeader(__('Collation'), 'collation') . ' | ' . "\n"; $cnt++; } if ($GLOBALS['is_show_stats']) { // larger values are more interesting so default sort order is DESC - $html_output .= '' + $html_output .= ' | ' . PMA_sortableTableHeader(__('Size'), 'size', 'DESC') . ' | ' . "\n" // larger values are more interesting so default sort order is DESC - . '' - . PMA_sortableTableHeader(__('Overhead'), 'overhead', 'DESC') + . ' | ' + . PMA_sortableTableHeader(__('Overhead'), 'overhead', 'DESC') . ' | ' . "\n"; $cnt += 2; } if ($GLOBALS['cfg']['ShowDbStructureCreation']) { // larger values are more interesting so default sort order is DESC - $html_output .= '' + $html_output .= ' | ' . PMA_sortableTableHeader(__('Creation'), 'creation', 'DESC') . ' | ' . "\n"; $cnt += 2; } if ($GLOBALS['cfg']['ShowDbStructureLastUpdate']) { // larger values are more interesting so default sort order is DESC - $html_output .= '' - . PMA_sortableTableHeader(__('Last update'), 'last_update', 'DESC') + $html_output .= ' | ' + . PMA_sortableTableHeader(__('Last update'), 'last_update', 'DESC') . ' | ' . "\n"; $cnt += 2; } if ($GLOBALS['cfg']['ShowDbStructureLastCheck']) { // larger values are more interesting so default sort order is DESC - $html_output .= '' + $html_output .= ' | ' . PMA_sortableTableHeader(__('Last check'), 'last_check', 'DESC') . ' | ' . "\n"; $cnt += 2; @@ -826,7 +829,7 @@ function PMA_TableHeader($db_is_information_schema = false, $replication = false $html_output .= '' . __('Null') . ' | ' . '' . __('Default') . ' | ' . '' . __('Extra') . ' | '; - + if ($db_is_information_schema || $tbl_is_view) { $html_output .= '' . __('View') . ' | '; - } else { /* see tbl_structure.js, function moreOptsMenuResize() */ + } else { /* see tbl_structure.js, function moreOptsMenuResize() */ $colspan = 9; if (PMA_DRIZZLE) { $colspan -= 2; @@ -1209,37 +1211,37 @@ function PMA_getHtmlForTableStructureHeader( $colspan--; } $html_output .= '' . __('Action') . ' | '; + . 'class="action">' . __('Action') . ''; } $html_output .= '' . ''; - + return $html_output; } /** * Get HTML for structure table's rows and return $odd_row parameter also * For "Action" Column, this function contains only HTML code for "Change" and "Drop" - * - * @param array $row current row - * @param string $rownum row number - * @param string $checked checked - * @param string $displayed_field_name displayed field name - * @param string $type_nowrap type nowrap - * @param array $extracted_columnspec associative array containing type, - * spec_in_brackets - * and possibly enum_set_values (another array) - * @param string $type_mime mime type - * @param string $field_charset field charset - * @param string $attribute attribute (BINARY, UNSIGNED, + * + * @param array $row current row + * @param string $rownum row number + * @param string $checked checked + * @param string $displayed_field_name displayed field name + * @param string $type_nowrap type nowrap + * @param array $extracted_columnspec associative array containing type, + * spec_in_brackets and possibly + * enum_set_values (another array) + * @param string $type_mime mime type + * @param string $field_charset field charset + * @param string $attribute attribute (BINARY, UNSIGNED, * UNSIGNED ZEROFILL, on update CURRENT_TIMESTAMP) * @param boolean $tbl_is_view whether tables is view or not * @param boolean $db_is_information_schema whether db is information schema or not - * @param string $url_query url query - * @param string $field_encoded field encoded - * @param array $titles tittles array - * @param string $table table - * + * @param string $url_query url query + * @param string $field_encoded field encoded + * @param array $titles tittles array + * @param string $table table + * * @return array ($html_output, $odd_row) */ function PMA_getHtmlTableStructureRow($row, $rownum, $checked, @@ -1248,40 +1250,40 @@ function PMA_getHtmlTableStructureRow($row, $rownum, $checked, $url_query, $field_encoded, $titles, $table ) { $common_functions = PMA_CommonFunctions::getInstance(); - + $html_output = '' . '' . ' | '; - + $html_output .= '' . $rownum . ' | '; - + $html_output .= '' - . ' | '; - - $html_output .= '' + + $html_output .= ' | ' .'' - . $extracted_columnspec['displayed_type'] . $type_mime + . $extracted_columnspec['displayed_type'] . $type_mime . ' | '; - - $html_output .= '' .
- (empty($field_charset)
- ? ''
- : ''
+
+ $html_output .= '| ' .
+ (empty($field_charset)
+ ? ''
+ : ''
. $field_charset . ''
- )
+ )
. ' | ';
-
+
$html_output .= ''
. $attribute . ' | ';
- $html_output .= ''
+ $html_output .= ' | '
. (($row['Null'] == 'YES') ? __('Yes') : __('No')) . ' | ';
-
+
$html_output .= '';
if (isset($row['Default'])) {
if ($extracted_columnspec['type'] == 'bit') {
@@ -1294,11 +1296,12 @@ function PMA_getHtmlTableStructureRow($row, $rownum, $checked,
$html_output .= '' . _pgettext('None for default', 'None') . '';
}
$html_output .= ' | ';
-
+
$html_output .= '' . strtoupper($row['Extra']) . ' | ';
-
- $html_output .= PMA_getHtmlForDropColumn($tbl_is_view,
- $db_is_information_schema, $url_query, $field_encoded,
+
+ $html_output .= PMA_getHtmlForDropColumn(
+ $tbl_is_view, $db_is_information_schema,
+ $url_query, $field_encoded,
$titles, $table, $row
);
@@ -1307,15 +1310,15 @@ function PMA_getHtmlTableStructureRow($row, $rownum, $checked,
/**
* Get HTML code for "Drop" Action link
- *
+ *
* @param boolean $tbl_is_view whether tables is view or not
* @param boolean $db_is_information_schema whether db is information schema or not
- * @param string $url_query url query
- * @param string $field_encoded field encoded
- * @param array $titles tittles array
- * @param string $table table
- * @param array $row current row
- *
+ * @param string $url_query url query
+ * @param string $field_encoded field encoded
+ * @param array $titles tittles array
+ * @param string $table table
+ * @param array $row current row
+ *
* @return string $html_output
*/
function PMA_getHtmlForDropColumn($tbl_is_view, $db_is_information_schema,
@@ -1323,57 +1326,60 @@ function PMA_getHtmlForDropColumn($tbl_is_view, $db_is_information_schema,
) {
$common_functions = PMA_CommonFunctions::getInstance();
$html_output = '';
-
+
if (! $tbl_is_view && ! $db_is_information_schema) {
$html_output .= ''
. ''
. $titles['Change'] . '' . ' | ';
$html_output .= ''
- . ''
. $titles['Drop'] . ''
. ' | ';
}
-
+
return $html_output;
}
/**
* Get HTML for "check all" check box with "with selected" actions in table structure
- *
- * @param string $pmaThemeImage pma theme image url
- * @param string $text_dir test directory
+ *
+ * @param string $pmaThemeImage pma theme image url
+ * @param string $text_dir test directory
* @param boolean $tbl_is_view whether table is view or not
* @param boolean $db_is_information_schema whether db is information schema or not
- * @param string $tbl_storage_engine table storage engine
- *
+ * @param string $tbl_storage_engine table storage engine
+ *
* @return string $html_output
*/
function PMA_getHtmlForCheckAllTableColumn($pmaThemeImage, $text_dir,
$tbl_is_view, $db_is_information_schema, $tbl_storage_engine
) {
$common_functions = PMA_CommonFunctions::getInstance();
-
+
$html_output = '' . $value . ' | ';
$html_output .= '' . $unit . ' | ';
$html_output .= '';
-
+
return $html_output;
}
/**
* Get HTML for Optimize link if overhead in Information fieldset
- *
- * @param type $url_query URL query
- *
+ *
+ * @param type $url_query URL query
+ *
* @return string $html_output
*/
function PMA_getHtmlForOptimizeLink($url_query)
{
$common_functions = PMA_CommonFunctions::getInstance();
-
+
$html_output = '';
- $html_output .= 'backquote($GLOBALS['table'])
)
@@ -1674,54 +1681,54 @@ function PMA_getHtmlForOptimizeLink($url_query)
. '';
$html_output .= ' | ';
$html_output .= '' . $name . ' | ';
$html_output .= '' . $value . ' | ';
$html_output .= '';
if ($isActionEnabled) {
- $html_output .= 'backquote($GLOBALS['table'])
- . ($isPrimary ? ($primary ? ' DROP PRIMARY KEY,' : '') : '')
- . ' ' . $syntax . '('
- . $common_functions->backquote($row['Field']) . ');'
- )
+ 'ALTER TABLE ' . $common_functions->backquote($GLOBALS['table'])
+ . ($isPrimary ? ($primary ? ' DROP PRIMARY KEY,' : '') : '')
+ . ' ' . $syntax . '('
+ . $common_functions->backquote($row['Field']) . ');'
+ )
. '&message_to_show=' . urlencode(
sprintf(
$message,
@@ -1853,48 +1869,48 @@ function PMA_getHtmlDivsForStructureActionsDropdown($class, $isActionEnabled,
)
. '">'
. $hidden_titles
- . '';
+ . '';
} else {
$html_output .= $hidden_titles_no;
}
$html_output .= ' ';
-
+
return $html_output;
}
/**
* Get HTML snippet for more option in table structure
- *
- * @param type $rownum row numbers
- * @param type $primary_enabled is primary enabled
- * @param type $url_query url query
- * @param type $row current row
- * @param type $hidden_titles hidden titles array
- * @param type $unique_enabled is unique enabled
- * @param type $unique_enabled is unique enabled
- * @param type $index_enabled is index enabled
- * @param type $fulltext_enabled is fulltext enabled
- * @param type $spatial_enabled is spatial enabled
- * @param type $primary primary
- *
+ *
+ * @param type $rownum row numbers
+ * @param type $primary_enabled is primary enabled
+ * @param type $url_query url query
+ * @param type $row current row
+ * @param type $hidden_titles hidden titles array
+ * @param type $unique_enabled is unique enabled
+ * @param type $unique_enabled is unique enabled
+ * @param type $index_enabled is index enabled
+ * @param type $fulltext_enabled is fulltext enabled
+ * @param type $spatial_enabled is spatial enabled
+ * @param type $primary primary
+ *
* @return string $html_output
*/
function PMA_getHtmlForMoreOptionInTableStructure($rownum, $primary_enabled,
- $url_query, $row, $hidden_titles, $unique_enabled, $index_enabled,
+ $url_query, $row, $hidden_titles, $unique_enabled, $index_enabled,
$fulltext_enabled, $spatial_enabled, $primary
) {
$common_functions = PMA_CommonFunctions::getInstance();
-
+
$html_output = '';
$html_output .= $common_functions->getImage(
'more.png', __('Show more actions')
) . __('More');
$html_output .= ' | ';
-
+
return $html_output;
}
/**
* Get HTML snippet for action row in structure table,
* This function returns common HTML ';
-
+
$class = ($GLOBALS['cfg']['AjaxEnable'] ? 'action_primary ' : '')
. 'replace_in_more';
- $html_output .= PMA_getHtmlDivsForStructureActionsDropdown($class,
- $primary_enabled, $url_query, $row, $hidden_titles['Primary'],
+ $html_output .= PMA_getHtmlDivsForStructureActionsDropdown(
+ $class, $primary_enabled, $url_query, $row, $hidden_titles['Primary'],
$hidden_titles['NoPrimary'], $primary, 'ADD PRIMARY KEY',
__('A primary key has been added on %s'), true
);
@@ -1928,94 +1944,97 @@ function PMA_getHtmlForMoreOptionInTableStructure($rownum, $primary_enabled,
$hidden_titles['NoIdxFulltext'], false, 'ADD FULLTEXT',
__('An index has been added on %s'), false
);
-
+
$html_output .= '';
}
$html_output .= ' for Primary, Unique, Index, Spatial actions
- *
- * @param array $type column type
- * @param array $tbl_storage_engine table storage engine
- * @param string $class class attribute for |
- * @param boolean $hasField has field
- * @param boolean $hasLinkClass has the class attribute
- * @param string $url_query url query
- * @param boolean $primary primary if set, false otherwise
- * @param string $syntax Sql syntax
- * @param string $message message to show
- * @param string $action action
- * @param array $titles titles array
- * @param array $row current row
- * @param boolean $isPrimary is primary action
- *
- * @return array $html_output, $action_enabled
+ *
+ * @param array $type column type
+ * @param array $tbl_storage_engine table storage engine
+ * @param string $class class attribute for |
+ * @param boolean $hasField has field
+ * @param boolean $hasLinkClass has the class attribute
+ * @param string $url_query url query
+ * @param boolean $primary primary if set, false otherwise
+ * @param string $syntax Sql syntax
+ * @param string $message message to show
+ * @param string $action action
+ * @param array $titles titles array
+ * @param array $row current row
+ * @param boolean $isPrimary is primary action
+ *
+ * @return array $html_output, $action_enabled
*/
function PMA_getHtmlForActionRowInStructureTable($type, $tbl_storage_engine,
$class, $hasField, $hasLinkClass, $url_query, $primary, $syntax,
$message, $action, $titles, $row, $isPrimary
) {
$common_functions = PMA_CommonFunctions::getInstance();
-
+
$html_output = ' | ';
-
- if ($type == 'text'
- || $type == 'blob'
- || 'ARCHIVE' == $tbl_storage_engine
+
+ if ($type == 'text'
+ || $type == 'blob'
+ || 'ARCHIVE' == $tbl_storage_engine
|| $hasField
) {
$html_output .= $titles['No' . $action] . "\n";
$action_enabled = false;
} else {
$html_output .= "\n";
- $html_output .= 'backquote($GLOBALS['table'])
. ($isPrimary ? ($primary ? ' DROP PRIMARY KEY,' : '') : '')
- . ' ' . $syntax . '('
+ . ' ' . $syntax . '('
. $common_functions->backquote($row['Field']) . ');'
)
. '&message_to_show=' . urlencode(
- sprintf($message,
- htmlspecialchars($row['Field']))
+ sprintf(
+ $message,
+ htmlspecialchars($row['Field'])
+ )
) . '" >'
. $titles[$action] . '';
$action_enabled = true;
}
$html_output .= "\n";
$html_output .= ' | ';
-
+
return array($html_output, $action_enabled);
}
/**
* Get HTML for fulltext action,
* and this function returns $fulltext_enabled boolean value also
- *
- * @param string $tbl_storage_engine table storage engine
- * @param string $type column type
- * @param string $url_query url query
- * @param array $row current row
- * @param array $titles titles array
- *
+ *
+ * @param string $tbl_storage_engine table storage engine
+ * @param string $type column type
+ * @param string $url_query url query
+ * @param array $row current row
+ * @param array $titles titles array
+ *
* @return type array $html_output, $fulltext_enabled
*/
function PMA_getHtmlForFullTextAction($tbl_storage_engine, $type, $url_query,
@@ -2023,25 +2042,28 @@ function PMA_getHtmlForFullTextAction($tbl_storage_engine, $type, $url_query,
) {
$common_functions = PMA_CommonFunctions::getInstance();
$html_output = '';
- if (! empty($tbl_storage_engine)
- && ($tbl_storage_engine == 'MYISAM'
- || $tbl_storage_engine == 'ARIA'
- || $tbl_storage_engine == 'MARIA'
- || ($tbl_storage_engine == 'INNODB'
- && PMA_MYSQL_INT_VERSION >= 50604)
- )
- && (strpos(' ' . $type, 'text') || strpos(' ' . $type, 'char'))
+ if (! empty($tbl_storage_engine)
+ && ($tbl_storage_engine == 'MYISAM'
+ || $tbl_storage_engine == 'ARIA'
+ || $tbl_storage_engine == 'MARIA'
+ || ($tbl_storage_engine == 'INNODB' && PMA_MYSQL_INT_VERSION >= 50604))
+ && (strpos(' ' . $type, 'text') || strpos(' ' . $type, 'char'))
) {
$html_output .= "\n";
- $html_output .= 'backquote($GLOBALS['table'])
- . ' ADD FULLTEXT(' . $common_functions->backquote($row['Field'])
- . ');') . '&message_to_show='
- . urlencode(sprintf(
+ 'ALTER TABLE ' . $common_functions->backquote($GLOBALS['table'])
+ . ' ADD FULLTEXT(' . $common_functions->backquote($row['Field'])
+ . ');'
+ )
+ . '&message_to_show='
+ . urlencode(
+ sprintf(
__('An index has been added on %s'),
- htmlspecialchars($row['Field']))
- ) . '">';
+ htmlspecialchars($row['Field'])
+ )
+ )
+ . '">';
$html_output .= $titles['IdxFulltext'] . '';
$fulltext_enabled = true;
$html_output .= ' | ';
@@ -2051,52 +2073,53 @@ function PMA_getHtmlForFullTextAction($tbl_storage_engine, $type, $url_query,
$fulltext_enabled = false;
$html_output .= ' | ';
}
-
+
return array($html_output, $fulltext_enabled);
}
/**
* Get HTML snippet for "Distinc Value" action
- *
+ *
* @param string $url_query url query
- * @param array $row current row
- * @param array $titles titles array
- *
+ * @param array $row current row
+ * @param array $titles titles array
+ *
* @return string $html_output
*/
function PMA_getHtmlForDistinctValueAction($url_query, $row, $titles)
{
$common_functions = PMA_CommonFunctions::getInstance();
$html_output = ''; - $html_output .= 'backquote(__('Rows')) - . ', ' . $common_functions->backquote($row['Field']) - . ' FROM ' . $common_functions->backquote($GLOBALS['table']) - . ' GROUP BY ' . $common_functions->backquote($row['Field']) - . ' ORDER BY ' . $common_functions->backquote($row['Field'])) - . '">' - . $titles['DistinctValues'] - . ''; + 'SELECT COUNT(*) AS ' . $common_functions->backquote(__('Rows')) + . ', ' . $common_functions->backquote($row['Field']) + . ' FROM ' . $common_functions->backquote($GLOBALS['table']) + . ' GROUP BY ' . $common_functions->backquote($row['Field']) + . ' ORDER BY ' . $common_functions->backquote($row['Field']) + ) + . '">' + . $titles['DistinctValues'] + . ''; $html_output .= ' | '; - + return $html_output; } /** * Get HTML snippet for Actions in table structure - * - * @param string $type column type - * @param string $tbl_storage_engine table storage engine - * @param boolean $primary primary if set, false otherwise - * @param string $field_name column name - * @param string $url_query url query - * @param array $titles titles array - * @param array $row current row - * @param string $rownum row number - * @param array $hidden_titles hedden titles - * @param array $columns_with_unique_index columns with unique index - * + * + * @param string $type column type + * @param string $tbl_storage_engine table storage engine + * @param boolean $primary primary if set, false otherwise + * @param string $field_name column name + * @param string $url_query url query + * @param array $titles titles array + * @param array $row current row + * @param string $rownum row number + * @param array $hidden_titles hedden titles + * @param array $columns_with_unique_index columns with unique index + * * @return string $html_output; */ function PMA_getHtmlForActionsInTableStructure($type, $tbl_storage_engine, @@ -2105,7 +2128,8 @@ function PMA_getHtmlForActionsInTableStructure($type, $tbl_storage_engine, ) { $html_output = ''; list($primary, $primary_enabled) - = PMA_getHtmlForActionRowInStructureTable($type, $tbl_storage_engine, + = PMA_getHtmlForActionRowInStructureTable( + $type, $tbl_storage_engine, 'primary replaced_by_more center', ($primary && $primary->hasColumn($field_name)), true, $url_query, $primary, @@ -2114,8 +2138,9 @@ function PMA_getHtmlForActionsInTableStructure($type, $tbl_storage_engine, 'Primary', $titles, $row, true ); $html_output .= $primary; - list($unique, $unique_enabled) - = PMA_getHtmlForActionRowInStructureTable($type, $tbl_storage_engine, + list($unique, $unique_enabled) + = PMA_getHtmlForActionRowInStructureTable( + $type, $tbl_storage_engine, 'unique replaced_by_more center', isset($columns_with_unique_index[$field_name]), false, $url_query, $primary, 'ADD UNIQUE', @@ -2123,10 +2148,10 @@ function PMA_getHtmlForActionsInTableStructure($type, $tbl_storage_engine, 'Unique', $titles, $row, false ); $html_output .= $unique; - list($index, $index_enabled) + list($index, $index_enabled) = PMA_getHtmlForActionRowInStructureTable( $type, $tbl_storage_engine, - 'index replaced_by_more center', false, false, $url_query, + 'index replaced_by_more center', false, false, $url_query, $primary, 'ADD INDEX', __('An index has been added on %s'), 'Index', $titles, $row, false ); @@ -2136,11 +2161,11 @@ function PMA_getHtmlForActionsInTableStructure($type, $tbl_storage_engine, 'geometry', 'point', 'linestring', 'polygon', 'multipoint', 'multilinestring', 'multipolygon', 'geomtrycollection' ); - list($spatial, $spatial_enabled) + list($spatial, $spatial_enabled) = PMA_getHtmlForActionRowInStructureTable( $type, $tbl_storage_engine, 'spatial replaced_by_more center', - (! in_array($type, $spatial_types) + (! in_array($type, $spatial_types) || 'MYISAM' != $tbl_storage_engine ), false, $url_query, $primary, 'ADD SPATIAL', @@ -2150,14 +2175,14 @@ function PMA_getHtmlForActionsInTableStructure($type, $tbl_storage_engine, $html_output .= $spatial; // FULLTEXT is possible on TEXT, CHAR and VARCHAR - list ($fulltext, $fulltext_enabled) - = PMA_getHtmlForFullTextAction($tbl_storage_engine, $type, - $url_query, $row, $titles); + list ($fulltext, $fulltext_enabled) = PMA_getHtmlForFullTextAction( + $tbl_storage_engine, $type, $url_query, $row, $titles + ); $html_output .= $fulltext; } $html_output .= PMA_getHtmlForDistinctValueAction($url_query, $row, $titles); - if ($GLOBALS['cfg']['PropertiesIconic'] !== true + if ($GLOBALS['cfg']['PropertiesIconic'] !== true && $GLOBALS['cfg']['HideStructureActions'] === true ) { $html_output .= PMA_getHtmlForMoreOptionInTableStructure( @@ -2166,129 +2191,118 @@ function PMA_getHtmlForActionsInTableStructure($type, $tbl_storage_engine, $fulltext_enabled, $spatial_enabled, $primary ); } - + return $html_output; } /** * Get hidden action titles (image and string) - * + * * @return array $hidden_titles */ function PMA_getHiddenTitlesArray() { $common_functions = PMA_CommonFunctions::getInstance(); - + $hidden_titles = array(); - $hidden_titles['DistinctValues'] - = $common_functions->getIcon( - 'b_browse.png', __('Distinct values'), true - ); - $hidden_titles['Primary'] - = $common_functions->getIcon( - 'b_primary.png', __('Add primary key'), true - ); - $hidden_titles['NoPrimary'] - = $common_functions->getIcon( - 'bd_primary.png', __('Add primary key'), true - ); - $hidden_titles['Index'] - = $common_functions->getIcon( - 'b_index.png', __('Add index'), true - ); - $hidden_titles['NoIndex'] - = $common_functions->getIcon( - 'bd_index.png', __('Add index'), true - ); - $hidden_titles['Unique'] - = $common_functions->getIcon( - 'b_unique.png', __('Add unique index'), true - ); - $hidden_titles['NoUnique'] - = $common_functions->getIcon( - 'bd_unique.png', __('Add unique index'), true - ); - $hidden_titles['Spatial'] - = $common_functions->getIcon( - 'b_spatial.png', __('Add SPATIAL index'), true - ); - $hidden_titles['NoSpatial'] - = $common_functions->getIcon( - 'bd_spatial.png', __('Add SPATIAL index'), true - ); - $hidden_titles['IdxFulltext'] - = $common_functions->getIcon( - 'b_ftext.png', __('Add FULLTEXT index'), true - ); - $hidden_titles['NoIdxFulltext'] - = $common_functions->getIcon( - 'bd_ftext.png', __('Add FULLTEXT index'), true - ); - + $hidden_titles['DistinctValues'] = $common_functions->getIcon( + 'b_browse.png', __('Distinct values'), true + ); + $hidden_titles['Primary'] = $common_functions->getIcon( + 'b_primary.png', __('Add primary key'), true + ); + $hidden_titles['NoPrimary'] = $common_functions->getIcon( + 'bd_primary.png', __('Add primary key'), true + ); + $hidden_titles['Index'] = $common_functions->getIcon( + 'b_index.png', __('Add index'), true + ); + $hidden_titles['NoIndex'] = $common_functions->getIcon( + 'bd_index.png', __('Add index'), true + ); + $hidden_titles['Unique'] = $common_functions->getIcon( + 'b_unique.png', __('Add unique index'), true + ); + $hidden_titles['NoUnique'] = $common_functions->getIcon( + 'bd_unique.png', __('Add unique index'), true + ); + $hidden_titles['Spatial'] = $common_functions->getIcon( + 'b_spatial.png', __('Add SPATIAL index'), true + ); + $hidden_titles['NoSpatial'] = $common_functions->getIcon( + 'bd_spatial.png', __('Add SPATIAL index'), true + ); + $hidden_titles['IdxFulltext'] = $common_functions->getIcon( + 'b_ftext.png', __('Add FULLTEXT index'), true + ); + $hidden_titles['NoIdxFulltext'] = $common_functions->getIcon( + 'bd_ftext.png', __('Add FULLTEXT index'), true + ); + return $hidden_titles; } /** * Get action titles (image or string array - * + * * @return array $titles */ function PMA_getActionTitlesArray() { $common_functions = PMA_CommonFunctions::getInstance(); - + $titles = array(); - $titles['Change'] + $titles['Change'] = $common_functions->getIcon('b_edit.png', __('Change')); - $titles['Drop'] + $titles['Drop'] = $common_functions->getIcon('b_drop.png', __('Drop')); - $titles['NoDrop'] + $titles['NoDrop'] = $common_functions->getIcon('b_drop.png', __('Drop')); - $titles['Primary'] + $titles['Primary'] = $common_functions->getIcon('b_primary.png', __('Primary')); - $titles['Index'] + $titles['Index'] = $common_functions->getIcon('b_index.png', __('Index')); - $titles['Unique'] + $titles['Unique'] = $common_functions->getIcon('b_unique.png', __('Unique')); - $titles['Spatial'] + $titles['Spatial'] = $common_functions->getIcon('b_spatial.png', __('Spatial')); - $titles['IdxFulltext'] + $titles['IdxFulltext'] = $common_functions->getIcon('b_ftext.png', __('Fulltext')); - $titles['NoPrimary'] + $titles['NoPrimary'] = $common_functions->getIcon('bd_primary.png', __('Primary')); - $titles['NoIndex'] + $titles['NoIndex'] = $common_functions->getIcon('bd_index.png', __('Index')); - $titles['NoUnique'] + $titles['NoUnique'] = $common_functions->getIcon('bd_unique.png', __('Unique')); - $titles['NoSpatial'] + $titles['NoSpatial'] = $common_functions->getIcon('bd_spatial.png', __('Spatial')); - $titles['NoIdxFulltext'] + $titles['NoIdxFulltext'] = $common_functions->getIcon('bd_ftext.png', __('Fulltext')); - $titles['DistinctValues'] + $titles['DistinctValues'] = $common_functions->getIcon('b_browse.png', __('Distinct values')); - + return $titles; } /** * Get HTML snippet for display table statistics - * - * @param array $showtable full table status info + * + * @param array $showtable full table status info * @param integer $table_info_num_rows table info number of rows * @param boolean $tbl_is_view whether table is view or not * @param boolean $db_is_information_schema whether db is information schema or not - * @param string $tbl_storage_engine table storage engine - * @param string $url_query url query - * @param string $tbl_collation table collation - * - * @return string $html_output + * @param string $tbl_storage_engine table storage engine + * @param string $url_query url query + * @param string $tbl_collation table collation + * + * @return string $html_output */ function PMA_getHtmlForDisplayTableStats($showtable, $table_info_num_rows, $tbl_is_view, $db_is_information_schema, $tbl_storage_engine, $url_query, $tbl_collation ) { $common_functions = PMA_CommonFunctions::getInstance(); - + $html_output = '
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|