From 4130b9bc389a293da231ac0a0a02e487349f4397 Mon Sep 17 00:00:00 2001 From: Jo Michael Date: Mon, 9 Apr 2012 21:04:40 +0200 Subject: [PATCH 1/5] Fix PHP notices --- tbl_alter.php | 2 +- tbl_operations.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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'; /** From 061d49f225ce13ba6a1f1693dd48d39030e75b12 Mon Sep 17 00:00:00 2001 From: Jo Michael Date: Mon, 9 Apr 2012 22:15:49 +0200 Subject: [PATCH 2/5] + rfe #3516187 show tables last update time in db_structure --- ChangeLog | 1 + Documentation.html | 4 ++++ db_structure.php | 20 ++++++++++++++++++++ libraries/config.default.php | 12 ++++++++++++ libraries/config/messages.inc.php | 4 ++++ libraries/config/setup.forms.php | 2 ++ libraries/config/user_preferences.forms.php | 2 ++ libraries/db_info.inc.php | 3 ++- libraries/db_structure.lib.php | 5 +++++ 9 files changed, 52 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 6eeebcb727..e47ad4003f 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 last update time 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..ec8c0966ba 100644 --- a/Documentation.html +++ b/Documentation.html @@ -1654,6 +1654,10 @@ 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['ShowDbStructureLastUpdate'] boolean
+
Defines whether the database structure page (tables list) has a + "Last update" column that displays the timestamp for each table.
+
$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..1a617fd871 100644 --- a/db_structure.php +++ b/db_structure.php @@ -130,6 +130,7 @@ $i = $sum_entries = 0; $sum_size = (double) 0; $overhead_size = (double) 0; $overhead_check = ''; +$update_time_all = ''; $checked = !empty($checkall) ? ' checked="checked"' : ''; $num_columns = $cfg['PropertiesNumColumns'] > 1 ? ceil($num_tables / $cfg['PropertiesNumColumns']) + 1 @@ -264,6 +265,15 @@ foreach ($tables as $keyname => $each_table) { } } // end if + if ($GLOBALS['cfg']['ShowDbStructureLastUpdate']) { + $showtable = PMA_Table::sGetStatusInfo($db, $each_table['TABLE_NAME']); + $update_time = isset($showtable['Update_time']) ? $showtable['Update_time'] : false; + + if ($update_time && $update_time > $update_time_all) { + $update_time_all = $update_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'])); @@ -485,6 +495,9 @@ foreach ($tables as $keyname => $each_table) { >' . $formatted_size . ' ' . $unit . ''; ?> + + + - @@ -551,6 +564,13 @@ if ($is_show_stats) { ' . "\n" + . ' ' . ($update_time_all ? PMA_localisedDate(strtotime($update_time_all)) : '-') + . ' '; +} + ?> diff --git a/libraries/config.default.php b/libraries/config.default.php index d9d9fd875a..9d4157a25b 100644 --- a/libraries/config.default.php +++ b/libraries/config.default.php @@ -951,6 +951,18 @@ $cfg['ShowCreateDb'] = true; $cfg['SuggestDBName'] = true; +/******************************************************************************* + * Database structure + */ + +/** + * show last update timestamp column in database structure (true|false)? + * + * @global boolean $cfg['ShowDbStructureLastUpdate'] + */ +$cfg['ShowDbStructureLastUpdate'] = false; + + /******************************************************************************* * In browse mode... */ diff --git a/libraries/config/messages.inc.php b/libraries/config/messages.inc.php index 48635ea65e..28aac40ed5 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,8 @@ $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'); +$strConfigShowDbStructureLastUpdate_desc = __('Show or hide a column displaying the Last update timestamp for all tables'); +$strConfigShowDbStructureLastUpdate_name = __('Show Last update 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..95655700da 100644 --- a/libraries/config/setup.forms.php +++ b/libraries/config/setup.forms.php @@ -195,6 +195,8 @@ $forms['Main_frame']['Startup'] = array( 'ShowServerInfo', 'ShowPhpInfo', 'ShowChgPassword'); +$forms['Main_frame']['DbStructure'] = array( + 'ShowDbStructureLastUpdate'); $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..25ade5ed84 100644 --- a/libraries/config/user_preferences.forms.php +++ b/libraries/config/user_preferences.forms.php @@ -103,6 +103,8 @@ $forms['Main_frame']['Startup'] = array( ':group:end', 'ShowStats', 'ShowServerInfo'); +$forms['Main_frame']['DbStructure'] = array( + 'ShowDbStructureLastUpdate'); $forms['Main_frame']['Browse'] = array( 'NavigationBarIconic', 'PropertiesIconic', diff --git a/libraries/db_info.inc.php b/libraries/db_info.inc.php index 13d01b17be..f4686a3242 100644 --- a/libraries/db_info.inc.php +++ b/libraries/db_info.inc.php @@ -201,7 +201,8 @@ if (! isset($sot_ready)) { 'type' => 'Engine', 'collation' => 'Collation', 'size' => 'Data_length', - 'overhead' => 'Data_free' + 'overhead' => 'Data_free', + 'last_update' => 'Update_time' ); // Make sure the sort type is implemented diff --git a/libraries/db_structure.lib.php b/libraries/db_structure.lib.php index 5a93187289..5f9b517107 100644 --- a/libraries/db_structure.lib.php +++ b/libraries/db_structure.lib.php @@ -55,6 +55,11 @@ function PMA_TableHeader($db_is_information_schema = false, $replication = false . ' ' . PMA_SortableTableHeader(__('Overhead'), 'overhead', '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; + } echo '' . "\n"; echo '' . "\n"; echo '' . "\n"; From d4658e5b2ee118f056c804e47934b5a5e875a534 Mon Sep 17 00:00:00 2001 From: Jo Michael Date: Mon, 9 Apr 2012 22:35:39 +0200 Subject: [PATCH 3/5] + rfe #3516187 show tables creation time in db_structure --- ChangeLog | 2 +- Documentation.html | 6 ++++- db_structure.php | 26 ++++++++++++++++++++- libraries/config.default.php | 7 ++++++ libraries/config/messages.inc.php | 2 ++ libraries/config/setup.forms.php | 1 + libraries/config/user_preferences.forms.php | 1 + libraries/db_info.inc.php | 13 ++++++----- libraries/db_structure.lib.php | 5 ++++ 9 files changed, 54 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index e47ad4003f..4908bc324d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22,7 +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 last update time in db_structure ++ rfe #3516187 show tables creation, last update 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 ec8c0966ba..ff55634a49 100644 --- a/Documentation.html +++ b/Documentation.html @@ -1654,9 +1654,13 @@ 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 the timestamp for each table.
+ "Last update" column that displays when each table was last updated.
$cfg['NavigationBarIconic'] string
Defines whether navigation bar buttons and the right panel top menu diff --git a/db_structure.php b/db_structure.php index 1a617fd871..fdf8f2ac84 100644 --- a/db_structure.php +++ b/db_structure.php @@ -130,6 +130,7 @@ $i = $sum_entries = 0; $sum_size = (double) 0; $overhead_size = (double) 0; $overhead_check = ''; +$create_time_all = ''; $update_time_all = ''; $checked = !empty($checkall) ? ' checked="checked"' : ''; $num_columns = $cfg['PropertiesNumColumns'] > 1 @@ -265,10 +266,24 @@ foreach ($tables as $keyname => $each_table) { } } // end if - if ($GLOBALS['cfg']['ShowDbStructureLastUpdate']) { + if ($GLOBALS['cfg']['ShowDbStructureCreation']) { $showtable = PMA_Table::sGetStatusInfo($db, $each_table['TABLE_NAME']); + $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']); + } $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; } @@ -494,6 +509,9 @@ foreach ($tables as $keyname => $each_table) { href="tbl_structure.php?#showusage" >' . $formatted_size . ' ' . $unit . ''; ?> + + + @@ -565,6 +583,12 @@ 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)) : '-') diff --git a/libraries/config.default.php b/libraries/config.default.php index 9d4157a25b..8ffc385287 100644 --- a/libraries/config.default.php +++ b/libraries/config.default.php @@ -955,6 +955,13 @@ $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)? * diff --git a/libraries/config/messages.inc.php b/libraries/config/messages.inc.php index 28aac40ed5..81e6fea95b 100644 --- a/libraries/config/messages.inc.php +++ b/libraries/config/messages.inc.php @@ -459,6 +459,8 @@ $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'); $strConfigShowDisplayDirection_desc = __('Defines whether or not type display direction option is shown when browsing a table'); diff --git a/libraries/config/setup.forms.php b/libraries/config/setup.forms.php index 95655700da..b1143fad46 100644 --- a/libraries/config/setup.forms.php +++ b/libraries/config/setup.forms.php @@ -196,6 +196,7 @@ $forms['Main_frame']['Startup'] = array( 'ShowPhpInfo', 'ShowChgPassword'); $forms['Main_frame']['DbStructure'] = array( + 'ShowDbStructureCreation', 'ShowDbStructureLastUpdate'); $forms['Main_frame']['Browse'] = array( 'NavigationBarIconic', diff --git a/libraries/config/user_preferences.forms.php b/libraries/config/user_preferences.forms.php index 25ade5ed84..ebabdb55d5 100644 --- a/libraries/config/user_preferences.forms.php +++ b/libraries/config/user_preferences.forms.php @@ -104,6 +104,7 @@ $forms['Main_frame']['Startup'] = array( 'ShowStats', 'ShowServerInfo'); $forms['Main_frame']['DbStructure'] = array( + 'ShowDbStructureCreation', 'ShowDbStructureLastUpdate'); $forms['Main_frame']['Browse'] = array( 'NavigationBarIconic', diff --git a/libraries/db_info.inc.php b/libraries/db_info.inc.php index f4686a3242..f5064f111c 100644 --- a/libraries/db_info.inc.php +++ b/libraries/db_info.inc.php @@ -196,12 +196,13 @@ 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' ); diff --git a/libraries/db_structure.lib.php b/libraries/db_structure.lib.php index 5f9b517107..852f05606a 100644 --- a/libraries/db_structure.lib.php +++ b/libraries/db_structure.lib.php @@ -55,6 +55,11 @@ 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"; From b0e67c419c8eb4cc8d9ae12c9cf76f5f7306bfaf Mon Sep 17 00:00:00 2001 From: Jo Michael Date: Mon, 9 Apr 2012 22:39:44 +0200 Subject: [PATCH 4/5] Fix PHP notices --- libraries/display_tbl.lib.php | 2 +- sql.php | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) 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(); } From 10baa48564fc29fbfc2b22ba5f3a6d48e4bda97c Mon Sep 17 00:00:00 2001 From: Jo Michael Date: Mon, 9 Apr 2012 23:06:08 +0200 Subject: [PATCH 5/5] + rfe #3516187 show tables last check time in db_structure --- ChangeLog | 2 +- Documentation.html | 4 +++ db_structure.php | 37 +++++++++++++++++---- libraries/config.default.php | 7 ++++ libraries/config/messages.inc.php | 2 ++ libraries/config/setup.forms.php | 3 +- libraries/config/user_preferences.forms.php | 3 +- libraries/db_info.inc.php | 3 +- libraries/db_structure.lib.php | 5 +++ 9 files changed, 56 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4908bc324d..f897a23f6f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -22,7 +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 timestamps in db_structure ++ 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 ff55634a49..6455ad25e8 100644 --- a/Documentation.html +++ b/Documentation.html @@ -1662,6 +1662,10 @@ CREATE DATABASE,ALTER DATABASE,DROP DATABASE
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 fdf8f2ac84..9d505ff2c9 100644 --- a/db_structure.php +++ b/db_structure.php @@ -132,6 +132,7 @@ $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 @@ -266,8 +267,10 @@ foreach ($tables as $keyname => $each_table) { } } // end if + unset($showtable); + if ($GLOBALS['cfg']['ShowDbStructureCreation']) { - $showtable = PMA_Table::sGetStatusInfo($db, $each_table['TABLE_NAME']); + $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 @@ -279,7 +282,7 @@ foreach ($tables as $keyname => $each_table) { 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']); + $showtable = PMA_Table::sGetStatusInfo($db, $each_table['TABLE_NAME'], null, true); } $update_time = isset($showtable['Update_time']) ? $showtable['Update_time'] : false; @@ -289,6 +292,19 @@ foreach ($tables as $keyname => $each_table) { } } + 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'])); @@ -509,12 +525,15 @@ foreach ($tables as $keyname => $each_table) { href="tbl_structure.php?#showusage" >' . $formatted_size . ' ' . $unit . ''; ?> - - + - - + + + - @@ -595,6 +614,12 @@ if ($GLOBALS['cfg']['ShowDbStructureLastUpdate']) { . ' '; } +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 8ffc385287..61d74149ca 100644 --- a/libraries/config.default.php +++ b/libraries/config.default.php @@ -969,6 +969,13 @@ $cfg['ShowDbStructureCreation'] = false; */ $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 81e6fea95b..79febc2e96 100644 --- a/libraries/config/messages.inc.php +++ b/libraries/config/messages.inc.php @@ -463,6 +463,8 @@ $strConfigShowDbStructureCreation_desc = __('Show or hide a column displaying th $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 b1143fad46..4e1142463e 100644 --- a/libraries/config/setup.forms.php +++ b/libraries/config/setup.forms.php @@ -197,7 +197,8 @@ $forms['Main_frame']['Startup'] = array( 'ShowChgPassword'); $forms['Main_frame']['DbStructure'] = array( 'ShowDbStructureCreation', - 'ShowDbStructureLastUpdate'); + '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 ebabdb55d5..1b96a3751b 100644 --- a/libraries/config/user_preferences.forms.php +++ b/libraries/config/user_preferences.forms.php @@ -105,7 +105,8 @@ $forms['Main_frame']['Startup'] = array( 'ShowServerInfo'); $forms['Main_frame']['DbStructure'] = array( 'ShowDbStructureCreation', - 'ShowDbStructureLastUpdate'); + 'ShowDbStructureLastUpdate', + 'ShowDbStructureLastCheck'); $forms['Main_frame']['Browse'] = array( 'NavigationBarIconic', 'PropertiesIconic', diff --git a/libraries/db_info.inc.php b/libraries/db_info.inc.php index f5064f111c..31512546d2 100644 --- a/libraries/db_info.inc.php +++ b/libraries/db_info.inc.php @@ -203,7 +203,8 @@ if (! isset($sot_ready)) { 'size' => 'Data_length', 'overhead' => 'Data_free', 'creation' => 'Create_time', - 'last_update' => 'Update_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 852f05606a..41a1537dfc 100644 --- a/libraries/db_structure.lib.php +++ b/libraries/db_structure.lib.php @@ -65,6 +65,11 @@ function PMA_TableHeader($db_is_information_schema = false, $replication = false 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";