Remove is_show_stats PHP global variable

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
Maurício Meneghini Fauth 2020-10-29 23:17:15 -03:00
parent 3c49539a98
commit 71c2f2d99a
16 changed files with 30 additions and 48 deletions

View File

@ -15,18 +15,13 @@ final class Common
{
public static function database(): void
{
global $cfg, $db, $is_show_stats, $db_is_system_schema, $err_url;
global $cfg, $db, $db_is_system_schema, $err_url;
global $message, $dbi, $errno, $is_db, $err_url_0;
Util::checkParameters(['db']);
$response = Response::getInstance();
$is_show_stats = $cfg['ShowStats'];
$db_is_system_schema = Utilities::isSystemSchema($db);
if ($db_is_system_schema) {
$is_show_stats = false;
}
/**
* Defines the urls to return to in case of error in a sql statement

View File

@ -42,7 +42,7 @@ class DesignerController extends AbstractController
{
global $db, $script_display_field, $tab_column, $tables_all_keys, $tables_pk_or_unique_keys;
global $success, $page, $message, $display_page, $selected_page, $tab_pos, $fullTableNames, $script_tables;
global $script_contr, $params, $tables, $num_tables, $total_num_tables, $sub_part, $is_show_stats;
global $script_contr, $params, $tables, $num_tables, $total_num_tables, $sub_part;
global $db_is_system_schema, $tooltip_truename, $tooltip_aliasname, $pos, $classes_side_menu;
if (isset($_POST['dialog'])) {
@ -218,8 +218,7 @@ class DesignerController extends AbstractController
$tables,
$num_tables,
$total_num_tables,
$sub_part,
$is_show_stats,
$sub_part,,
$db_is_system_schema,
$tooltip_truename,
$tooltip_aliasname,

View File

@ -35,7 +35,7 @@ final class EventsController extends AbstractController
public function index(): void
{
global $db, $tables, $num_tables, $total_num_tables, $sub_part, $errors, $text_dir, $PMA_Theme;
global $is_show_stats, $db_is_system_schema, $tooltip_truename, $tooltip_aliasname, $pos;
global $db_is_system_schema, $tooltip_truename, $tooltip_aliasname, $pos;
if (! $this->response->isAjax()) {
Common::database();
@ -44,8 +44,7 @@ final class EventsController extends AbstractController
$tables,
$num_tables,
$total_num_tables,
$sub_part,
$is_show_stats,
$sub_part,,
$db_is_system_schema,
$tooltip_truename,
$tooltip_aliasname,

View File

@ -39,7 +39,7 @@ final class ExportController extends AbstractController
public function index(): void
{
global $db, $table, $sub_part, $url_params, $sql_query;
global $tables, $num_tables, $total_num_tables, $is_show_stats, $db_is_system_schema, $tooltip_truename;
global $tables, $num_tables, $total_num_tables, $db_is_system_schema, $tooltip_truename;
global $tooltip_aliasname, $pos, $table_select, $unlim_num_rows;
$pageSettings = new PageSettings('Export');
@ -60,8 +60,7 @@ final class ExportController extends AbstractController
$tables,
$num_tables,
$total_num_tables,
$sub_part,
$is_show_stats,
$sub_part,,
$db_is_system_schema,
$tooltip_truename,
$tooltip_aliasname,

View File

@ -38,7 +38,7 @@ final class ImportController extends AbstractController
public function index(): void
{
global $db, $max_upload_size, $table, $tables, $num_tables, $total_num_tables, $is_show_stats, $cfg;
global $db, $max_upload_size, $table, $tables, $num_tables, $total_num_tables, $cfg;
global $db_is_system_schema, $tooltip_truename, $tooltip_aliasname, $pos, $sub_part, $SESSION_KEY, $PMA_Theme;
$pageSettings = new PageSettings('Import');
@ -53,8 +53,7 @@ final class ImportController extends AbstractController
$tables,
$num_tables,
$total_num_tables,
$sub_part,
$is_show_stats,
$sub_part,,
$db_is_system_schema,
$tooltip_truename,
$tooltip_aliasname,

View File

@ -71,7 +71,7 @@ class OperationsController extends AbstractController
{
global $cfg, $db, $server, $sql_query, $move, $message, $tables_full;
global $export_sql_plugin, $views, $sqlConstratints, $local_query, $reload, $url_params, $tables;
global $total_num_tables, $sub_part, $is_show_stats, $db_is_system_schema, $tooltip_truename;
global $total_num_tables, $sub_part, $db_is_system_schema, $tooltip_truename;
global $db_collation, $tooltip_aliasname, $pos, $is_information_schema, $single_table, $num_tables;
$this->checkUserPrivileges->getPrivileges();
@ -274,8 +274,7 @@ class OperationsController extends AbstractController
$tables,
$num_tables,
$total_num_tables,
$sub_part,
$is_show_stats,
$sub_part,,
$db_is_system_schema,
$tooltip_truename,
$tooltip_aliasname,

View File

@ -43,7 +43,7 @@ class QueryByExampleController extends AbstractController
{
global $db, $savedSearchList, $savedSearch, $currentSearchId, $PMA_Theme;
global $sql_query, $goto, $sub_part, $tables, $num_tables, $total_num_tables;
global $is_show_stats, $db_is_system_schema, $tooltip_truename, $tooltip_aliasname, $pos, $url_params;
global $db_is_system_schema, $tooltip_truename, $tooltip_aliasname, $pos, $url_params;
// Gets the relation settings
$cfgRelation = $this->relation->getRelationsParam();
@ -146,8 +146,7 @@ class QueryByExampleController extends AbstractController
$tables,
$num_tables,
$total_num_tables,
$sub_part,
$is_show_stats,
$sub_part,,
$db_is_system_schema,
$tooltip_truename,
$tooltip_aliasname,

View File

@ -43,7 +43,7 @@ class RoutinesController extends AbstractController
public function index(): void
{
global $db, $table, $tables, $num_tables, $total_num_tables, $sub_part, $is_show_stats;
global $db, $table, $tables, $num_tables, $total_num_tables, $sub_part;
global $db_is_system_schema, $tooltip_truename, $tooltip_aliasname, $pos;
global $errors, $PMA_Theme, $text_dir, $err_url, $url_params, $cfg;
@ -72,8 +72,7 @@ class RoutinesController extends AbstractController
$tables,
$num_tables,
$total_num_tables,
$sub_part,
$is_show_stats,
$sub_part,,
$db_is_system_schema,
$tooltip_truename,
$tooltip_aliasname,

View File

@ -32,7 +32,7 @@ class SearchController extends AbstractController
public function index(): void
{
global $cfg, $db, $err_url, $url_params, $tables, $num_tables, $total_num_tables, $sub_part;
global $is_show_stats, $db_is_system_schema, $tooltip_truename, $tooltip_aliasname, $pos;
global $db_is_system_schema, $tooltip_truename, $tooltip_aliasname, $pos;
$this->addScriptFiles([
'database/search.js',
@ -63,8 +63,7 @@ class SearchController extends AbstractController
$tables,
$num_tables,
$total_num_tables,
$sub_part,
$is_show_stats,
$sub_part,,
$db_is_system_schema,
$tooltip_truename,
$tooltip_aliasname,

View File

@ -573,7 +573,7 @@ class StructureController extends AbstractController
'db_is_system_schema' => $this->dbIsSystemSchema,
'replication' => $replicaInfo['status'],
'properties_num_columns' => $GLOBALS['cfg']['PropertiesNumColumns'],
'is_show_stats' => $GLOBALS['is_show_stats'],
'is_show_stats' => $this->isShowStats,
'show_charset' => $GLOBALS['cfg']['ShowDbStructureCharset'],
'show_comment' => $GLOBALS['cfg']['ShowDbStructureComment'],
'show_creation' => $GLOBALS['cfg']['ShowDbStructureCreation'],

View File

@ -45,7 +45,7 @@ class TrackingController extends AbstractController
public function index(): void
{
global $db, $text_dir, $url_params, $tables, $num_tables, $PMA_Theme;
global $total_num_tables, $sub_part, $is_show_stats, $pos, $data, $cfg;
global $total_num_tables, $sub_part, $pos, $data, $cfg;
global $db_is_system_schema, $tooltip_truename, $tooltip_aliasname;
$this->addScriptFiles(['vendor/jquery/jquery.tablesorter.js', 'database/tracking.js']);
@ -65,8 +65,7 @@ class TrackingController extends AbstractController
$tables,
$num_tables,
$total_num_tables,
$sub_part,
$is_show_stats,
$sub_part,,
$db_is_system_schema,
$tooltip_truename,
$tooltip_aliasname,

View File

@ -37,7 +37,7 @@ class TriggersController extends AbstractController
public function index(): void
{
global $db, $table, $tables, $num_tables, $total_num_tables, $sub_part, $is_show_stats;
global $db, $table, $tables, $num_tables, $total_num_tables, $sub_part;
global $db_is_system_schema, $tooltip_truename, $tooltip_aliasname, $pos;
global $errors, $url_params, $err_url, $cfg;
@ -62,8 +62,7 @@ class TriggersController extends AbstractController
$tables,
$num_tables,
$total_num_tables,
$sub_part,
$is_show_stats,
$sub_part,,
$db_is_system_schema,
$tooltip_truename,
$tooltip_aliasname,

View File

@ -54,7 +54,7 @@ class PrivilegesController extends AbstractController
global $db, $table, $err_url, $message, $text_dir, $post_patterns, $PMA_Theme;
global $username, $hostname, $dbname, $tablename, $routinename, $db_and_table, $dbname_is_wildcard;
global $queries, $password, $ret_message, $ret_queries, $queries_for_display, $sql_query, $_add_user_error;
global $itemType, $tables, $num_tables, $total_num_tables, $sub_part, $is_show_stats, $db_is_system_schema;
global $itemType, $tables, $num_tables, $total_num_tables, $sub_part, $db_is_system_schema;
global $tooltip_truename, $tooltip_aliasname, $pos, $title, $export, $grants, $one_grant, $url_dbname;
$checkUserPrivileges = new CheckUserPrivileges($this->dbi);
@ -355,8 +355,7 @@ class PrivilegesController extends AbstractController
$tables,
$num_tables,
$total_num_tables,
$sub_part,
$is_show_stats,
$sub_part,,
$db_is_system_schema,
$tooltip_truename,
$tooltip_aliasname,

View File

@ -38,7 +38,7 @@ class TriggersController extends AbstractController
public function index(): void
{
global $db, $table, $tables, $num_tables, $total_num_tables, $sub_part, $is_show_stats;
global $db, $table, $tables, $num_tables, $total_num_tables, $sub_part;
global $db_is_system_schema, $tooltip_truename, $tooltip_aliasname, $pos;
global $errors, $url_params, $err_url, $cfg;
@ -63,8 +63,7 @@ class TriggersController extends AbstractController
$tables,
$num_tables,
$total_num_tables,
$sub_part,
$is_show_stats,
$sub_part,,
$db_is_system_schema,
$tooltip_truename,
$tooltip_aliasname,

View File

@ -2664,7 +2664,7 @@ class Util
/**
* whether to display extended stats
*/
$is_show_stats = $cfg['ShowStats'];
$isShowStats = $cfg['ShowStats'];
/**
* whether selected db is information_schema
@ -2672,7 +2672,7 @@ class Util
$db_is_system_schema = false;
if (Utilities::isSystemSchema($db)) {
$is_show_stats = false;
$isShowStats = false;
$db_is_system_schema = true;
}
@ -2801,7 +2801,7 @@ class Util
$num_tables,
$total_num_tables,
$sub_part,
$is_show_stats,
$isShowStats,
$db_is_system_schema,
$tooltip_truename,
$tooltip_aliasname,

View File

@ -166,8 +166,7 @@ class StructureControllerTest extends AbstractTestCase
16394,
$sumSize
);
// Not showing statistics
$is_show_stats = false;
$controller = new StructureController(
$this->response,
$this->template,