Simplify rereading of information

Signed-off-by: Michal Čihař <michal@cihar.com>
This commit is contained in:
Michal Čihař 2017-03-06 09:22:07 +01:00
parent 5da44ce1a6
commit 9f2773c9c2
6 changed files with 15 additions and 21 deletions

View File

@ -236,8 +236,7 @@ class Menu
$GLOBALS['db'],
$GLOBALS['table']
);
$reread_info = $table_class_object->getStatusInfo(null, true);
$GLOBALS['showtable'] = $table_class_object->getStatusInfo(null, (isset($reread_info) && $reread_info ? true : false));
$GLOBALS['showtable'] = $table_class_object->getStatusInfo(null, true);
if ($table_class_object->isView()) {
$tbl_is_view = true;
$show_comment = null;

View File

@ -120,8 +120,7 @@ class TableChartController extends TableController
$GLOBALS['db'],
$GLOBALS['table']
);
$reread_info = $table_class_object->getStatusInfo(null, true);
$GLOBALS['showtable'] = $table_class_object->getStatusInfo(null, (isset($reread_info) && $reread_info ? true : false));
$GLOBALS['showtable'] = $table_class_object->getStatusInfo(null, true);
if ($table_class_object->isView()) {
$tbl_is_view = true;
$tbl_storage_engine = __('View');

View File

@ -68,8 +68,7 @@ class TableIndexesController extends TableController
$GLOBALS['db'],
$GLOBALS['table']
);
$reread_info = $table_class_object->getStatusInfo(null, true);
$GLOBALS['showtable'] = $table_class_object->getStatusInfo(null, (isset($reread_info) && $reread_info ? true : false));
$GLOBALS['showtable'] = $table_class_object->getStatusInfo(null, true);
if ($table_class_object->isView()) {
$tbl_is_view = true;
$tbl_storage_engine = __('View');

View File

@ -87,7 +87,7 @@ $pma_table = $GLOBALS['dbi']->getTable(
$GLOBALS['db'],
$GLOBALS['table']
);
$reread_info = $pma_table->getStatusInfo(null, false);
$reread_info = false;
$table_alters = array();
/**
@ -133,7 +133,7 @@ if (isset($_REQUEST['submitoptions'])) {
$_message .= $pma_table->getLastMessage();
$result = true;
$GLOBALS['table'] = $pma_table->getName();
$reread_info = $pma_table->getStatusInfo(null, true);
$reread_info = true;
$reload = true;
} else {
$_message .= $pma_table->getLastError();
@ -214,7 +214,7 @@ if ($reread_info) {
// a change, clear the cache
$GLOBALS['dbi']->clearTableCache();
$GLOBALS['dbi']->selectDb($GLOBALS['db']);
$GLOBALS['showtable'] = $pma_table->getStatusInfo(null, (isset($reread_info) && $reread_info ? true : false));
$GLOBALS['showtable'] = $pma_table->getStatusInfo(null, true);
if ($pma_table->isView()) {
$tbl_is_view = true;
$tbl_storage_engine = __('View');
@ -230,6 +230,7 @@ if ($reread_info) {
$auto_increment = $pma_table->getAutoIncrementInfo();
$create_options = $pma_table->createOptionsArray();
}
unset($reread_info);
if (isset($result) && empty($message_to_show)) {
if (empty($_message)) {

View File

@ -1211,7 +1211,7 @@ class TableTest extends PMATestCase
$target_table = 'table1';
$target_db = 'pma_test';
$tbl_object = new Table($target_db, $target_table);
$reread_info = $tbl_object->getStatusInfo(null, true);
$tbl_object->getStatusInfo(null, true);
$extension = new PMA\libraries\dbi\DBIDummy();
$dbi = new PMA\libraries\DatabaseInterface($extension);
$expect = '';
@ -1234,7 +1234,7 @@ class TableTest extends PMATestCase
$target_table = 'table1';
$target_db = 'pma_test';
$tbl_object = new Table($target_db, $target_table);
$reread_info = $tbl_object->getStatusInfo(null, true);
$tbl_object->getStatusInfo(null, true);
$extension = new PMA\libraries\dbi\DBIDummy();
$dbi = new PMA\libraries\DatabaseInterface($extension);
$expect = '';
@ -1257,7 +1257,7 @@ class TableTest extends PMATestCase
$target_table = 'table1';
$target_db = 'pma_test';
$tbl_object = new Table($target_db, $target_table);
$reread_info = $tbl_object->getStatusInfo(null, true);
$tbl_object->getStatusInfo(null, true);
$extension = new PMA\libraries\dbi\DBIDummy();
$dbi = new PMA\libraries\DatabaseInterface($extension);
$expect = '';
@ -1280,7 +1280,7 @@ class TableTest extends PMATestCase
$target_table = 'table1';
$target_db = 'pma_test';
$tbl_object = new Table($target_db, $target_table);
$reread_info = $tbl_object->getStatusInfo(null, true);
$tbl_object->getStatusInfo(null, true);
$extension = new PMA\libraries\dbi\DBIDummy();
$dbi = new PMA\libraries\DatabaseInterface($extension);
$expect = '';
@ -1303,7 +1303,7 @@ class TableTest extends PMATestCase
$target_table = 'table1';
$target_db = 'pma_test';
$tbl_object = new Table($target_db, $target_table);
$reread_info = $tbl_object->getStatusInfo(null, true);
$tbl_object->getStatusInfo(null, true);
$extension = new PMA\libraries\dbi\DBIDummy();
$dbi = new PMA\libraries\DatabaseInterface($extension);
$expect = '';
@ -1326,7 +1326,7 @@ class TableTest extends PMATestCase
$target_table = 'table1';
$target_db = 'pma_test';
$tbl_object = new Table($target_db, $target_table);
$reread_info = $tbl_object->getStatusInfo(null, true);
$tbl_object->getStatusInfo(null, true);
$extension = new PMA\libraries\dbi\DBIDummy();
$dbi = new PMA\libraries\DatabaseInterface($extension);
$expect = array('pack_keys' => 'DEFAULT');

View File

@ -36,11 +36,6 @@ require './libraries/tbl_common.inc.php';
$url_query .= '&amp;goto=view_operations.php&amp;back=view_operations.php';
$url_params['goto'] = $url_params['back'] = 'view_operations.php';
/**
* Gets tables information
*/
$reread_info = $pma_table->getStatusInfo(null, false);
/**
* Updates if required
*/
@ -53,7 +48,8 @@ if (isset($_REQUEST['submitoptions'])) {
$_message->addText($pma_table->getLastMessage());
$result = true;
$GLOBALS['table'] = $pma_table->getName();
$reread_info = $pma_table->getStatusInfo(null, true);
/* Force reread after rename */
$pma_table->getStatusInfo(null, true);
$reload = true;
} else {
$_message->addText($pma_table->getLastError());