diff options
author | Vishal Pandey <vishpandey2014@gmail.com> | 2017-01-15 15:10:35 +0300 |
---|---|---|
committer | Michal Čihař <michal@cihar.com> | 2017-03-20 19:55:21 +0300 |
commit | 5da44ce1a642e611068276fdcc1eef236e88a9a6 (patch) | |
tree | 4c385c1b491b956ca7c272de4979ae74f3585314 /tbl_operations.php | |
parent | 2c48b61757472ca4f0b90f8f0144a86877a44a35 (diff) |
Move the tbl_info.inc.php code to Table class
Fixes #12567
Signed-off-by: flash1452 <vishpandey2014@gmail.com>
Diffstat (limited to 'tbl_operations.php')
-rw-r--r-- | tbl_operations.php | 50 |
1 files changed, 43 insertions, 7 deletions
diff --git a/tbl_operations.php b/tbl_operations.php index d930576d19..175fecea76 100644 --- a/tbl_operations.php +++ b/tbl_operations.php @@ -49,14 +49,33 @@ $GLOBALS['dbi']->selectDb($GLOBALS['db']); /** * Gets tables information */ -require 'libraries/tbl_info.inc.php'; +$pma_table = $GLOBALS['dbi']->getTable( + $GLOBALS['db'], + $GLOBALS['table'] +); +$reread_info = $pma_table->getStatusInfo(null, false); +$GLOBALS['showtable'] = $pma_table->getStatusInfo(null, (isset($reread_info) && $reread_info ? true : false)); +if ($pma_table->isView()) { + $tbl_is_view = true; + $tbl_storage_engine = __('View'); + $show_comment = null; +} else { + $tbl_is_view = false; + $tbl_storage_engine = $pma_table->getTableStorageEngine(); + $show_comment = $pma_table->getShowComment(); +} +$tbl_collation = $pma_table->getTableCollation(); +$table_info_num_rows = $pma_table->getTableNumRowInfo(); +$row_format = $pma_table->getTableRowFormat(); +$auto_increment = $pma_table->getAutoIncrementInfo(); +$create_options = $pma_table->createOptionsArray(); // set initial value of these variables, based on the current table engine if ($pma_table->isEngine('ARIA')) { // the value for transactional can be implicit // (no create option found, in this case it means 1) // or explicit (option found with a value of 0 or 1) - // ($create_options['transactional'] may have been set by libraries/tbl_info.inc.php, + // ($create_options['transactional'] may have been set by Table class, // from the $create_options) $create_options['transactional'] = (isset($create_options['transactional']) && $create_options['transactional'] == '0') ? '0' @@ -64,7 +83,11 @@ if ($pma_table->isEngine('ARIA')) { $create_options['page_checksum'] = (isset($create_options['page_checksum'])) ? $create_options['page_checksum'] : ''; } -$reread_info = false; +$pma_table = $GLOBALS['dbi']->getTable( + $GLOBALS['db'], + $GLOBALS['table'] +); +$reread_info = $pma_table->getStatusInfo(null, false); $table_alters = array(); /** @@ -107,11 +130,10 @@ if (isset($_REQUEST['submitoptions'])) { // Reselect the original DB $GLOBALS['db'] = $oldDb; $GLOBALS['dbi']->selectDb($oldDb); - $_message .= $pma_table->getLastMessage(); $result = true; $GLOBALS['table'] = $pma_table->getName(); - $reread_info = true; + $reread_info = $pma_table->getStatusInfo(null, true); $reload = true; } else { $_message .= $pma_table->getLastError(); @@ -191,9 +213,23 @@ if ($reread_info) { // to avoid showing the old value (for example the AUTO_INCREMENT) after // a change, clear the cache $GLOBALS['dbi']->clearTableCache(); - include 'libraries/tbl_info.inc.php'; + $GLOBALS['dbi']->selectDb($GLOBALS['db']); + $GLOBALS['showtable'] = $pma_table->getStatusInfo(null, (isset($reread_info) && $reread_info ? true : false)); + if ($pma_table->isView()) { + $tbl_is_view = true; + $tbl_storage_engine = __('View'); + $show_comment = null; + } else { + $tbl_is_view = false; + $tbl_storage_engine = $pma_table->getTableStorageEngine(); + $show_comment = $pma_table->getShowComment(); + } + $tbl_collation = $pma_table->getTableCollation(); + $table_info_num_rows = $pma_table->getTableNumRowInfo(); + $row_format = $pma_table->getTableRowFormat(); + $auto_increment = $pma_table->getAutoIncrementInfo(); + $create_options = $pma_table->createOptionsArray(); } -unset($reread_info); if (isset($result) && empty($message_to_show)) { if (empty($_message)) { |