Remove is_system_schema PHP global variable
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
parent
71c2f2d99a
commit
ef62d7a9f5
@ -4,7 +4,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin;
|
||||
|
||||
use PhpMyAdmin\Query\Utilities;
|
||||
use function strlen;
|
||||
use function strpos;
|
||||
|
||||
@ -15,13 +14,12 @@ final class Common
|
||||
{
|
||||
public static function database(): void
|
||||
{
|
||||
global $cfg, $db, $db_is_system_schema, $err_url;
|
||||
global $cfg, $db, $err_url;
|
||||
global $message, $dbi, $errno, $is_db, $err_url_0;
|
||||
|
||||
Util::checkParameters(['db']);
|
||||
|
||||
$response = Response::getInstance();
|
||||
$db_is_system_schema = Utilities::isSystemSchema($db);
|
||||
|
||||
/**
|
||||
* Defines the urls to return to in case of error in a sql statement
|
||||
|
||||
@ -43,7 +43,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;
|
||||
global $db_is_system_schema, $tooltip_truename, $tooltip_aliasname, $pos, $classes_side_menu;
|
||||
global $tooltip_truename, $tooltip_aliasname, $pos, $classes_side_menu;
|
||||
|
||||
if (isset($_POST['dialog'])) {
|
||||
if ($_POST['dialog'] === 'edit') {
|
||||
@ -218,8 +218,7 @@ class DesignerController extends AbstractController
|
||||
$tables,
|
||||
$num_tables,
|
||||
$total_num_tables,
|
||||
$sub_part,,
|
||||
$db_is_system_schema,
|
||||
$sub_part,,,
|
||||
$tooltip_truename,
|
||||
$tooltip_aliasname,
|
||||
$pos,
|
||||
|
||||
@ -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 $db_is_system_schema, $tooltip_truename, $tooltip_aliasname, $pos;
|
||||
global $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,,
|
||||
$db_is_system_schema,
|
||||
$sub_part,,,
|
||||
$tooltip_truename,
|
||||
$tooltip_aliasname,
|
||||
$pos,
|
||||
|
||||
@ -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, $db_is_system_schema, $tooltip_truename;
|
||||
global $tables, $num_tables, $total_num_tables, $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,,
|
||||
$db_is_system_schema,
|
||||
$sub_part,,,
|
||||
$tooltip_truename,
|
||||
$tooltip_aliasname,
|
||||
$pos,
|
||||
|
||||
@ -39,7 +39,7 @@ final class ImportController extends AbstractController
|
||||
public function index(): void
|
||||
{
|
||||
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;
|
||||
global $tooltip_truename, $tooltip_aliasname, $pos, $sub_part, $SESSION_KEY, $PMA_Theme;
|
||||
|
||||
$pageSettings = new PageSettings('Import');
|
||||
$pageSettingsErrorHtml = $pageSettings->getErrorHTML();
|
||||
@ -53,8 +53,7 @@ final class ImportController extends AbstractController
|
||||
$tables,
|
||||
$num_tables,
|
||||
$total_num_tables,
|
||||
$sub_part,,
|
||||
$db_is_system_schema,
|
||||
$sub_part,,,
|
||||
$tooltip_truename,
|
||||
$tooltip_aliasname,
|
||||
$pos,
|
||||
|
||||
@ -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, $db_is_system_schema, $tooltip_truename;
|
||||
global $total_num_tables, $sub_part, $tooltip_truename;
|
||||
global $db_collation, $tooltip_aliasname, $pos, $is_information_schema, $single_table, $num_tables;
|
||||
|
||||
$this->checkUserPrivileges->getPrivileges();
|
||||
@ -275,7 +275,7 @@ class OperationsController extends AbstractController
|
||||
$num_tables,
|
||||
$total_num_tables,
|
||||
$sub_part,,
|
||||
$db_is_system_schema,
|
||||
$isSystemSchema,
|
||||
$tooltip_truename,
|
||||
$tooltip_aliasname,
|
||||
$pos,
|
||||
@ -303,7 +303,7 @@ class OperationsController extends AbstractController
|
||||
&& $GLOBALS['col_priv'] && $GLOBALS['proc_priv'] && $GLOBALS['is_reload_priv'];
|
||||
|
||||
$isDropDatabaseAllowed = ($this->dbi->isSuperUser() || $cfg['AllowUserDropDatabase'])
|
||||
&& ! $db_is_system_schema && $db !== 'mysql';
|
||||
&& ! $isSystemSchema && $db !== 'mysql';
|
||||
|
||||
$switchToNew = isset($_SESSION['pma_switch_to_new']) && $_SESSION['pma_switch_to_new'];
|
||||
|
||||
|
||||
@ -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 $db_is_system_schema, $tooltip_truename, $tooltip_aliasname, $pos, $url_params;
|
||||
global $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,,
|
||||
$db_is_system_schema,
|
||||
$sub_part,,,
|
||||
$tooltip_truename,
|
||||
$tooltip_aliasname,
|
||||
$pos,
|
||||
|
||||
@ -10,7 +10,6 @@ use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\Database\Routines;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\DbTableExists;
|
||||
use PhpMyAdmin\Query\Utilities;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Template;
|
||||
use PhpMyAdmin\Url;
|
||||
@ -44,7 +43,7 @@ class RoutinesController extends AbstractController
|
||||
public function index(): void
|
||||
{
|
||||
global $db, $table, $tables, $num_tables, $total_num_tables, $sub_part;
|
||||
global $db_is_system_schema, $tooltip_truename, $tooltip_aliasname, $pos;
|
||||
global $tooltip_truename, $tooltip_aliasname, $pos;
|
||||
global $errors, $PMA_Theme, $text_dir, $err_url, $url_params, $cfg;
|
||||
|
||||
$type = $_REQUEST['type'] ?? null;
|
||||
@ -58,7 +57,6 @@ class RoutinesController extends AbstractController
|
||||
if (! empty($table) && in_array($table, $this->dbi->getTables($db))) {
|
||||
Util::checkParameters(['db', 'table']);
|
||||
|
||||
$db_is_system_schema = Utilities::isSystemSchema($db);
|
||||
$url_params = ['db' => $db, 'table' => $table];
|
||||
$err_url = Util::getScriptNameForOption($cfg['DefaultTabTable'], 'table');
|
||||
$err_url .= Url::getCommon($url_params, '&');
|
||||
@ -72,8 +70,7 @@ class RoutinesController extends AbstractController
|
||||
$tables,
|
||||
$num_tables,
|
||||
$total_num_tables,
|
||||
$sub_part,,
|
||||
$db_is_system_schema,
|
||||
$sub_part,,,
|
||||
$tooltip_truename,
|
||||
$tooltip_aliasname,
|
||||
$pos,
|
||||
|
||||
@ -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 $db_is_system_schema, $tooltip_truename, $tooltip_aliasname, $pos;
|
||||
global $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,,
|
||||
$db_is_system_schema,
|
||||
$sub_part,,,
|
||||
$tooltip_truename,
|
||||
$tooltip_aliasname,
|
||||
$pos,
|
||||
|
||||
@ -46,7 +46,7 @@ class TrackingController extends AbstractController
|
||||
{
|
||||
global $db, $text_dir, $url_params, $tables, $num_tables, $PMA_Theme;
|
||||
global $total_num_tables, $sub_part, $pos, $data, $cfg;
|
||||
global $db_is_system_schema, $tooltip_truename, $tooltip_aliasname;
|
||||
global $tooltip_truename, $tooltip_aliasname;
|
||||
|
||||
$this->addScriptFiles(['vendor/jquery/jquery.tablesorter.js', 'database/tracking.js']);
|
||||
|
||||
@ -66,7 +66,7 @@ class TrackingController extends AbstractController
|
||||
$num_tables,
|
||||
$total_num_tables,
|
||||
$sub_part,,
|
||||
$db_is_system_schema,
|
||||
$isSystemSchema,
|
||||
$tooltip_truename,
|
||||
$tooltip_aliasname,
|
||||
$pos,
|
||||
@ -124,7 +124,7 @@ class TrackingController extends AbstractController
|
||||
if ($num_tables == 0 && count($data['ddlog']) === 0) {
|
||||
echo '<p>' , __('No tables found in database.') , '</p>' , "\n";
|
||||
|
||||
if (empty($db_is_system_schema)) {
|
||||
if (empty($isSystemSchema)) {
|
||||
$checkUserPrivileges = new CheckUserPrivileges($this->dbi);
|
||||
$checkUserPrivileges->getPrivileges();
|
||||
|
||||
|
||||
@ -8,7 +8,6 @@ use PhpMyAdmin\Common;
|
||||
use PhpMyAdmin\Database\Triggers;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\DbTableExists;
|
||||
use PhpMyAdmin\Query\Utilities;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Template;
|
||||
use PhpMyAdmin\Url;
|
||||
@ -38,7 +37,7 @@ class TriggersController extends AbstractController
|
||||
public function index(): void
|
||||
{
|
||||
global $db, $table, $tables, $num_tables, $total_num_tables, $sub_part;
|
||||
global $db_is_system_schema, $tooltip_truename, $tooltip_aliasname, $pos;
|
||||
global $tooltip_truename, $tooltip_aliasname, $pos;
|
||||
global $errors, $url_params, $err_url, $cfg;
|
||||
|
||||
if (! $this->response->isAjax()) {
|
||||
@ -48,7 +47,6 @@ class TriggersController extends AbstractController
|
||||
if (! empty($table) && in_array($table, $this->dbi->getTables($db))) {
|
||||
Util::checkParameters(['db', 'table']);
|
||||
|
||||
$db_is_system_schema = Utilities::isSystemSchema($db);
|
||||
$url_params = ['db' => $db, 'table' => $table];
|
||||
$err_url = Util::getScriptNameForOption($cfg['DefaultTabTable'], 'table');
|
||||
$err_url .= Url::getCommon($url_params, '&');
|
||||
@ -62,8 +60,7 @@ class TriggersController extends AbstractController
|
||||
$tables,
|
||||
$num_tables,
|
||||
$total_num_tables,
|
||||
$sub_part,,
|
||||
$db_is_system_schema,
|
||||
$sub_part,,,
|
||||
$tooltip_truename,
|
||||
$tooltip_aliasname,
|
||||
$pos,
|
||||
|
||||
@ -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, $db_is_system_schema;
|
||||
global $itemType, $tables, $num_tables, $total_num_tables, $sub_part;
|
||||
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,,
|
||||
$db_is_system_schema,
|
||||
$sub_part,,,
|
||||
$tooltip_truename,
|
||||
$tooltip_aliasname,
|
||||
$pos,
|
||||
|
||||
@ -10,7 +10,6 @@ use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\DbTableExists;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Query\Utilities;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Table\ColumnsDefinition;
|
||||
@ -66,7 +65,7 @@ class AddFieldController extends AbstractController
|
||||
public function index(): void
|
||||
{
|
||||
global $err_url, $message, $action, $active_page, $sql_query;
|
||||
global $num_fields, $regenerate, $result, $db, $table, $db_is_system_schema;
|
||||
global $num_fields, $regenerate, $result, $db, $table;
|
||||
|
||||
$this->addScriptFiles(['table/structure.js']);
|
||||
|
||||
@ -163,7 +162,6 @@ class AddFieldController extends AbstractController
|
||||
return;
|
||||
}
|
||||
|
||||
$db_is_system_schema = Utilities::isSystemSchema($db);
|
||||
$url_params = ['db' => $db, 'table' => $table];
|
||||
$err_url = Util::getScriptNameForOption($cfg['DefaultTabTable'], 'table');
|
||||
$err_url .= Url::getCommon($url_params, '&');
|
||||
|
||||
@ -8,7 +8,6 @@ use PhpMyAdmin\Common;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\DbTableExists;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Query\Utilities;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\SqlParser\Components\Limit;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
@ -45,7 +44,7 @@ class ChartController extends AbstractController
|
||||
|
||||
public function index(): void
|
||||
{
|
||||
global $db, $table, $cfg, $sql_query, $err_url, $db_is_system_schema;
|
||||
global $db, $table, $cfg, $sql_query, $err_url;
|
||||
|
||||
if (isset($_REQUEST['pos'], $_REQUEST['session_max_rows']) && $this->response->isAjax()
|
||||
) {
|
||||
@ -87,7 +86,6 @@ class ChartController extends AbstractController
|
||||
if (strlen($table) > 0) {
|
||||
Util::checkParameters(['db', 'table']);
|
||||
|
||||
$db_is_system_schema = Utilities::isSystemSchema($db);
|
||||
$url_params = ['db' => $db, 'table' => $table];
|
||||
$err_url = Util::getScriptNameForOption($cfg['DefaultTabTable'], 'table');
|
||||
$err_url .= Url::getCommon($url_params, '&');
|
||||
@ -171,12 +169,11 @@ class ChartController extends AbstractController
|
||||
*/
|
||||
public function ajax(): void
|
||||
{
|
||||
global $db, $table, $sql_query, $db_is_system_schema, $url_params, $err_url, $cfg;
|
||||
global $db, $table, $sql_query, $url_params, $err_url, $cfg;
|
||||
|
||||
if (strlen($table) > 0 && strlen($db) > 0) {
|
||||
Util::checkParameters(['db', 'table']);
|
||||
|
||||
$db_is_system_schema = Utilities::isSystemSchema($db);
|
||||
$url_params = ['db' => $db, 'table' => $table];
|
||||
$err_url = Util::getScriptNameForOption($cfg['DefaultTabTable'], 'table');
|
||||
$err_url .= Url::getCommon($url_params, '&');
|
||||
|
||||
@ -7,7 +7,6 @@ namespace PhpMyAdmin\Controllers\Table;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\DbTableExists;
|
||||
use PhpMyAdmin\Operations;
|
||||
use PhpMyAdmin\Query\Utilities;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\RelationCleanup;
|
||||
use PhpMyAdmin\Response;
|
||||
@ -113,7 +112,7 @@ class DeleteController extends AbstractController
|
||||
|
||||
public function confirm(): void
|
||||
{
|
||||
global $db, $table, $sql_query, $db_is_system_schema, $url_params, $err_url, $cfg;
|
||||
global $db, $table, $sql_query, $url_params, $err_url, $cfg;
|
||||
|
||||
$selected = $_POST['rows_to_delete'] ?? null;
|
||||
|
||||
@ -126,7 +125,6 @@ class DeleteController extends AbstractController
|
||||
|
||||
Util::checkParameters(['db', 'table']);
|
||||
|
||||
$db_is_system_schema = Utilities::isSystemSchema($db);
|
||||
$url_params = ['db' => $db, 'table' => $table];
|
||||
$err_url = Util::getScriptNameForOption($cfg['DefaultTabTable'], 'table');
|
||||
$err_url .= Url::getCommon($url_params, '&');
|
||||
|
||||
@ -9,7 +9,6 @@ use PhpMyAdmin\Export\Options;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Plugins;
|
||||
use PhpMyAdmin\Query\Utilities;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use PhpMyAdmin\SqlParser\Statements\SelectStatement;
|
||||
@ -44,7 +43,7 @@ class ExportController extends AbstractController
|
||||
|
||||
public function index(): void
|
||||
{
|
||||
global $db, $url_params, $table, $replaces, $db_is_system_schema, $cfg, $err_url;
|
||||
global $db, $url_params, $table, $replaces, $cfg, $err_url;
|
||||
global $sql_query, $where_clause, $num_tables, $unlim_num_rows;
|
||||
|
||||
$pageSettings = new PageSettings('Export');
|
||||
@ -55,7 +54,6 @@ class ExportController extends AbstractController
|
||||
|
||||
Util::checkParameters(['db', 'table']);
|
||||
|
||||
$db_is_system_schema = Utilities::isSystemSchema($db);
|
||||
$url_params = ['db' => $db, 'table' => $table];
|
||||
$err_url = Util::getScriptNameForOption($cfg['DefaultTabTable'], 'table');
|
||||
$err_url .= Url::getCommon($url_params, '&');
|
||||
|
||||
@ -7,7 +7,6 @@ namespace PhpMyAdmin\Controllers\Table;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\DbTableExists;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Query\Utilities;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Template;
|
||||
use PhpMyAdmin\Url;
|
||||
@ -63,11 +62,10 @@ class FindReplaceController extends AbstractController
|
||||
|
||||
public function index(): void
|
||||
{
|
||||
global $db, $table, $db_is_system_schema, $url_params, $cfg, $err_url;
|
||||
global $db, $table, $url_params, $cfg, $err_url;
|
||||
|
||||
Util::checkParameters(['db', 'table']);
|
||||
|
||||
$db_is_system_schema = Utilities::isSystemSchema($db);
|
||||
$url_params = ['db' => $db, 'table' => $table];
|
||||
$err_url = Util::getScriptNameForOption($cfg['DefaultTabTable'], 'table');
|
||||
$err_url .= Url::getCommon($url_params, '&');
|
||||
|
||||
@ -15,7 +15,6 @@ use PhpMyAdmin\Import;
|
||||
use PhpMyAdmin\Import\Ajax;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Plugins;
|
||||
use PhpMyAdmin\Query\Utilities;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Template;
|
||||
use PhpMyAdmin\Url;
|
||||
@ -41,8 +40,7 @@ final class ImportController extends AbstractController
|
||||
|
||||
public function index(): void
|
||||
{
|
||||
global $db, $max_upload_size, $table, $url_params, $SESSION_KEY, $cfg, $PMA_Theme;
|
||||
global $db_is_system_schema, $err_url;
|
||||
global $db, $max_upload_size, $table, $url_params, $SESSION_KEY, $cfg, $PMA_Theme, $err_url;
|
||||
|
||||
$pageSettings = new PageSettings('Import');
|
||||
$pageSettingsErrorHtml = $pageSettings->getErrorHTML();
|
||||
@ -52,7 +50,6 @@ final class ImportController extends AbstractController
|
||||
|
||||
Util::checkParameters(['db', 'table']);
|
||||
|
||||
$db_is_system_schema = Utilities::isSystemSchema($db);
|
||||
$url_params = ['db' => $db, 'table' => $table];
|
||||
$err_url = Util::getScriptNameForOption($cfg['DefaultTabTable'], 'table');
|
||||
$err_url .= Url::getCommon($url_params, '&');
|
||||
|
||||
@ -9,7 +9,6 @@ use PhpMyAdmin\DbTableExists;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Index;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Query\Utilities;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Template;
|
||||
use PhpMyAdmin\Url;
|
||||
@ -40,12 +39,11 @@ class IndexesController extends AbstractController
|
||||
|
||||
public function index(): void
|
||||
{
|
||||
global $db, $table, $db_is_system_schema, $url_params, $cfg, $err_url;
|
||||
global $db, $table, $url_params, $cfg, $err_url;
|
||||
|
||||
if (! isset($_POST['create_edit_table'])) {
|
||||
Util::checkParameters(['db', 'table']);
|
||||
|
||||
$db_is_system_schema = Utilities::isSystemSchema($db);
|
||||
$url_params = ['db' => $db, 'table' => $table];
|
||||
$err_url = Util::getScriptNameForOption($cfg['DefaultTabTable'], 'table');
|
||||
$err_url .= Url::getCommon($url_params, '&');
|
||||
|
||||
@ -71,7 +71,7 @@ class OperationsController extends AbstractController
|
||||
global $show_comment, $tbl_collation, $table_info_num_rows, $row_format, $auto_increment, $create_options;
|
||||
global $table_alters, $warning_messages, $lowerCaseNames, $db, $table, $reload, $result;
|
||||
global $new_tbl_storage_engine, $sql_query, $message_to_show, $columns, $hideOrderTable, $indexes;
|
||||
global $notNull, $comment, $db_is_system_schema, $err_url, $cfg;
|
||||
global $notNull, $comment, $err_url, $cfg;
|
||||
|
||||
$this->checkUserPrivileges->getPrivileges();
|
||||
|
||||
@ -88,7 +88,7 @@ class OperationsController extends AbstractController
|
||||
|
||||
Util::checkParameters(['db', 'table']);
|
||||
|
||||
$db_is_system_schema = Utilities::isSystemSchema($db);
|
||||
$isSystemSchema = Utilities::isSystemSchema($db);
|
||||
$url_params = ['db' => $db, 'table' => $table];
|
||||
$err_url = Util::getScriptNameForOption($cfg['DefaultTabTable'], 'table');
|
||||
$err_url .= Url::getCommon($url_params, '&');
|
||||
@ -486,7 +486,7 @@ class OperationsController extends AbstractController
|
||||
'has_foreign_keys' => $hasForeignKeys,
|
||||
'has_privileges' => $hasPrivileges,
|
||||
'switch_to_new' => $switchToNew,
|
||||
'is_system_schema' => $db_is_system_schema,
|
||||
'is_system_schema' => $isSystemSchema,
|
||||
'is_view' => $tbl_is_view,
|
||||
'partitions' => $partitions,
|
||||
'partitions_choices' => $partitionsChoices,
|
||||
|
||||
@ -8,7 +8,6 @@ use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\DbTableExists;
|
||||
use PhpMyAdmin\Operations;
|
||||
use PhpMyAdmin\Query\Utilities;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\RelationCleanup;
|
||||
use PhpMyAdmin\Response;
|
||||
@ -188,11 +187,10 @@ class SearchController extends AbstractController
|
||||
*/
|
||||
public function index(): void
|
||||
{
|
||||
global $db, $table, $db_is_system_schema, $url_params, $cfg, $err_url;
|
||||
global $db, $table, $url_params, $cfg, $err_url;
|
||||
|
||||
Util::checkParameters(['db', 'table']);
|
||||
|
||||
$db_is_system_schema = Utilities::isSystemSchema($db);
|
||||
$url_params = ['db' => $db, 'table' => $table];
|
||||
$err_url = Util::getScriptNameForOption($cfg['DefaultTabTable'], 'table');
|
||||
$err_url .= Url::getCommon($url_params, '&');
|
||||
|
||||
@ -6,7 +6,6 @@ namespace PhpMyAdmin\Controllers\Table;
|
||||
|
||||
use PhpMyAdmin\Config\PageSettings;
|
||||
use PhpMyAdmin\DbTableExists;
|
||||
use PhpMyAdmin\Query\Utilities;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\SqlQueryForm;
|
||||
use PhpMyAdmin\Template;
|
||||
@ -35,7 +34,7 @@ final class SqlController extends AbstractController
|
||||
|
||||
public function index(): void
|
||||
{
|
||||
global $err_url, $goto, $back, $db_is_system_schema, $db, $table, $cfg;
|
||||
global $err_url, $goto, $back, $db, $table, $cfg;
|
||||
|
||||
$this->addScriptFiles([
|
||||
'makegrid.js',
|
||||
@ -50,7 +49,6 @@ final class SqlController extends AbstractController
|
||||
|
||||
Util::checkParameters(['db', 'table']);
|
||||
|
||||
$db_is_system_schema = Utilities::isSystemSchema($db);
|
||||
$url_params = ['db' => $db, 'table' => $table];
|
||||
$err_url = Util::getScriptNameForOption($cfg['DefaultTabTable'], 'table');
|
||||
$err_url .= Url::getCommon($url_params, '&');
|
||||
|
||||
@ -108,7 +108,7 @@ class StructureController extends AbstractController
|
||||
|
||||
public function index(): void
|
||||
{
|
||||
global $reread_info, $showtable, $db_is_system_schema, $db, $table, $cfg, $err_url;
|
||||
global $reread_info, $showtable, $db, $table, $cfg, $err_url;
|
||||
global $tbl_is_view, $tbl_storage_engine, $tbl_collation, $table_info_num_rows;
|
||||
|
||||
$this->dbi->selectDb($this->db);
|
||||
@ -142,7 +142,7 @@ class StructureController extends AbstractController
|
||||
|
||||
Util::checkParameters(['db', 'table']);
|
||||
|
||||
$db_is_system_schema = Utilities::isSystemSchema($db);
|
||||
$isSystemSchema = Utilities::isSystemSchema($db);
|
||||
$url_params = ['db' => $db, 'table' => $table];
|
||||
$err_url = Util::getScriptNameForOption($cfg['DefaultTabTable'], 'table');
|
||||
$err_url .= Url::getCommon($url_params, '&');
|
||||
@ -172,7 +172,8 @@ class StructureController extends AbstractController
|
||||
$columns_with_unique_index,
|
||||
$primary,
|
||||
$fields,
|
||||
$columns_with_index
|
||||
$columns_with_index,
|
||||
$isSystemSchema
|
||||
));
|
||||
}
|
||||
|
||||
@ -462,7 +463,7 @@ class StructureController extends AbstractController
|
||||
|
||||
public function primary(): void
|
||||
{
|
||||
global $db, $table, $message, $sql_query, $db_is_system_schema, $url_params, $err_url, $cfg;
|
||||
global $db, $table, $message, $sql_query, $url_params, $err_url, $cfg;
|
||||
|
||||
$selected = $_POST['selected'] ?? [];
|
||||
$selected_fld = $_POST['selected_fld'] ?? [];
|
||||
@ -486,7 +487,6 @@ class StructureController extends AbstractController
|
||||
if (! empty($selected_fld) && ! empty($primary)) {
|
||||
Util::checkParameters(['db', 'table']);
|
||||
|
||||
$db_is_system_schema = Utilities::isSystemSchema($db);
|
||||
$url_params = ['db' => $db, 'table' => $table];
|
||||
$err_url = Util::getScriptNameForOption($cfg['DefaultTabTable'], 'table');
|
||||
$err_url .= Url::getCommon($url_params, '&');
|
||||
@ -580,7 +580,7 @@ class StructureController extends AbstractController
|
||||
|
||||
public function dropConfirm(): void
|
||||
{
|
||||
global $db, $table, $db_is_system_schema, $url_params, $err_url, $cfg;
|
||||
global $db, $table, $url_params, $err_url, $cfg;
|
||||
|
||||
$selected = $_POST['selected_fld'] ?? null;
|
||||
|
||||
@ -593,7 +593,6 @@ class StructureController extends AbstractController
|
||||
|
||||
Util::checkParameters(['db', 'table']);
|
||||
|
||||
$db_is_system_schema = Utilities::isSystemSchema($db);
|
||||
$url_params = ['db' => $db, 'table' => $table];
|
||||
$err_url = Util::getScriptNameForOption($cfg['DefaultTabTable'], 'table');
|
||||
$err_url .= Url::getCommon($url_params, '&');
|
||||
@ -1468,9 +1467,10 @@ class StructureController extends AbstractController
|
||||
array $columns_with_unique_index,
|
||||
$primary_index,
|
||||
array $fields,
|
||||
array $columns_with_index
|
||||
array $columns_with_index,
|
||||
bool $isSystemSchema
|
||||
) {
|
||||
global $route, $db_is_system_schema, $tbl_is_view, $tbl_storage_engine, $PMA_Theme;
|
||||
global $route, $tbl_is_view, $tbl_storage_engine, $PMA_Theme;
|
||||
|
||||
// prepare comments
|
||||
$comments_map = [];
|
||||
@ -1495,7 +1495,7 @@ class StructureController extends AbstractController
|
||||
// Get valid statistics whatever is the table type
|
||||
if ($GLOBALS['cfg']['ShowStats']) {
|
||||
//get table stats in HTML format
|
||||
$tablestats = $this->getTableStats();
|
||||
$tablestats = $this->getTableStats($isSystemSchema);
|
||||
//returning the response in JSON format to be used by Ajax
|
||||
$this->response->addJSON('tableStat', $tablestats);
|
||||
}
|
||||
@ -1570,7 +1570,7 @@ class StructureController extends AbstractController
|
||||
'hide_structure_actions' => $hideStructureActions,
|
||||
'db' => $this->db,
|
||||
'table' => $this->table,
|
||||
'db_is_system_schema' => $db_is_system_schema,
|
||||
'db_is_system_schema' => $isSystemSchema,
|
||||
'tbl_is_view' => $tbl_is_view,
|
||||
'mime_map' => $mime_map,
|
||||
'tbl_storage_engine' => $tbl_storage_engine,
|
||||
@ -1610,9 +1610,9 @@ class StructureController extends AbstractController
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getTableStats()
|
||||
protected function getTableStats(bool $isSystemSchema)
|
||||
{
|
||||
global $showtable, $db_is_system_schema, $tbl_is_view;
|
||||
global $showtable, $tbl_is_view;
|
||||
global $tbl_storage_engine, $table_info_num_rows, $tbl_collation;
|
||||
|
||||
if (empty($showtable)) {
|
||||
@ -1717,7 +1717,7 @@ class StructureController extends AbstractController
|
||||
'showtable' => $showtable,
|
||||
'table_info_num_rows' => $table_info_num_rows,
|
||||
'tbl_is_view' => $tbl_is_view,
|
||||
'db_is_system_schema' => $db_is_system_schema,
|
||||
'db_is_system_schema' => $isSystemSchema,
|
||||
'tbl_storage_engine' => $tbl_storage_engine,
|
||||
'table_collation' => $tableCollation,
|
||||
'is_innodb' => $is_innodb,
|
||||
|
||||
@ -6,7 +6,6 @@ namespace PhpMyAdmin\Controllers\Table;
|
||||
|
||||
use PhpMyAdmin\DbTableExists;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Query\Utilities;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Template;
|
||||
use PhpMyAdmin\Tracker;
|
||||
@ -43,7 +42,7 @@ final class TrackingController extends AbstractController
|
||||
|
||||
public function index(): void
|
||||
{
|
||||
global $text_dir, $url_params, $msg, $PMA_Theme, $db_is_system_schema, $err_url;
|
||||
global $text_dir, $url_params, $msg, $PMA_Theme, $err_url;
|
||||
global $data, $entries, $filter_ts_from, $filter_ts_to, $filter_users, $selection_schema;
|
||||
global $selection_data, $selection_both, $sql_result, $db, $table, $cfg;
|
||||
|
||||
@ -53,7 +52,6 @@ final class TrackingController extends AbstractController
|
||||
|
||||
Util::checkParameters(['db', 'table']);
|
||||
|
||||
$db_is_system_schema = Utilities::isSystemSchema($db);
|
||||
$url_params = ['db' => $db, 'table' => $table];
|
||||
$err_url = Util::getScriptNameForOption($cfg['DefaultTabTable'], 'table');
|
||||
$err_url .= Url::getCommon($url_params, '&');
|
||||
|
||||
@ -8,7 +8,6 @@ use PhpMyAdmin\Common;
|
||||
use PhpMyAdmin\Database\Triggers;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\DbTableExists;
|
||||
use PhpMyAdmin\Query\Utilities;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Template;
|
||||
use PhpMyAdmin\Url;
|
||||
@ -39,7 +38,7 @@ class TriggersController extends AbstractController
|
||||
public function index(): void
|
||||
{
|
||||
global $db, $table, $tables, $num_tables, $total_num_tables, $sub_part;
|
||||
global $db_is_system_schema, $tooltip_truename, $tooltip_aliasname, $pos;
|
||||
global $tooltip_truename, $tooltip_aliasname, $pos;
|
||||
global $errors, $url_params, $err_url, $cfg;
|
||||
|
||||
if (! $this->response->isAjax()) {
|
||||
@ -49,7 +48,6 @@ class TriggersController extends AbstractController
|
||||
if (! empty($table) && in_array($table, $this->dbi->getTables($db))) {
|
||||
Util::checkParameters(['db', 'table']);
|
||||
|
||||
$db_is_system_schema = Utilities::isSystemSchema($db);
|
||||
$url_params = ['db' => $db, 'table' => $table];
|
||||
$err_url = Util::getScriptNameForOption($cfg['DefaultTabTable'], 'table');
|
||||
$err_url .= Url::getCommon($url_params, '&');
|
||||
@ -63,8 +61,7 @@ class TriggersController extends AbstractController
|
||||
$tables,
|
||||
$num_tables,
|
||||
$total_num_tables,
|
||||
$sub_part,,
|
||||
$db_is_system_schema,
|
||||
$sub_part,,,
|
||||
$tooltip_truename,
|
||||
$tooltip_aliasname,
|
||||
$pos,
|
||||
|
||||
@ -7,7 +7,6 @@ namespace PhpMyAdmin\Controllers\Table;
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\DbTableExists;
|
||||
use PhpMyAdmin\Query\Utilities;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Table\Search;
|
||||
@ -92,11 +91,10 @@ class ZoomSearchController extends AbstractController
|
||||
|
||||
public function index(): void
|
||||
{
|
||||
global $goto, $db, $table, $db_is_system_schema, $url_params, $cfg, $err_url;
|
||||
global $goto, $db, $table, $url_params, $cfg, $err_url;
|
||||
|
||||
Util::checkParameters(['db', 'table']);
|
||||
|
||||
$db_is_system_schema = Utilities::isSystemSchema($db);
|
||||
$url_params = ['db' => $db, 'table' => $table];
|
||||
$err_url = Util::getScriptNameForOption($cfg['DefaultTabTable'], 'table');
|
||||
$err_url .= Url::getCommon($url_params, '&');
|
||||
|
||||
@ -9,7 +9,6 @@ use PhpMyAdmin\DbTableExists;
|
||||
use PhpMyAdmin\Html\Generator;
|
||||
use PhpMyAdmin\Message;
|
||||
use PhpMyAdmin\Operations;
|
||||
use PhpMyAdmin\Query\Utilities;
|
||||
use PhpMyAdmin\Response;
|
||||
use PhpMyAdmin\Template;
|
||||
use PhpMyAdmin\Url;
|
||||
@ -40,7 +39,7 @@ class ViewOperationsController extends AbstractController
|
||||
public function index(): void
|
||||
{
|
||||
global $sql_query, $url_params, $reload, $result, $warning_messages;
|
||||
global $db, $table, $db_is_system_schema, $cfg, $err_url;
|
||||
global $db, $table, $cfg, $err_url;
|
||||
|
||||
$tableObject = $this->dbi->getTable($db, $table);
|
||||
|
||||
@ -48,7 +47,6 @@ class ViewOperationsController extends AbstractController
|
||||
|
||||
Util::checkParameters(['db', 'table']);
|
||||
|
||||
$db_is_system_schema = Utilities::isSystemSchema($db);
|
||||
$url_params = ['db' => $db, 'table' => $table];
|
||||
$err_url = Util::getScriptNameForOption($cfg['DefaultTabTable'], 'table');
|
||||
$err_url .= Url::getCommon($url_params, '&');
|
||||
|
||||
@ -255,7 +255,7 @@ class Menu
|
||||
/** @var DatabaseInterface $dbi */
|
||||
global $route, $dbi;
|
||||
|
||||
$db_is_system_schema = Utilities::isSystemSchema($this->db);
|
||||
$isSystemSchema = Utilities::isSystemSchema($this->db);
|
||||
$tbl_is_view = $dbi->getTable($this->db, $this->table)
|
||||
->isView();
|
||||
$updatable_view = false;
|
||||
@ -296,7 +296,7 @@ class Menu
|
||||
'/table/zoom-search',
|
||||
]);
|
||||
|
||||
if (! $db_is_system_schema && (! $tbl_is_view || $updatable_view)) {
|
||||
if (! $isSystemSchema && (! $tbl_is_view || $updatable_view)) {
|
||||
$tabs['insert']['icon'] = 'b_insrow';
|
||||
$tabs['insert']['route'] = '/table/change';
|
||||
$tabs['insert']['text'] = __('Insert');
|
||||
@ -312,14 +312,14 @@ class Menu
|
||||
/**
|
||||
* Don't display "Import" for views and information_schema
|
||||
*/
|
||||
if (! $tbl_is_view && ! $db_is_system_schema) {
|
||||
if (! $tbl_is_view && ! $isSystemSchema) {
|
||||
$tabs['import']['icon'] = 'b_tblimport';
|
||||
$tabs['import']['route'] = '/table/import';
|
||||
$tabs['import']['text'] = __('Import');
|
||||
$tabs['import']['active'] = $route === '/table/import';
|
||||
}
|
||||
if (($is_superuser || $isCreateOrGrantUser)
|
||||
&& ! $db_is_system_schema
|
||||
&& ! $isSystemSchema
|
||||
) {
|
||||
$tabs['privileges']['route'] = '/server/privileges';
|
||||
$tabs['privileges']['args']['checkprivsdb'] = $this->db;
|
||||
@ -333,7 +333,7 @@ class Menu
|
||||
/**
|
||||
* Don't display "Operations" for views and information_schema
|
||||
*/
|
||||
if (! $tbl_is_view && ! $db_is_system_schema) {
|
||||
if (! $tbl_is_view && ! $isSystemSchema) {
|
||||
$tabs['operation']['icon'] = 'b_tblops';
|
||||
$tabs['operation']['route'] = '/table/operations';
|
||||
$tabs['operation']['text'] = __('Operations');
|
||||
@ -342,20 +342,20 @@ class Menu
|
||||
/**
|
||||
* Views support a limited number of operations
|
||||
*/
|
||||
if ($tbl_is_view && ! $db_is_system_schema) {
|
||||
if ($tbl_is_view && ! $isSystemSchema) {
|
||||
$tabs['operation']['icon'] = 'b_tblops';
|
||||
$tabs['operation']['route'] = '/view/operations';
|
||||
$tabs['operation']['text'] = __('Operations');
|
||||
$tabs['operation']['active'] = $route === '/view/operations';
|
||||
}
|
||||
|
||||
if (Tracker::isActive() && ! $db_is_system_schema) {
|
||||
if (Tracker::isActive() && ! $isSystemSchema) {
|
||||
$tabs['tracking']['icon'] = 'eye';
|
||||
$tabs['tracking']['text'] = __('Tracking');
|
||||
$tabs['tracking']['route'] = '/table/tracking';
|
||||
$tabs['tracking']['active'] = $route === '/table/tracking';
|
||||
}
|
||||
if (! $db_is_system_schema
|
||||
if (! $isSystemSchema
|
||||
&& Util::currentUserHasPrivilege(
|
||||
'TRIGGER',
|
||||
$this->db,
|
||||
@ -382,7 +382,7 @@ class Menu
|
||||
/** @var DatabaseInterface $dbi */
|
||||
global $route, $dbi;
|
||||
|
||||
$db_is_system_schema = Utilities::isSystemSchema($this->db);
|
||||
$isSystemSchema = Utilities::isSystemSchema($this->db);
|
||||
$num_tables = count($dbi->getTables($this->db));
|
||||
$is_superuser = $dbi->isSuperUser();
|
||||
$isCreateOrGrantUser = $dbi->isGrantUser() || $dbi->isCreateUser();
|
||||
@ -428,7 +428,7 @@ class Menu
|
||||
$tabs['export']['warning'] = __('Database seems to be empty!');
|
||||
}
|
||||
|
||||
if (! $db_is_system_schema) {
|
||||
if (! $isSystemSchema) {
|
||||
$tabs['import']['route'] = '/database/import';
|
||||
$tabs['import']['text'] = __('Import');
|
||||
$tabs['import']['icon'] = 'b_import';
|
||||
@ -469,21 +469,21 @@ class Menu
|
||||
}
|
||||
}
|
||||
|
||||
if (Tracker::isActive() && ! $db_is_system_schema) {
|
||||
if (Tracker::isActive() && ! $isSystemSchema) {
|
||||
$tabs['tracking']['text'] = __('Tracking');
|
||||
$tabs['tracking']['icon'] = 'eye';
|
||||
$tabs['tracking']['route'] = '/database/tracking';
|
||||
$tabs['tracking']['active'] = $route === '/database/tracking';
|
||||
}
|
||||
|
||||
if (! $db_is_system_schema) {
|
||||
if (! $isSystemSchema) {
|
||||
$tabs['designer']['text'] = __('Designer');
|
||||
$tabs['designer']['icon'] = 'b_relations';
|
||||
$tabs['designer']['route'] = '/database/designer';
|
||||
$tabs['designer']['active'] = $route === '/database/designer';
|
||||
}
|
||||
|
||||
if (! $db_is_system_schema
|
||||
if (! $isSystemSchema
|
||||
&& $cfgRelation['centralcolumnswork']
|
||||
) {
|
||||
$tabs['central_columns']['text'] = __('Central columns');
|
||||
|
||||
@ -2669,11 +2669,11 @@ class Util
|
||||
/**
|
||||
* whether selected db is information_schema
|
||||
*/
|
||||
$db_is_system_schema = false;
|
||||
$isSystemSchema = false;
|
||||
|
||||
if (Utilities::isSystemSchema($db)) {
|
||||
$isShowStats = false;
|
||||
$db_is_system_schema = true;
|
||||
$isSystemSchema = true;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2802,7 +2802,7 @@ class Util
|
||||
$total_num_tables,
|
||||
$sub_part,
|
||||
$isShowStats,
|
||||
$db_is_system_schema,
|
||||
$isSystemSchema,
|
||||
$tooltip_truename,
|
||||
$tooltip_aliasname,
|
||||
$pos,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user