diff --git a/ChangeLog b/ChangeLog index 6eeebcb727..f897a23f6f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22,6 +22,7 @@ phpMyAdmin - ChangeLog + Patch #3507111 Display distinct results, linked to corresponding data rows + Update to jQuery 1.7.2 - bug #3507917 [export] JSON has unescaped values for allegedly numeric columns ++ rfe #3516187 show tables creation, last update, last check timestamps in db_structure 3.5.1.0 (not yet released) - bug #3510784 [edit] Limit clause ignored when sort order is remembered diff --git a/Documentation.html b/Documentation.html index dd08e4438f..6455ad25e8 100644 --- a/Documentation.html +++ b/Documentation.html @@ -1654,6 +1654,18 @@ CREATE DATABASE,ALTER DATABASE,DROP DATABASE
Defines whether to suggest a database name on the "Create Database" form or to keep the textfield empty.
+
$cfg['ShowDbStructureCreation'] boolean
+
Defines whether the database structure page (tables list) has a + "Creation" column that displays when each table was created.
+ +
$cfg['ShowDbStructureLastUpdate'] boolean
+
Defines whether the database structure page (tables list) has a + "Last update" column that displays when each table was last updated.
+ +
$cfg['cfg_ShowDbStructureLastCheck'] boolean
+
Defines whether the database structure page (tables list) has a + "Last check" column that displays when each table was last checked.
+
$cfg['NavigationBarIconic'] string
Defines whether navigation bar buttons and the right panel top menu contain text or symbols only. A value of TRUE displays icons, FALSE diff --git a/db_structure.php b/db_structure.php index 83517e2133..9d505ff2c9 100644 --- a/db_structure.php +++ b/db_structure.php @@ -130,6 +130,9 @@ $i = $sum_entries = 0; $sum_size = (double) 0; $overhead_size = (double) 0; $overhead_check = ''; +$create_time_all = ''; +$update_time_all = ''; +$check_time_all = ''; $checked = !empty($checkall) ? ' checked="checked"' : ''; $num_columns = $cfg['PropertiesNumColumns'] > 1 ? ceil($num_tables / $cfg['PropertiesNumColumns']) + 1 @@ -264,6 +267,44 @@ foreach ($tables as $keyname => $each_table) { } } // end if + unset($showtable); + + if ($GLOBALS['cfg']['ShowDbStructureCreation']) { + $showtable = PMA_Table::sGetStatusInfo($db, $each_table['TABLE_NAME'], null, true); + $create_time = isset($showtable['Create_time']) ? $showtable['Create_time'] : false; + + // show oldest creation date in summary row + if ($create_time && (!$create_time_all || $create_time < $create_time_all)) { + $create_time_all = $create_time; + } + } + + if ($GLOBALS['cfg']['ShowDbStructureLastUpdate']) { + // $showtable might already be set from ShowDbStructureCreation, see above + if (!isset($showtable)) { + $showtable = PMA_Table::sGetStatusInfo($db, $each_table['TABLE_NAME'], null, true); + } + $update_time = isset($showtable['Update_time']) ? $showtable['Update_time'] : false; + + // show newest update date in summary row + if ($update_time && $update_time > $update_time_all) { + $update_time_all = $update_time; + } + } + + if ($GLOBALS['cfg']['ShowDbStructureLastCheck']) { + // $showtable might already be set from ShowDbStructureCreation, see above + if (!isset($showtable)) { + $showtable = PMA_Table::sGetStatusInfo($db, $each_table['TABLE_NAME'], null, true); + } + $check_time = isset($showtable['Check_time']) ? $showtable['Check_time'] : false; + + // show newest check date in summary row + if ($check_time && $check_time > $check_time_all) { + $check_time_all = $check_time; + } + } + $alias = (!empty($tooltip_aliasname) && isset($tooltip_aliasname[$each_table['TABLE_NAME']])) ? str_replace(' ', ' ', htmlspecialchars($tooltip_truename[$each_table['TABLE_NAME']])) : str_replace(' ', ' ', htmlspecialchars($each_table['TABLE_NAME'])); @@ -484,6 +525,15 @@ foreach ($tables as $keyname => $each_table) { href="tbl_structure.php?#showusage" >' . $formatted_size . ' ' . $unit . ''; ?> + + + + + + - @@ -551,6 +601,25 @@ if ($is_show_stats) { ' . "\n" + . ' ' . ($create_time_all ? PMA_localisedDate(strtotime($create_time_all)) : '-') + . ' '; +} + +if ($GLOBALS['cfg']['ShowDbStructureLastUpdate']) { + echo ' ' . "\n" + . ' ' . ($update_time_all ? PMA_localisedDate(strtotime($update_time_all)) : '-') + . ' '; +} + +if ($GLOBALS['cfg']['ShowDbStructureLastCheck']) { + echo ' ' . "\n" + . ' ' . ($check_time_all ? PMA_localisedDate(strtotime($check_time_all)) : '-') + . ' '; +} + ?> diff --git a/libraries/config.default.php b/libraries/config.default.php index d9d9fd875a..61d74149ca 100644 --- a/libraries/config.default.php +++ b/libraries/config.default.php @@ -951,6 +951,32 @@ $cfg['ShowCreateDb'] = true; $cfg['SuggestDBName'] = true; +/******************************************************************************* + * Database structure + */ + +/** + * show creation timestamp column in database structure (true|false)? + * + * @global boolean $cfg['ShowDbStructureCreation'] + */ +$cfg['ShowDbStructureCreation'] = false; + +/** + * show last update timestamp column in database structure (true|false)? + * + * @global boolean $cfg['ShowDbStructureLastUpdate'] + */ +$cfg['ShowDbStructureLastUpdate'] = false; + +/** + * show last check timestamp column in database structure (true|false)? + * + * @global boolean $cfg['ShowDbStructureLastCheck'] + */ +$cfg['ShowDbStructureLastCheck'] = false; + + /******************************************************************************* * In browse mode... */ diff --git a/libraries/config/messages.inc.php b/libraries/config/messages.inc.php index 48635ea65e..79febc2e96 100644 --- a/libraries/config/messages.inc.php +++ b/libraries/config/messages.inc.php @@ -223,6 +223,8 @@ $strConfigForm_Sql_validator = __('SQL Validator'); $strConfigForm_Sql_validator_desc = __('If you wish to use the SQL Validator service, you should be aware that [strong]all SQL statements are stored anonymously for statistical purposes[/strong].[br][em][a@http://sqlvalidator.mimer.com/]Mimer SQL Validator[/a], Copyright 2002 Upright Database Technology. All rights reserved.[/em]'); $strConfigForm_Startup = __('Startup'); $strConfigForm_Startup_desc = __('Customize startup page'); +$strConfigForm_DbStructure = __('Database structure'); +$strConfigForm_DbStructure_desc = __('Choose which details to show in the database structure (list of tables)'); $strConfigForm_Tabs = __('Tabs'); $strConfigForm_Tabs_desc = __('Choose how you want tabs to work'); $strConfigForm_Text_fields = __('Text fields'); @@ -457,6 +459,12 @@ $strConfigShowAll_name = __('Allow to display all the rows'); $strConfigShowChgPassword_desc = __('Please note that enabling this has no effect with [kbd]config[/kbd] authentication mode because the password is hard coded in the configuration file; this does not limit the ability to execute the same command directly'); $strConfigShowChgPassword_name = __('Show password change form'); $strConfigShowCreateDb_name = __('Show create database form'); +$strConfigShowDbStructureCreation_desc = __('Show or hide a column displaying the Creation timestamp for all tables'); +$strConfigShowDbStructureCreation_name = __('Show Creation timestamp'); +$strConfigShowDbStructureLastUpdate_desc = __('Show or hide a column displaying the Last update timestamp for all tables'); +$strConfigShowDbStructureLastUpdate_name = __('Show Last update timestamp'); +$strConfigShowDbStructureLastCheck_desc = __('Show or hide a column displaying the Last check timestamp for all tables'); +$strConfigShowDbStructureLastCheck_name = __('Show Last check timestamp'); $strConfigShowDisplayDirection_desc = __('Defines whether or not type display direction option is shown when browsing a table'); $strConfigShowDisplayDirection_name = __('Show display direction'); $strConfigShowFieldTypesInDataEditView_desc = __('Defines whether or not type fields should be initially displayed in edit/insert mode'); diff --git a/libraries/config/setup.forms.php b/libraries/config/setup.forms.php index 6a4aed4e83..4e1142463e 100644 --- a/libraries/config/setup.forms.php +++ b/libraries/config/setup.forms.php @@ -195,6 +195,10 @@ $forms['Main_frame']['Startup'] = array( 'ShowServerInfo', 'ShowPhpInfo', 'ShowChgPassword'); +$forms['Main_frame']['DbStructure'] = array( + 'ShowDbStructureCreation', + 'ShowDbStructureLastUpdate', + 'ShowDbStructureLastCheck'); $forms['Main_frame']['Browse'] = array( 'NavigationBarIconic', 'ShowAll', diff --git a/libraries/config/user_preferences.forms.php b/libraries/config/user_preferences.forms.php index 9bc1c4ceb5..1b96a3751b 100644 --- a/libraries/config/user_preferences.forms.php +++ b/libraries/config/user_preferences.forms.php @@ -103,6 +103,10 @@ $forms['Main_frame']['Startup'] = array( ':group:end', 'ShowStats', 'ShowServerInfo'); +$forms['Main_frame']['DbStructure'] = array( + 'ShowDbStructureCreation', + 'ShowDbStructureLastUpdate', + 'ShowDbStructureLastCheck'); $forms['Main_frame']['Browse'] = array( 'NavigationBarIconic', 'PropertiesIconic', diff --git a/libraries/db_info.inc.php b/libraries/db_info.inc.php index 13d01b17be..31512546d2 100644 --- a/libraries/db_info.inc.php +++ b/libraries/db_info.inc.php @@ -196,12 +196,15 @@ if (! isset($sot_ready)) { if (isset($_REQUEST['sort'])) { $sortable_name_mappings = array( - 'table' => 'Name', - 'records' => 'Rows', - 'type' => 'Engine', - 'collation' => 'Collation', - 'size' => 'Data_length', - 'overhead' => 'Data_free' + 'table' => 'Name', + 'records' => 'Rows', + 'type' => 'Engine', + 'collation' => 'Collation', + 'size' => 'Data_length', + 'overhead' => 'Data_free', + 'creation' => 'Create_time', + 'last_update' => 'Update_time', + 'last_check' => 'Check_time' ); // Make sure the sort type is implemented diff --git a/libraries/db_structure.lib.php b/libraries/db_structure.lib.php index 5a93187289..41a1537dfc 100644 --- a/libraries/db_structure.lib.php +++ b/libraries/db_structure.lib.php @@ -55,6 +55,21 @@ function PMA_TableHeader($db_is_information_schema = false, $replication = false . ' ' . PMA_SortableTableHeader(__('Overhead'), 'overhead', 'DESC') . '' . "\n"; $cnt += 2; } + if ($GLOBALS['cfg']['ShowDbStructureCreation']) { + // larger values are more interesting so default sort order is DESC + echo ' ' . PMA_SortableTableHeader(__('Creation'), 'creation', 'DESC') . '' . "\n"; + $cnt += 2; + } + if ($GLOBALS['cfg']['ShowDbStructureLastUpdate']) { + // larger values are more interesting so default sort order is DESC + echo ' ' . 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 + echo ' ' . PMA_SortableTableHeader(__('Last check'), 'last_check', 'DESC') . '' . "\n"; + $cnt += 2; + } echo '' . "\n"; echo '' . "\n"; echo '' . "\n"; diff --git a/libraries/display_tbl.lib.php b/libraries/display_tbl.lib.php index a0cdd0d920..b037cf8b5b 100644 --- a/libraries/display_tbl.lib.php +++ b/libraries/display_tbl.lib.php @@ -1118,7 +1118,7 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $ // (unless coming from Browse mode print view) elseif (($GLOBALS['cfg']['RowActionLinks'] == 'left' || $GLOBALS['cfg']['RowActionLinks'] == 'both') && ($is_display['edit_lnk'] == 'nn' && $is_display['del_lnk'] == 'nn') - && (! $GLOBALS['is_header_sent']) + && (! isset($GLOBALS['is_header_sent']) || ! $GLOBALS['is_header_sent']) ) { $vertical_display['emptyafter'] = ($is_display['edit_lnk'] != 'nn' && $is_display['del_lnk'] != 'nn') ? 4 : 1; if ($_SESSION['tmp_user_values']['disp_direction'] == 'horizontal' diff --git a/sql.php b/sql.php index 9e3b42e11f..e0df6c6375 100644 --- a/sql.php +++ b/sql.php @@ -848,8 +848,10 @@ if ((0 == $num_rows && 0 == $unlim_num_rows) || $is_affected) { $disp_mode = 'nnnn110111'; } - $message = PMA_Message::success($message); - echo PMA_showMessage($message, $GLOBALS['sql_query'], 'success'); + if (isset($message)) { + $message = PMA_Message::success($message); + echo PMA_showMessage($message, $GLOBALS['sql_query'], 'success'); + } PMA_displayTable($result, $disp_mode, $analyzed_sql); exit(); } diff --git a/tbl_alter.php b/tbl_alter.php index 961a5a5e00..4664cd172d 100644 --- a/tbl_alter.php +++ b/tbl_alter.php @@ -175,7 +175,7 @@ if (isset($_REQUEST['do_save_data'])) { * $selected comes from multi_submits.inc.php */ if ($abort == false) { - if ($_REQUEST['ajax_request'] != true) { + if (!isset($_REQUEST['ajax_request']) || $_REQUEST['ajax_request'] != true) { include_once 'libraries/tbl_links.inc.php'; } diff --git a/tbl_operations.php b/tbl_operations.php index da5676e2ee..ccdd68ebc1 100644 --- a/tbl_operations.php +++ b/tbl_operations.php @@ -225,7 +225,7 @@ if (isset($result) && empty($message_to_show)) { $_message = $result ? $message = PMA_Message::success(__('Your SQL query has been executed successfully')) : PMA_Message::error(__('Error')); // $result should exist, regardless of $_message $_type = $result ? 'success' : 'error'; - if ( $_REQUEST['ajax_request'] == true) { + if (isset($_REQUEST['ajax_request']) && $_REQUEST['ajax_request'] == true) { $extra_data['sql_query'] = PMA_showMessage(null, $sql_query); PMA_ajaxResponse($_message, $_message->isSuccess(), $extra_data); } @@ -244,7 +244,7 @@ if (isset($result) && empty($message_to_show)) { unset($_message, $_type); } -$url_params['goto'] = 'tbl_operations.php'; +$url_params['goto'] = $url_params['back'] = 'tbl_operations.php'; /**