Use single-line arrays when possible

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
Maurício Meneghini Fauth 2023-03-27 17:39:17 -03:00
parent 52c14a1911
commit dd885dc7b8
No known key found for this signature in database
GPG Key ID: 6A16FD38AFC89CC8
365 changed files with 2704 additions and 14452 deletions

View File

@ -9,12 +9,7 @@
declare(strict_types=1);
$i = 0;
$hosts = [
'foo.example.com',
'bar.example.com',
'baz.example.com',
'quux.example.com',
];
$hosts = ['foo.example.com', 'bar.example.com', 'baz.example.com', 'quux.example.com'];
foreach ($hosts as $host) {
$i++;

View File

@ -24,12 +24,7 @@ $secureCookie = false;
/**
* Map of authenticated users to MySQL user/password pairs.
*/
$authMap = [
'https://launchpad.net/~username' => [
'user' => 'root',
'password' => '',
],
];
$authMap = ['https://launchpad.net/~username' => ['user' => 'root', 'password' => '']];
// phpcs:disable PSR1.Files.SideEffects,Squiz.Functions.GlobalFunction

View File

@ -24,15 +24,9 @@ function get_login_credentials($user): array
{
/* Optionally we can use passed username */
if (! empty($user)) {
return [
$user,
'password',
];
return [$user, 'password'];
}
/* Here we would retrieve the credentials */
return [
'root',
'',
];
return ['root', ''];
}

View File

@ -44,12 +44,7 @@ class Advisor
private array $rules = [];
/** @var array{fired:array, notfired:array, unchecked:array, errors:array} */
private array $runResult = [
'fired' => [],
'notfired' => [],
'unchecked' => [],
'errors' => [],
];
private array $runResult = ['fired' => [], 'notfired' => [], 'unchecked' => [], 'errors' => []];
public function __construct(private DatabaseInterface $dbi, private ExpressionLanguage $expression)
{
@ -191,12 +186,7 @@ class Advisor
*/
private function runRules(): void
{
$this->runResult = [
'fired' => [],
'notfired' => [],
'unchecked' => [],
'errors' => [],
];
$this->runResult = ['fired' => [], 'notfired' => [], 'unchecked' => [], 'errors' => []];
foreach ($this->rules as $rule) {
$this->variables['value'] = 0;

View File

@ -71,10 +71,7 @@ class BrowseForeigners
// key names and descriptions for the left section,
// sorted by key names
$leftKeyname = $keys[$indexByKeyname];
[
$leftDescription,
$leftDescriptionTitle,
] = $this->getDescriptionAndTitle($descriptions[$indexByKeyname]);
[$leftDescription, $leftDescriptionTitle] = $this->getDescriptionAndTitle($descriptions[$indexByKeyname]);
// key names and descriptions for the right section,
// sorted by descriptions
@ -129,11 +126,7 @@ class BrowseForeigners
$output .= '</tr>';
return [
$output,
$horizontalCount,
$indexByDescription,
];
return [$output, $horizontalCount, $indexByDescription];
}
/**
@ -230,11 +223,7 @@ class BrowseForeigners
$indexByDescription = 0;
foreach (array_keys($keys) as $indexByKeyname) {
[
$html,
$horizontalCount,
$indexByDescription,
] = $this->getHtmlForOneKey(
[$html, $horizontalCount, $indexByDescription] = $this->getHtmlForOneKey(
$horizontalCount,
$header,
$keys,
@ -267,10 +256,7 @@ class BrowseForeigners
$description = mb_substr($description, 0, $this->settings->limitChars) . '...';
}
return [
$description,
$descriptionTitle,
];
return [$description, $descriptionTitle];
}
/**

View File

@ -167,10 +167,7 @@ class Charsets
if (self::$serverCharset === null) {// Fallback in case nothing is found
return Charset::fromServer(
[
'Charset' => __('Unknown'),
'Description' => __('Unknown'),
],
['Charset' => __('Unknown'), 'Description' => __('Unknown')],
);
}

View File

@ -65,11 +65,7 @@ class CheckUserPrivileges
);
$showGrantsTableName = Util::unQuote($showGrantsTableName, '`');
return [
$showGrantsString,
$showGrantsDbName,
$showGrantsTableName,
];
return [$showGrantsString, $showGrantsDbName, $showGrantsTableName];
}
/**
@ -190,11 +186,7 @@ class CheckUserPrivileges
$re1 = '(^|[^\\\\])(\\\)+'; // escaped wildcards
while ($row = $showGrantsResult->fetchRow()) {
[
$showGrantsString,
$showGrantsDbName,
$showGrantsTableName,
] = $this->getItemsFromShowGrantsRow($row[0]);
[$showGrantsString, $showGrantsDbName, $showGrantsTableName] = $this->getItemsFromShowGrantsRow($row[0]);
if ($showGrantsDbName === '*') {
if ($showGrantsString !== 'USAGE') {

View File

@ -1077,11 +1077,7 @@ class Config
{
// First try configured temp dir
// Fallback to PHP upload_tmp_dir
$dirs = [
$this->getTempDir('upload'),
ini_get('upload_tmp_dir'),
sys_get_temp_dir(),
];
$dirs = [$this->getTempDir('upload'), ini_get('upload_tmp_dir'), sys_get_temp_dir()];
foreach ($dirs as $dir) {
if (! empty($dir) && @is_writable($dir)) {
@ -1262,11 +1258,7 @@ class Config
}
} else {
if ($server === null) {
return [
null,
null,
null,
];
return [null, null, null];
}
if (isset($server['user'])) {
@ -1301,11 +1293,7 @@ class Config
$server['hide_connection_errors'] = false;
}
return [
$user,
$password,
$server,
];
return [$user, $password, $server];
}
/**

View File

@ -501,40 +501,15 @@ class ConfigFile
'Servers' => [
1 => [
'port' => 'integer',
'auth_type' => [
'config',
'http',
'signon',
'cookie',
],
'AllowDeny' => [
'order' => [
'',
'deny,allow',
'allow,deny',
'explicit',
],
],
'auth_type' => ['config', 'http', 'signon', 'cookie'],
'AllowDeny' => ['order' => ['', 'deny,allow', 'allow,deny', 'explicit']],
'only_db' => 'array',
],
],
'RecodingEngine' => [
'auto',
'iconv',
'recode',
'mb',
'none',
],
'OBGzip' => [
'auto',
true,
false,
],
'RecodingEngine' => ['auto', 'iconv', 'recode', 'mb', 'none'],
'OBGzip' => ['auto', true, false],
'MemoryLimit' => 'short_string',
'NavigationLogoLinkWindow' => [
'main',
'new',
],
'NavigationLogoLinkWindow' => ['main', 'new'],
'NavigationTreeDefaultTabTable' => [
// fields list
'structure' => __('Structure'),
@ -564,49 +539,19 @@ class ConfigFile
'NavigationTreeDbSeparator' => 'short_string',
'NavigationTreeTableSeparator' => 'short_string',
'NavigationWidth' => 'integer',
'TableNavigationLinksMode' => [
'icons' => __('Icons'),
'text' => __('Text'),
'both' => __('Both'),
],
'MaxRows' => [
25,
50,
100,
250,
500,
],
'Order' => [
'ASC',
'DESC',
'SMART',
],
'TableNavigationLinksMode' => ['icons' => __('Icons'), 'text' => __('Text'), 'both' => __('Both')],
'MaxRows' => [25, 50, 100, 250, 500],
'Order' => ['ASC', 'DESC', 'SMART'],
'RowActionLinks' => [
'none' => __('Nowhere'),
'left' => __('Left'),
'right' => __('Right'),
'both' => __('Both'),
],
'TablePrimaryKeyOrder' => [
'NONE' => __('None'),
'ASC' => __('Ascending'),
'DESC' => __('Descending'),
],
'ProtectBinary' => [
false,
'blob',
'noblob',
'all',
],
'CharEditing' => [
'input',
'textarea',
],
'TabsMode' => [
'icons' => __('Icons'),
'text' => __('Text'),
'both' => __('Both'),
],
'TablePrimaryKeyOrder' => ['NONE' => __('None'), 'ASC' => __('Ascending'), 'DESC' => __('Descending')],
'ProtectBinary' => [false, 'blob', 'noblob', 'all'],
'CharEditing' => ['input', 'textarea'],
'TabsMode' => ['icons' => __('Icons'), 'text' => __('Text'), 'both' => __('Both')],
'PDFDefaultPageSize' => [
'A3' => 'A3',
'A4' => 'A4',
@ -614,20 +559,13 @@ class ConfigFile
'letter' => 'letter',
'legal' => 'legal',
],
'ActionLinksMode' => [
'icons' => __('Icons'),
'text' => __('Text'),
'both' => __('Both'),
],
'ActionLinksMode' => ['icons' => __('Icons'), 'text' => __('Text'), 'both' => __('Both')],
'GridEditing' => [
'click' => __('Click'),
'double-click' => __('Double click'),
'disabled' => __('Disabled'),
],
'RelationalDisplay' => [
'K' => __('key'),
'D' => __('display column'),
],
'RelationalDisplay' => ['K' => __('key'), 'D' => __('display column')],
'DefaultTabServer' => [
// the welcome page (recommended for multiuser setups)
'welcome' => __('Welcome'),
@ -662,11 +600,7 @@ class ConfigFile
// browse page
'browse' => __('Browse'),
],
'InitialSlidersState' => [
'open' => __('Open'),
'closed' => __('Closed'),
'disabled' => __('Disabled'),
],
'InitialSlidersState' => ['open' => __('Open'), 'closed' => __('Closed'), 'disabled' => __('Disabled')],
'FirstDayOfCalendar' => [
'1' => _pgettext('Week day name', 'Monday'),
'2' => _pgettext('Week day name', 'Tuesday'),
@ -719,11 +653,7 @@ class ConfigFile
'ldi_terminated' => 'short_string',
'ldi_enclosed' => 'short_string',
'ldi_escaped' => 'short_string',
'ldi_local_option' => [
'auto',
true,
false,
],
'ldi_local_option' => ['auto', true, false],
],
'Export' => [
@ -752,11 +682,7 @@ class ConfigFile
'xml',
'yaml',
],
'compression' => [
'none',
'zip',
'gzip',
],
'compression' => ['none', 'zip', 'gzip'],
'charset' => array_merge([''], $GLOBALS['cfg']['AvailableCharsets'] ?? []),
'sql_compatibility' => [
'NONE',
@ -772,11 +698,7 @@ class ConfigFile
//'POSTGRESQL',
'TRADITIONAL',
],
'codegen_format' => [
'#',
'NHibernate C# DO',
'NHibernate XML',
],
'codegen_format' => ['#', 'NHibernate C# DO', 'NHibernate XML'],
'csv_separator' => 'short_string',
'csv_terminated' => 'short_string',
'csv_enclosed' => 'short_string',
@ -793,11 +715,7 @@ class ConfigFile
'data' => __('data'),
'structure_and_data' => __('structure and data'),
],
'sql_type' => [
'INSERT',
'UPDATE',
'REPLACE',
],
'sql_type' => ['INSERT', 'UPDATE', 'REPLACE'],
'sql_insert_syntax' => [
'complete' => __('complete inserts'),
'extended' => __('extended inserts'),
@ -826,20 +744,9 @@ class ConfigFile
],
'Console' => [
'Mode' => [
'info',
'show',
'collapse',
],
'OrderBy' => [
'exec',
'time',
'count',
],
'Order' => [
'asc',
'desc',
],
'Mode' => ['info', 'show', 'collapse'],
'OrderBy' => ['exec', 'time', 'count'],
'Order' => ['asc', 'desc'],
],
/**
@ -855,42 +762,12 @@ class ConfigFile
'Export/sql_max_query_size' => 'validatePositiveNumber',
'FirstLevelNavigationItems' => 'validatePositiveNumber',
'ForeignKeyMaxLimit' => 'validatePositiveNumber',
'Import/csv_enclosed' => [
[
'validateByRegex',
'/^.?$/',
],
],
'Import/csv_escaped' => [
[
'validateByRegex',
'/^.$/',
],
],
'Import/csv_terminated' => [
[
'validateByRegex',
'/^.$/',
],
],
'Import/ldi_enclosed' => [
[
'validateByRegex',
'/^.?$/',
],
],
'Import/ldi_escaped' => [
[
'validateByRegex',
'/^.$/',
],
],
'Import/ldi_terminated' => [
[
'validateByRegex',
'/^.$/',
],
],
'Import/csv_enclosed' => [['validateByRegex', '/^.?$/']],
'Import/csv_escaped' => [['validateByRegex', '/^.$/']],
'Import/csv_terminated' => [['validateByRegex', '/^.$/']],
'Import/ldi_enclosed' => [['validateByRegex', '/^.?$/']],
'Import/ldi_escaped' => [['validateByRegex', '/^.$/']],
'Import/ldi_terminated' => [['validateByRegex', '/^.$/']],
'Import/skip_queries' => 'validateNonNegativeNumber',
'InsertRows' => 'validatePositiveNumber',
'NumRecentTables' => 'validateNonNegativeNumber',
@ -905,12 +782,7 @@ class ConfigFile
'MaxSizeForInputField' => 'validatePositiveNumber',
'MinSizeForInputField' => 'validateNonNegativeNumber',
'MaxTableList' => 'validatePositiveNumber',
'MemoryLimit' => [
[
'validateByRegex',
'/^(-1|(\d+(?:[kmg])?))$/i',
],
],
'MemoryLimit' => [['validateByRegex', '/^(-1|(\d+(?:[kmg])?))$/i']],
'NavigationTreeDisplayItemFilterMinimum' => 'validatePositiveNumber',
'NavigationTreeTableLevel' => 'validatePositiveNumber',
'NavigationWidth' => 'validateNonNegativeNumber',
@ -929,24 +801,9 @@ class ConfigFile
* Additional validators used for user preferences
*/
'_userValidators' => [
'MaxDbList' => [
[
'validateUpperBound',
'value:MaxDbList',
],
],
'MaxTableList' => [
[
'validateUpperBound',
'value:MaxTableList',
],
],
'QueryHistoryMax' => [
[
'validateUpperBound',
'value:QueryHistoryMax',
],
],
'MaxDbList' => [['validateUpperBound', 'value:MaxDbList']],
'MaxTableList' => [['validateUpperBound', 'value:MaxTableList']],
'QueryHistoryMax' => [['validateUpperBound', 'value:QueryHistoryMax']],
],
];
}

View File

@ -27,14 +27,8 @@ class Descriptions
public static function get(string $path, string $type = 'name'): string
{
$key = str_replace(
[
'Servers/1/',
'/',
],
[
'Servers/',
'_',
],
['Servers/1/', '/'],
['Servers/', '_'],
$path,
);
$value = self::getString($key, $type);

View File

@ -796,18 +796,9 @@ class FormDisplay
if ($systemPath === 'ZipDump' || $systemPath === 'GZipDump' || $systemPath === 'BZipDump') {
$comment = '';
$funcs = [
'ZipDump' => [
'zip_open',
'gzcompress',
],
'GZipDump' => [
'gzopen',
'gzencode',
],
'BZipDump' => [
'bzopen',
'bzcompress',
],
'ZipDump' => ['zip_open', 'gzcompress'],
'GZipDump' => ['gzopen', 'gzencode'],
'BZipDump' => ['bzopen', 'bzcompress'],
];
if (! function_exists($funcs[$systemPath][0])) {
$comment = sprintf(

View File

@ -152,10 +152,7 @@ class FormDisplayTemplate
*/
public function displayErrors(string $name, array $errorList): string
{
return $this->template->render('config/form_display/errors', [
'name' => $name,
'error_list' => $errorList,
]);
return $this->template->render('config/form_display/errors', ['name' => $name, 'error_list' => $errorList]);
}
public function display(array $data): string

View File

@ -15,8 +15,6 @@ class BrowseForm extends BaseForm
/** @return array */
public static function getForms(): array
{
return [
'Browse' => MainForm::getForms()['Browse'],
];
return ['Browse' => MainForm::getForms()['Browse']];
}
}

View File

@ -15,8 +15,6 @@ class DbStructureForm extends BaseForm
/** @return array */
public static function getForms(): array
{
return [
'DbStructure' => MainForm::getForms()['DbStructure'],
];
return ['DbStructure' => MainForm::getForms()['DbStructure']];
}
}

View File

@ -16,9 +16,6 @@ class EditForm extends BaseForm
/** @return array */
public static function getForms(): array
{
return [
'Edit' => MainForm::getForms()['Edit'],
'Text_fields' => FeaturesForm::getForms()['Text_fields'],
];
return ['Edit' => MainForm::getForms()['Edit'], 'Text_fields' => FeaturesForm::getForms()['Text_fields']];
}
}

View File

@ -15,8 +15,6 @@ class TableStructureForm extends BaseForm
/** @return array */
public static function getForms(): array
{
return [
'TableStructure' => MainForm::getForms()['TableStructure'],
];
return ['TableStructure' => MainForm::getForms()['TableStructure']];
}
}

View File

@ -14,11 +14,6 @@ class ConfigForm extends BaseForm
/** @return array */
public static function getForms(): array
{
return [
'Config' => [
'DefaultLang',
'ServerDefault',
],
];
return ['Config' => ['DefaultLang', 'ServerDefault']];
}
}

View File

@ -19,10 +19,7 @@ class FeaturesForm extends \PhpMyAdmin\Config\Forms\User\FeaturesForm
/* Remove only_db/hide_db, we have proper Server form in setup */
$result['Databases'] = array_diff(
$result['Databases'],
[
'Servers/1/only_db',
'Servers/1/hide_db',
],
['Servers/1/only_db', 'Servers/1/hide_db'],
);
/* Following are not available to user */
$result['Import_export'] = [
@ -50,10 +47,7 @@ class FeaturesForm extends \PhpMyAdmin\Config\Forms\User\FeaturesForm
'CaptchaLoginPrivateKey',
'CaptchaSiteVerifyURL',
];
$result['Developer'] = [
'UserprefsDeveloperTab',
'DBG/sql',
];
$result['Developer'] = ['UserprefsDeveloperTab', 'DBG/sql'];
$result['Other_core_settings'] = [
'OBGzip',
'PersistentConnections',

View File

@ -18,18 +18,7 @@ class ServersForm extends BaseForm
{
// phpcs:disable Squiz.Arrays.ArrayDeclaration.KeySpecified,Squiz.Arrays.ArrayDeclaration.NoKeySpecified
return [
'Server' => [
'Servers' => [
1 => [
'verbose',
'host',
'port',
'socket',
'ssl',
'compress',
],
],
],
'Server' => ['Servers' => [1 => ['verbose', 'host', 'port', 'socket', 'ssl', 'compress']]],
'Server_auth' => [
'Servers' => [
1 => [

View File

@ -47,12 +47,7 @@ class FeaturesForm extends BaseForm
'TextareaRows',
'LongtextDoubleTextarea',
],
'Page_titles' => [
'TitleDefault',
'TitleTable',
'TitleDatabase',
'TitleServer',
],
'Page_titles' => ['TitleDefault', 'TitleTable', 'TitleDatabase', 'TitleServer'],
'Warnings' => [
'PmaNoRelation_DisableWarning',
'SuhosinDisableWarning',

View File

@ -24,11 +24,7 @@ class ImportForm extends BaseForm
'Import/skip_queries',
'enable_drag_drop_import',
],
'Sql' => [
'Import/sql_compatibility',
'Import/sql_no_auto_value_on_zero',
'Import/sql_read_as_multibytes',
],
'Sql' => ['Import/sql_compatibility', 'Import/sql_no_auto_value_on_zero', 'Import/sql_read_as_multibytes'],
'Csv' => [
':group:' . __('CSV'),
'Import/csv_replace',

View File

@ -17,11 +17,7 @@ class MainForm extends BaseForm
public static function getForms(): array
{
return [
'Startup' => [
'ShowCreateDb',
'ShowStats',
'ShowServerInfo',
],
'Startup' => ['ShowCreateDb', 'ShowStats', 'ShowServerInfo'],
'DbStructure' => [
'ShowDbStructureCharset',
'ShowDbStructureComment',
@ -70,12 +66,7 @@ class MainForm extends BaseForm
'ForeignKeyDropdownOrder',
'ForeignKeyMaxLimit',
],
'Tabs' => [
'TabsMode',
'DefaultTabServer',
'DefaultTabDatabase',
'DefaultTabTable',
],
'Tabs' => ['TabsMode', 'DefaultTabServer', 'DefaultTabDatabase', 'DefaultTabTable'],
'DisplayRelationalSchema' => ['PDFDefaultPageSize'],
];
}

View File

@ -41,14 +41,8 @@ class NaviForm extends BaseForm
'NavigationTreeShowEvents',
'NavigationTreeAutoexpandSingleDb',
],
'Navi_servers' => [
'NavigationDisplayServers',
'DisplayServersList',
],
'Navi_databases' => [
'NavigationTreeDisplayDbFilterMinimum',
'NavigationTreeDbSeparator',
],
'Navi_servers' => ['NavigationDisplayServers', 'DisplayServersList'],
'Navi_databases' => ['NavigationTreeDisplayDbFilterMinimum', 'NavigationTreeDbSeparator'],
'Navi_tables' => [
'NavigationTreeDefaultTabTable',
'NavigationTreeDefaultTabTable2',

View File

@ -29,12 +29,7 @@ class SqlForm extends BaseForm
'EnableAutocompleteForTablesAndColumns',
'DefaultForeignKeyChecks',
],
'Sql_box' => [
'SQLQuery/Edit',
'SQLQuery/Explain',
'SQLQuery/ShowAsPHP',
'SQLQuery/Refresh',
],
'Sql_box' => ['SQLQuery/Edit', 'SQLQuery/Explain', 'SQLQuery/ShowAsPHP', 'SQLQuery/Refresh'],
];
}

View File

@ -72,35 +72,19 @@ class SpecialSchemaLinks
'columns_priv' => [
'user' => [
'link_param' => 'username',
'link_dependancy_params' => [
0 => [
'param_info' => 'hostname',
'column_name' => 'host',
],
],
'link_dependancy_params' => [0 => ['param_info' => 'hostname', 'column_name' => 'host']],
'default_page' => './' . Url::getFromRoute('/server/privileges'),
],
'table_name' => [
'link_param' => 'table',
'link_dependancy_params' => [
0 => [
'param_info' => 'db',
'column_name' => 'Db',
],
],
'link_dependancy_params' => [0 => ['param_info' => 'db', 'column_name' => 'Db']],
'default_page' => $defaultPageTable,
],
'column_name' => [
'link_param' => 'field',
'link_dependancy_params' => [
0 => [
'param_info' => 'db',
'column_name' => 'Db',
],
1 => [
'param_info' => 'table',
'column_name' => 'Table_name',
],
0 => ['param_info' => 'db', 'column_name' => 'Db'],
1 => ['param_info' => 'table', 'column_name' => 'Table_name'],
],
'default_page' => './' . Url::getFromRoute('/table/structure/change', ['change_column' => 1]),
],
@ -108,24 +92,14 @@ class SpecialSchemaLinks
'db' => [
'user' => [
'link_param' => 'username',
'link_dependancy_params' => [
0 => [
'param_info' => 'hostname',
'column_name' => 'host',
],
],
'link_dependancy_params' => [0 => ['param_info' => 'hostname', 'column_name' => 'host']],
'default_page' => './' . Url::getFromRoute('/server/privileges'),
],
],
'event' => [
'name' => [
'link_param' => 'item_name',
'link_dependancy_params' => [
0 => [
'param_info' => 'db',
'column_name' => 'db',
],
],
'link_dependancy_params' => [0 => ['param_info' => 'db', 'column_name' => 'db']],
'default_page' => './' . Url::getFromRoute('/database/events', ['edit_item' => 1]),
],
@ -133,25 +107,14 @@ class SpecialSchemaLinks
'innodb_index_stats' => [
'table_name' => [
'link_param' => 'table',
'link_dependancy_params' => [
0 => [
'param_info' => 'db',
'column_name' => 'database_name',
],
],
'link_dependancy_params' => [0 => ['param_info' => 'db', 'column_name' => 'database_name']],
'default_page' => $defaultPageTable,
],
'index_name' => [
'link_param' => 'index',
'link_dependancy_params' => [
0 => [
'param_info' => 'db',
'column_name' => 'database_name',
],
1 => [
'param_info' => 'table',
'column_name' => 'table_name',
],
0 => ['param_info' => 'db', 'column_name' => 'database_name'],
1 => ['param_info' => 'table', 'column_name' => 'table_name'],
],
'default_page' => './' . Url::getFromRoute('/table/structure'),
],
@ -159,12 +122,7 @@ class SpecialSchemaLinks
'innodb_table_stats' => [
'table_name' => [
'link_param' => 'table',
'link_dependancy_params' => [
0 => [
'param_info' => 'db',
'column_name' => 'database_name',
],
],
'link_dependancy_params' => [0 => ['param_info' => 'db', 'column_name' => 'database_name']],
'default_page' => $defaultPageTable,
],
],
@ -172,28 +130,16 @@ class SpecialSchemaLinks
'name' => [
'link_param' => 'item_name',
'link_dependancy_params' => [
0 => [
'param_info' => 'db',
'column_name' => 'db',
],
1 => [
'param_info' => 'item_type',
'column_name' => 'type',
],
0 => ['param_info' => 'db', 'column_name' => 'db'],
1 => ['param_info' => 'item_type', 'column_name' => 'type'],
],
'default_page' => './' . Url::getFromRoute('/database/routines', ['edit_item' => 1]),
],
'specific_name' => [
'link_param' => 'item_name',
'link_dependancy_params' => [
0 => [
'param_info' => 'db',
'column_name' => 'db',
],
1 => [
'param_info' => 'item_type',
'column_name' => 'type',
],
0 => ['param_info' => 'db', 'column_name' => 'db'],
1 => ['param_info' => 'item_type', 'column_name' => 'type'],
],
'default_page' => './' . Url::getFromRoute('/database/routines', ['edit_item' => 1]),
],
@ -201,25 +147,14 @@ class SpecialSchemaLinks
'proc_priv' => [
'user' => [
'link_param' => 'username',
'link_dependancy_params' => [
0 => [
'param_info' => 'hostname',
'column_name' => 'Host',
],
],
'link_dependancy_params' => [0 => ['param_info' => 'hostname', 'column_name' => 'Host']],
'default_page' => './' . Url::getFromRoute('/server/privileges'),
],
'routine_name' => [
'link_param' => 'item_name',
'link_dependancy_params' => [
0 => [
'param_info' => 'db',
'column_name' => 'Db',
],
1 => [
'param_info' => 'item_type',
'column_name' => 'Routine_type',
],
0 => ['param_info' => 'db', 'column_name' => 'Db'],
1 => ['param_info' => 'item_type', 'column_name' => 'Routine_type'],
],
'default_page' => './' . Url::getFromRoute('/database/routines', ['edit_item' => 1]),
],
@ -227,46 +162,26 @@ class SpecialSchemaLinks
'proxies_priv' => [
'user' => [
'link_param' => 'username',
'link_dependancy_params' => [
0 => [
'param_info' => 'hostname',
'column_name' => 'Host',
],
],
'link_dependancy_params' => [0 => ['param_info' => 'hostname', 'column_name' => 'Host']],
'default_page' => './' . Url::getFromRoute('/server/privileges'),
],
],
'tables_priv' => [
'user' => [
'link_param' => 'username',
'link_dependancy_params' => [
0 => [
'param_info' => 'hostname',
'column_name' => 'Host',
],
],
'link_dependancy_params' => [0 => ['param_info' => 'hostname', 'column_name' => 'Host']],
'default_page' => './' . Url::getFromRoute('/server/privileges'),
],
'table_name' => [
'link_param' => 'table',
'link_dependancy_params' => [
0 => [
'param_info' => 'db',
'column_name' => 'Db',
],
],
'link_dependancy_params' => [0 => ['param_info' => 'db', 'column_name' => 'Db']],
'default_page' => $defaultPageTable,
],
],
'user' => [
'user' => [
'link_param' => 'username',
'link_dependancy_params' => [
0 => [
'param_info' => 'hostname',
'column_name' => 'host',
],
],
'link_dependancy_params' => [0 => ['param_info' => 'hostname', 'column_name' => 'host']],
'default_page' => './' . Url::getFromRoute('/server/privileges'),
],
],
@ -275,25 +190,14 @@ class SpecialSchemaLinks
'columns' => [
'table_name' => [
'link_param' => 'table',
'link_dependancy_params' => [
0 => [
'param_info' => 'db',
'column_name' => 'table_schema',
],
],
'link_dependancy_params' => [0 => ['param_info' => 'db', 'column_name' => 'table_schema']],
'default_page' => $defaultPageTable,
],
'column_name' => [
'link_param' => 'field',
'link_dependancy_params' => [
0 => [
'param_info' => 'db',
'column_name' => 'table_schema',
],
1 => [
'param_info' => 'table',
'column_name' => 'table_name',
],
0 => ['param_info' => 'db', 'column_name' => 'table_schema'],
1 => ['param_info' => 'table', 'column_name' => 'table_name'],
],
'default_page' => './' . Url::getFromRoute('/table/structure/change', ['change_column' => 1]),
],
@ -301,49 +205,29 @@ class SpecialSchemaLinks
'key_column_usage' => [
'table_name' => [
'link_param' => 'table',
'link_dependancy_params' => [
0 => [
'param_info' => 'db',
'column_name' => 'constraint_schema',
],
],
'link_dependancy_params' => [0 => ['param_info' => 'db','column_name' => 'constraint_schema']],
'default_page' => $defaultPageTable,
],
'column_name' => [
'link_param' => 'field',
'link_dependancy_params' => [
0 => [
'param_info' => 'db',
'column_name' => 'table_schema',
],
1 => [
'param_info' => 'table',
'column_name' => 'table_name',
],
0 => ['param_info' => 'db', 'column_name' => 'table_schema'],
1 => ['param_info' => 'table', 'column_name' => 'table_name'],
],
'default_page' => './' . Url::getFromRoute('/table/structure/change', ['change_column' => 1]),
],
'referenced_table_name' => [
'link_param' => 'table',
'link_dependancy_params' => [
0 => [
'param_info' => 'db',
'column_name' => 'referenced_table_schema',
],
0 => ['param_info' => 'db', 'column_name' => 'referenced_table_schema'],
],
'default_page' => $defaultPageTable,
],
'referenced_column_name' => [
'link_param' => 'field',
'link_dependancy_params' => [
0 => [
'param_info' => 'db',
'column_name' => 'referenced_table_schema',
],
1 => [
'param_info' => 'table',
'column_name' => 'referenced_table_name',
],
0 => ['param_info' => 'db', 'column_name' => 'referenced_table_schema'],
1 => ['param_info' => 'table', 'column_name' => 'referenced_table_name'],
],
'default_page' => './' . Url::getFromRoute('/table/structure/change', ['change_column' => 1]),
],
@ -351,46 +235,26 @@ class SpecialSchemaLinks
'partitions' => [
'table_name' => [
'link_param' => 'table',
'link_dependancy_params' => [
0 => [
'param_info' => 'db',
'column_name' => 'table_schema',
],
],
'link_dependancy_params' => [0 => ['param_info' => 'db', 'column_name' => 'table_schema']],
'default_page' => $defaultPageTable,
],
],
'processlist' => [
'user' => [
'link_param' => 'username',
'link_dependancy_params' => [
0 => [
'param_info' => 'hostname',
'column_name' => 'host',
],
],
'link_dependancy_params' => [0 => ['param_info' => 'hostname', 'column_name' => 'host']],
'default_page' => './' . Url::getFromRoute('/server/privileges'),
],
],
'referential_constraints' => [
'table_name' => [
'link_param' => 'table',
'link_dependancy_params' => [
0 => [
'param_info' => 'db',
'column_name' => 'constraint_schema',
],
],
'link_dependancy_params' => [0 => ['param_info' => 'db','column_name' => 'constraint_schema']],
'default_page' => $defaultPageTable,
],
'referenced_table_name' => [
'link_param' => 'table',
'link_dependancy_params' => [
0 => [
'param_info' => 'db',
'column_name' => 'constraint_schema',
],
],
'link_dependancy_params' => [0 => ['param_info' => 'db','column_name' => 'constraint_schema']],
'default_page' => $defaultPageTable,
],
],
@ -398,46 +262,24 @@ class SpecialSchemaLinks
'routine_name' => [
'link_param' => 'item_name',
'link_dependancy_params' => [
0 => [
'param_info' => 'db',
'column_name' => 'routine_schema',
],
1 => [
'param_info' => 'item_type',
'column_name' => 'routine_type',
],
0 => ['param_info' => 'db', 'column_name' => 'routine_schema'],
1 => ['param_info' => 'item_type', 'column_name' => 'routine_type'],
],
'default_page' => './' . Url::getFromRoute('/database/routines'),
],
],
'schemata' => [
'schema_name' => [
'link_param' => 'db',
'default_page' => $defaultPageDatabase,
],
],
'schemata' => ['schema_name' => ['link_param' => 'db', 'default_page' => $defaultPageDatabase]],
'statistics' => [
'table_name' => [
'link_param' => 'table',
'link_dependancy_params' => [
0 => [
'param_info' => 'db',
'column_name' => 'table_schema',
],
],
'link_dependancy_params' => [0 => ['param_info' => 'db', 'column_name' => 'table_schema']],
'default_page' => $defaultPageTable,
],
'column_name' => [
'link_param' => 'field',
'link_dependancy_params' => [
0 => [
'param_info' => 'db',
'column_name' => 'table_schema',
],
1 => [
'param_info' => 'table',
'column_name' => 'table_name',
],
0 => ['param_info' => 'db', 'column_name' => 'table_schema'],
1 => ['param_info' => 'table', 'column_name' => 'table_name'],
],
'default_page' => './' . Url::getFromRoute('/table/structure/change', ['change_column' => 1]),
],
@ -445,36 +287,21 @@ class SpecialSchemaLinks
'tables' => [
'table_name' => [
'link_param' => 'table',
'link_dependancy_params' => [
0 => [
'param_info' => 'db',
'column_name' => 'table_schema',
],
],
'link_dependancy_params' => [0 => ['param_info' => 'db', 'column_name' => 'table_schema']],
'default_page' => $defaultPageTable,
],
],
'table_constraints' => [
'table_name' => [
'link_param' => 'table',
'link_dependancy_params' => [
0 => [
'param_info' => 'db',
'column_name' => 'table_schema',
],
],
'link_dependancy_params' => [0 => ['param_info' => 'db', 'column_name' => 'table_schema']],
'default_page' => $defaultPageTable,
],
],
'views' => [
'table_name' => [
'link_param' => 'table',
'link_dependancy_params' => [
0 => [
'param_info' => 'db',
'column_name' => 'table_schema',
],
],
'link_dependancy_params' => [0 => ['param_info' => 'db', 'column_name' => 'table_schema']],
'default_page' => $defaultPageTable,
],
],

View File

@ -225,15 +225,9 @@ class Relation
$workToTable = [
'relwork' => 'relation',
'displaywork' => [
'relation',
'table_info',
],
'displaywork' => ['relation', 'table_info'],
'bookmarkwork' => 'bookmarktable',
'pdfwork' => [
'table_coords',
'pdf_pages',
],
'pdfwork' => ['table_coords', 'pdf_pages'],
'commwork' => 'column_info',
'mimework' => 'column_info',
'historywork' => 'history',
@ -242,10 +236,7 @@ class Relation
'uiprefswork' => 'table_uiprefs',
'trackingwork' => 'tracking',
'userconfigwork' => 'userconfig',
'menuswork' => [
'users',
'usergroups',
],
'menuswork' => ['users', 'usergroups'],
'navwork' => 'navigationhiding',
'savedsearcheswork' => 'savedsearches',
'centralcolumnswork' => 'central_columns',
@ -347,10 +338,7 @@ class Relation
{
// From 4.3, new input oriented transformation feature was introduced.
// Check whether column_info table has input transformation columns
$newCols = [
'input_transformation',
'input_transformation_options',
];
$newCols = ['input_transformation', 'input_transformation_options'];
$query = 'SHOW COLUMNS FROM '
. Util::backquote($GLOBALS['cfg']['Server']['pmadb'])
. '.' . Util::backquote($GLOBALS['cfg']['Server']['column_info'])
@ -373,10 +361,7 @@ class Relation
// replace pma__column_info table name from query
// to with set in config.inc.php
$query = str_replace(
[
'`phpmyadmin`',
'`pma__column_info`',
],
['`phpmyadmin`', '`pma__column_info`'],
[
Util::backquote($GLOBALS['cfg']['Server']['pmadb']),
Util::backquote($GLOBALS['cfg']['Server']['column_info']),
@ -672,11 +657,7 @@ class Relation
$_SESSION['sql_history'] = [];
}
$_SESSION['sql_history'][] = [
'db' => $db,
'table' => $table,
'sqlquery' => $sqlquery,
];
$_SESSION['sql_history'][] = ['db' => $db, 'table' => $table, 'sqlquery' => $sqlquery];
if (count($_SESSION['sql_history']) > $GLOBALS['cfg']['QueryHistoryMax']) {
// history should not exceed a maximum count
@ -1365,10 +1346,7 @@ class Relation
return $this->dbi->fetchResult(
$relQuery,
[
'referenced_column_name',
null,
],
['referenced_column_name', null],
);
}
@ -1394,12 +1372,7 @@ class Relation
array|null $foreignersFull = null,
array|null $childReferencesFull = null,
): array {
$columnStatus = [
'isEditable' => true,
'isReferenced' => false,
'isForeignKey' => false,
'references' => [],
];
$columnStatus = ['isEditable' => true, 'isReferenced' => false, 'isForeignKey' => false, 'references' => []];
$foreigners = [];
if ($foreignersFull !== null) {
@ -1691,10 +1664,7 @@ class Relation
$haveRel = count($resRel) > 0;
}
return [
$resRel,
$haveRel,
];
return [$resRel, $haveRel];
}
/**

View File

@ -52,10 +52,7 @@ class UserGroups
if ($result) {
$i = 0;
while ($row = $result->fetchRow()) {
$users[] = [
'count' => ++$i,
'user' => $row[0],
];
$users[] = ['count' => ++$i, 'user' => $row[0]];
}
}
@ -102,20 +99,14 @@ class UserGroups
$userGroupVal['tableTab'] = self::getAllowedTabNames($tabs, 'table');
$userGroupVal['userGroupUrl'] = Url::getFromRoute('/server/user-groups');
$userGroupVal['viewUsersUrl'] = Url::getCommon(
[
'viewUsers' => 1,
'userGroup' => $groupName,
],
['viewUsers' => 1, 'userGroup' => $groupName],
'',
false,
);
$userGroupVal['viewUsersIcon'] = Generator::getIcon('b_usrlist', __('View users'));
$userGroupVal['editUsersUrl'] = Url::getCommon(
[
'editUserGroup' => 1,
'userGroup' => $groupName,
],
['editUserGroup' => 1, 'userGroup' => $groupName],
'',
false,
);
@ -210,11 +201,7 @@ class UserGroups
$urlParams['addUserGroupSubmit'] = '1';
}
$allowedTabs = [
'server' => [],
'db' => [],
'table' => [],
];
$allowedTabs = ['server' => [], 'db' => [], 'table' => []];
if ($userGroup !== null) {
$groupTable = Util::backquote($configurableMenusFeature->database)
. '.' . Util::backquote($configurableMenusFeature->userGroups);

View File

@ -56,10 +56,7 @@ final class ExportController extends AbstractController
$GLOBALS['urlParams']['goto'] = Url::getFromRoute('/database/export');
[
$GLOBALS['tables'],
$GLOBALS['num_tables'],
] = Util::getDbInfo($request, $GLOBALS['db'], false);
[$GLOBALS['tables'], $GLOBALS['num_tables']] = Util::getDbInfo($request, $GLOBALS['db'], false);
// exit if no tables in db found
if ($GLOBALS['num_tables'] < 1) {

View File

@ -75,11 +75,7 @@ final class ImportController extends AbstractController
$charsets = Charsets::getCharsets($this->dbi, $GLOBALS['cfg']['Server']['DisableIS']);
$idKey = $_SESSION[$GLOBALS['SESSION_KEY']]['handler']::getIdKey();
$hiddenInputs = [
$idKey => $uploadId,
'import_type' => 'database',
'db' => $GLOBALS['db'],
];
$hiddenInputs = [$idKey => $uploadId, 'import_type' => 'database', 'db' => $GLOBALS['db']];
$default = isset($_GET['format']) ? (string) $_GET['format'] : Plugins::getDefault('Import', 'format');
$choice = Plugins::getChoice($importList, $default);

View File

@ -23,10 +23,7 @@ class MultiTableQueryController extends AbstractController
public function __invoke(ServerRequest $request): void
{
$this->addScriptFiles([
'database/multi_table_query.js',
'database/query_generator.js',
]);
$this->addScriptFiles(['database/multi_table_query.js', 'database/query_generator.js']);
$queryInstance = new MultiTableQuery($this->dbi, $this->template, $GLOBALS['db']);

View File

@ -61,10 +61,7 @@ class PrivilegesController extends AbstractController
$isCreateUser = $this->dbi->isCreateUser();
if (! $this->dbi->isSuperUser() && ! $isGrantUser && ! $isCreateUser) {
$this->render('server/sub_page_header', [
'type' => 'privileges',
'is_image' => false,
]);
$this->render('server/sub_page_header', ['type' => 'privileges', 'is_image' => false]);
$this->response->addHTML(
Message::error(__('No Privileges'))
->getDisplay(),

View File

@ -33,9 +33,6 @@ final class ChangePrefixFormController extends AbstractController
}
$this->response->disable();
$this->render('database/structure/change_prefix_form', [
'route' => $route,
'url_params' => $urlParams,
]);
$this->render('database/structure/change_prefix_form', ['route' => $route, 'url_params' => $urlParams]);
}
}

View File

@ -156,10 +156,7 @@ final class FavoriteTableController extends AbstractController
// Set flag when localStorage and pmadb(if present) are in sync.
$_SESSION['tmpval']['favorites_synced'][$GLOBALS['server']] = true;
return [
'favoriteTables' => json_encode($favoriteTables),
'list' => $favoriteInstance->getHtmlList(),
];
return ['favoriteTables' => json_encode($favoriteTables), 'list' => $favoriteInstance->getHtmlList()];
}
/**

View File

@ -65,10 +65,7 @@ final class RealRowCountController extends AbstractController
$rowCount = $this->dbi
->getTable($GLOBALS['db'], $table['TABLE_NAME'])
->getRealRowCountTable();
$realRowCountAll[] = [
'table' => $table['TABLE_NAME'],
'row_count' => $rowCount,
];
$realRowCountAll[] = ['table' => $table['TABLE_NAME'], 'row_count' => $rowCount];
}
$this->response->addJSON(['real_row_count_all' => json_encode($realRowCountAll)]);

View File

@ -88,11 +88,7 @@ class StructureController extends AbstractController
*/
private function getDatabaseInfo(ServerRequest $request): void
{
[
$tables,
$numTables,
$totalNumTables,
] = Util::getDbInfo($request, $GLOBALS['db']);
[$tables, $numTables, $totalNumTables] = Util::getDbInfo($request, $GLOBALS['db']);
$this->tables = $tables;
$this->numTables = $numTables;
@ -121,10 +117,7 @@ class StructureController extends AbstractController
{
$GLOBALS['errorUrl'] ??= null;
$parameters = [
'sort' => $_REQUEST['sort'] ?? null,
'sort_order' => $_REQUEST['sort_order'] ?? null,
];
$parameters = ['sort' => $_REQUEST['sort'] ?? null, 'sort_order' => $_REQUEST['sort_order'] ?? null];
$this->checkParameters(['db']);
@ -159,10 +152,7 @@ class StructureController extends AbstractController
$this->response->addHTML($pageSettings->getHTML());
if ($this->numTables > 0) {
$urlParams = [
'pos' => $this->position,
'db' => $GLOBALS['db'],
];
$urlParams = ['pos' => $this->position, 'db' => $GLOBALS['db']];
if (isset($parameters['sort'])) {
$urlParams['sort'] = $parameters['sort'];
}
@ -234,10 +224,7 @@ class StructureController extends AbstractController
$inputClass = ['checkall'];
// Sets parameters for links
$tableUrlParams = [
'db' => $GLOBALS['db'],
'table' => $currentTable['TABLE_NAME'],
];
$tableUrlParams = ['db' => $GLOBALS['db'], 'table' => $currentTable['TABLE_NAME']];
// do not list the previous table's size info for a view
[
@ -444,10 +431,7 @@ class StructureController extends AbstractController
$this->dbi->getDbCollation($GLOBALS['db']),
);
if ($collation !== null) {
$databaseCollation = [
'name' => $collation->getName(),
'description' => $collation->getDescription(),
];
$databaseCollation = ['name' => $collation->getName(), 'description' => $collation->getDescription()];
$databaseCharset = $collation->getCharset();
}
@ -564,10 +548,7 @@ class StructureController extends AbstractController
}
}
return [
$approxRows,
$showSuperscript,
];
return [$approxRows, $showSuperscript];
}
/**
@ -599,10 +580,7 @@ class StructureController extends AbstractController
|| $this->hasTable($replicaInfo['Wild_Ignore_Table'], $table);
}
return [
$do,
$ignored,
];
return [$do, $ignored];
}
/**
@ -806,15 +784,7 @@ class StructureController extends AbstractController
}
}
return [
$currentTable,
$formattedSize,
$unit,
$formattedOverhead,
$overheadUnit,
$overheadSize,
$sumSize,
];
return [$currentTable, $formattedSize, $unit, $formattedOverhead, $overheadUnit, $overheadSize, $sumSize];
}
/**
@ -852,12 +822,7 @@ class StructureController extends AbstractController
[$formattedSize, $unit] = Util::formatByteDown($tblsize, 3, ($tblsize > 0 ? 1 : 0));
}
return [
$currentTable,
$formattedSize,
$unit,
$sumSize,
];
return [$currentTable, $formattedSize, $unit, $sumSize];
}
/**
@ -882,11 +847,6 @@ class StructureController extends AbstractController
[$formattedSize, $unit] = Util::formatByteDown($tblsize, 3, ($tblsize > 0 ? 1 : 0));
}
return [
$currentTable,
$formattedSize,
$unit,
$sumSize,
];
return [$currentTable, $formattedSize, $unit, $sumSize];
}
}

View File

@ -99,17 +99,8 @@ class GisDataEditorController extends AbstractController
$result = "'" . $wkt . "'," . $srid;
// Generate SVG based visualization
$visualizationSettings = [
'width' => 450,
'height' => 300,
'spatialColumn' => 'wkt',
];
$data = [
[
'wkt' => $wktWithZero,
'srid' => $srid,
],
];
$visualizationSettings = ['width' => 450, 'height' => 300, 'spatialColumn' => 'wkt'];
$data = [['wkt' => $wktWithZero, 'srid' => $srid]];
$visualization = GisVisualization::getByData($data, $visualizationSettings);
$svg = $visualization->asSVG();
@ -117,11 +108,7 @@ class GisDataEditorController extends AbstractController
// If the call is to update the WKT and visualization make an AJAX response
if ($request->hasBodyParam('generate')) {
$this->response->addJSON([
'result' => $result,
'visualization' => $svg,
'openLayers' => $openLayers,
]);
$this->response->addJSON(['result' => $result, 'visualization' => $svg, 'openLayers' => $openLayers]);
return;
}

View File

@ -248,10 +248,7 @@ final class ImportController extends AbstractController
$GLOBALS['format'] = Core::securePath($GLOBALS['format']);
if (strlen($GLOBALS['table']) > 0 && strlen($GLOBALS['db']) > 0) {
$GLOBALS['urlParams'] = [
'db' => $GLOBALS['db'],
'table' => $GLOBALS['table'],
];
$GLOBALS['urlParams'] = ['db' => $GLOBALS['db'], 'table' => $GLOBALS['table']];
} elseif (strlen($GLOBALS['db']) > 0) {
$GLOBALS['urlParams'] = ['db' => $GLOBALS['db']];
} else {

View File

@ -35,11 +35,7 @@ class StatusController
$GLOBALS['plugins'] ??= null;
$GLOBALS['timestamp'] ??= null;
[
$GLOBALS['SESSION_KEY'],
$GLOBALS['upload_id'],
$GLOBALS['plugins'],
] = Ajax::uploadProgressSetup();
[$GLOBALS['SESSION_KEY'], $GLOBALS['upload_id'], $GLOBALS['plugins']] = Ajax::uploadProgressSetup();
// $_GET["message"] is used for asking for an import message
if ($request->hasQueryParam('message')) {

View File

@ -29,10 +29,7 @@ final class AddNewPrimaryController extends AbstractController
$dbName = isset($db) ? $db->getName() : '';
$tableName = isset($table) ? $table->getName() : '';
$columnMeta = [
'Field' => $tableName . '_id',
'Extra' => 'auto_increment',
];
$columnMeta = ['Field' => $tableName . '_id', 'Extra' => 'auto_increment'];
$html = $this->normalization->getHtmlForCreateNewColumn($numFields, $dbName, $tableName, $columnMeta);
$html .= Url::getHiddenInputs($dbName, $tableName);
$this->response->addHTML($html);

View File

@ -15,9 +15,6 @@ class MainController extends AbstractController
public function __invoke(ServerRequest $request): void
{
$this->addScriptFiles(['normalization.js', 'vendor/jquery/jquery.uitablefilter.js']);
$this->render('table/normalization/normalization', [
'db' => $GLOBALS['db'],
'table' => $GLOBALS['table'],
]);
$this->render('table/normalization/normalization', ['db' => $GLOBALS['db'], 'table' => $GLOBALS['table']]);
}
}

View File

@ -36,9 +36,7 @@ class TwoFactorController extends AbstractController
if ($request->hasBodyParam('2fa_remove')) {
if (! $twoFactor->check(true)) {
echo $this->template->render('preferences/two_factor/confirm', [
'form' => $twoFactor->render(),
]);
echo $this->template->render('preferences/two_factor/confirm', ['form' => $twoFactor->render()]);
return;
}

View File

@ -15,8 +15,6 @@ final class RecentTablesListController extends AbstractController
return;
}
$this->response->addJSON([
'list' => RecentFavoriteTable::getInstance('recent')->getHtmlList(),
]);
$this->response->addJSON(['list' => RecentFavoriteTable::getInstance('recent')->getHtmlList()]);
}
}

View File

@ -272,10 +272,7 @@ class DatabasesController extends AbstractController
];
}
return [
'databases' => $databases,
'total_statistics' => $totalStatistics,
];
return ['databases' => $databases, 'total_statistics' => $totalStatistics];
}
/**
@ -286,36 +283,12 @@ class DatabasesController extends AbstractController
private function getStatisticsColumns(): array
{
return [
'SCHEMA_TABLES' => [
'title' => __('Tables'),
'format' => 'number',
'raw' => 0,
],
'SCHEMA_TABLE_ROWS' => [
'title' => __('Rows'),
'format' => 'number',
'raw' => 0,
],
'SCHEMA_DATA_LENGTH' => [
'title' => __('Data'),
'format' => 'byte',
'raw' => 0,
],
'SCHEMA_INDEX_LENGTH' => [
'title' => __('Indexes'),
'format' => 'byte',
'raw' => 0,
],
'SCHEMA_LENGTH' => [
'title' => __('Total'),
'format' => 'byte',
'raw' => 0,
],
'SCHEMA_DATA_FREE' => [
'title' => __('Overhead'),
'format' => 'byte',
'raw' => 0,
],
'SCHEMA_TABLES' => ['title' => __('Tables'), 'format' => 'number', 'raw' => 0],
'SCHEMA_TABLE_ROWS' => ['title' => __('Rows'), 'format' => 'number', 'raw' => 0],
'SCHEMA_DATA_LENGTH' => ['title' => __('Data'), 'format' => 'byte', 'raw' => 0],
'SCHEMA_INDEX_LENGTH' => ['title' => __('Indexes'), 'format' => 'byte', 'raw' => 0],
'SCHEMA_LENGTH' => ['title' => __('Total'), 'format' => 'byte', 'raw' => 0],
'SCHEMA_DATA_FREE' => ['title' => __('Overhead'), 'format' => 'byte', 'raw' => 0],
];
}
}

View File

@ -30,8 +30,6 @@ class EnginesController extends AbstractController
$this->dbi->selectDb('mysql');
}
$this->render('server/engines/index', [
'engines' => StorageEngine::getStorageEngines(),
]);
$this->render('server/engines/index', ['engines' => StorageEngine::getStorageEngines()]);
}
}

View File

@ -71,10 +71,7 @@ final class ImportController extends AbstractController
$charsets = Charsets::getCharsets($this->dbi, $GLOBALS['cfg']['Server']['DisableIS']);
$idKey = $_SESSION[$GLOBALS['SESSION_KEY']]['handler']::getIdKey();
$hiddenInputs = [
$idKey => $uploadId,
'import_type' => 'server',
];
$hiddenInputs = [$idKey => $uploadId, 'import_type' => 'server'];
$default = isset($_GET['format']) ? (string) $_GET['format'] : Plugins::getDefault('Import', 'format');
$choice = Plugins::getChoice($importList, $default);

View File

@ -58,9 +58,6 @@ class PluginsController extends AbstractController
);
}
$this->render('server/plugins/index', [
'plugins' => $plugins,
'clean_types' => $cleanTypes,
]);
$this->render('server/plugins/index', ['plugins' => $plugins, 'clean_types' => $cleanTypes]);
}
}

View File

@ -78,10 +78,7 @@ class PrivilegesController extends AbstractController
/**
* Sets globals from $_POST patterns, for privileges and max_* vars
*/
Core::setPostAsGlobal([
'/_priv$/i',
'/^max_/i',
]);
Core::setPostAsGlobal(['/_priv$/i', '/^max_/i']);
$GLOBALS['errorUrl'] = Url::getFromRoute('/');
@ -109,10 +106,7 @@ class PrivilegesController extends AbstractController
$isCreateUser = $this->dbi->isCreateUser();
if (! $this->dbi->isSuperUser() && ! $isGrantUser && ! $isCreateUser) {
$this->render('server/sub_page_header', [
'type' => 'privileges',
'is_image' => false,
]);
$this->render('server/sub_page_header', ['type' => 'privileges', 'is_image' => false]);
$this->response->addHTML(
Message::error(__('No Privileges'))
->getDisplay(),
@ -162,13 +156,7 @@ class PrivilegesController extends AbstractController
* Adds a user
* (Changes / copies a user, part II)
*/
[
$retMessage,
$queries,
$queriesForDisplay,
$GLOBALS['sql_query'],
$addUserError,
] = $serverPrivileges->addUser(
[$retMessage, $queries, $queriesForDisplay, $GLOBALS['sql_query'], $addUserError] = $serverPrivileges->addUser(
$GLOBALS['dbname'] ?? null,
$GLOBALS['username'] ?? '',
$GLOBALS['hostname'] ?? '',
@ -365,14 +353,8 @@ class PrivilegesController extends AbstractController
if (isset($GLOBALS['dbname']) && ! is_array($GLOBALS['dbname'])) {
$urlDbname = urlencode(
str_replace(
[
'\_',
'\%',
],
[
'_',
'%',
],
['\_', '\%'],
['_', '%'],
$GLOBALS['dbname'],
),
);

View File

@ -51,9 +51,6 @@ final class ShowEngineController extends AbstractController
];
}
$this->render('server/engines/show', [
'engine' => $engine,
'page' => $page,
]);
$this->render('server/engines/show', ['engine' => $engine, 'page' => $page]);
}
}

View File

@ -40,8 +40,6 @@ final class ChartingDataController extends AbstractController
return;
}
$this->response->addJSON([
'message' => $this->monitor->getJsonForChartingData($requiredData),
]);
$this->response->addJSON(['message' => $this->monitor->getJsonForChartingData($requiredData)]);
}
}

View File

@ -63,11 +63,7 @@ class VariablesController extends AbstractController
continue;
}
$categories[$sectionId] = [
'id' => $sectionId,
'name' => $sectionName,
'is_selected' => false,
];
$categories[$sectionId] = ['id' => $sectionId, 'name' => $sectionName, 'is_selected' => false];
if (! $filterCategory || $filterCategory !== $sectionId) {
continue;
}
@ -77,10 +73,7 @@ class VariablesController extends AbstractController
$links = [];
foreach ($this->data->links as $sectionName => $sectionLinks) {
$links[$sectionName] = [
'name' => 'status_' . $sectionName,
'links' => $sectionLinks,
];
$links[$sectionName] = ['name' => 'status_' . $sectionName, 'links' => $sectionLinks];
}
$descriptions = $this->getDescriptions();
@ -121,10 +114,7 @@ class VariablesController extends AbstractController
}
foreach ($this->data->links[$name] as $linkName => $linkUrl) {
$variables[$name]['description_doc'][] = [
'name' => $linkName,
'url' => $linkUrl,
];
$variables[$name]['description_doc'][] = ['name' => $linkName, 'url' => $linkUrl];
}
}
}
@ -147,11 +137,7 @@ class VariablesController extends AbstractController
*/
private function flush(string $flush): void
{
$flushCommands = [
'STATUS',
'TABLES',
'QUERY CACHE',
];
$flushCommands = ['STATUS', 'TABLES', 'QUERY CACHE'];
if (! in_array($flush, $flushCommands)) {
return;

View File

@ -37,9 +37,7 @@ final class GetVariableController extends AbstractController
DatabaseInterface::FETCH_NUM,
);
$json = [
'message' => $varValue[1],
];
$json = ['message' => $varValue[1]];
$variableType = ServerVariablesProvider::getImplementation()->getVariableType($params['name']);

View File

@ -50,14 +50,7 @@ final class SetVariableController extends AbstractController
$matches,
)
) {
$exp = [
'kb' => 1,
'kib' => 1,
'mb' => 2,
'mib' => 2,
'gb' => 3,
'gib' => 3,
];
$exp = ['kb' => 1, 'kib' => 1, 'mb' => 2, 'mib' => 2, 'gb' => 3, 'gib' => 3];
$value = (float) $matches[1] * 1024 ** $exp[mb_strtolower($matches[3])];
} else {
$value = $this->dbi->quoteString($value);
@ -111,10 +104,7 @@ final class SetVariableController extends AbstractController
$formattedValue = trim(
$this->template->render(
'server/variables/format_variable',
[
'valueTitle' => Util::formatNumber($value, 0),
'value' => implode(' ', $bytes),
],
['valueTitle' => Util::formatNumber($value, 0), 'value' => implode(' ', $bytes)],
),
);
} else {
@ -122,9 +112,6 @@ final class SetVariableController extends AbstractController
}
}
return [
$formattedValue,
$isHtmlFormatted,
];
return [$formattedValue, $isHtmlFormatted];
}
}

View File

@ -114,10 +114,7 @@ class VariablesController extends AbstractController
$formattedValue = trim(
$this->template->render(
'server/variables/format_variable',
[
'valueTitle' => Util::formatNumber($value, 0),
'value' => implode(' ', $bytes),
],
['valueTitle' => Util::formatNumber($value, 0), 'value' => implode(' ', $bytes)],
),
);
} else {
@ -125,9 +122,6 @@ class VariablesController extends AbstractController
}
}
return [
$formattedValue,
$isHtmlFormatted,
];
return [$formattedValue, $isHtmlFormatted];
}
}

View File

@ -20,10 +20,7 @@ abstract class AbstractController
/** @return array */
protected function getPages(): array
{
$ignored = [
'Config',
'Servers',
];
$ignored = ['Config', 'Servers'];
$pages = [];
foreach (SetupFormList::getAllFormNames() as $formset) {
if (in_array($formset, $ignored)) {
@ -33,10 +30,7 @@ abstract class AbstractController
/** @var BaseForm $formClass */
$formClass = SetupFormList::get($formset);
$pages[$formset] = [
'name' => $formClass::getName(),
'formset' => $formset,
];
$pages[$formset] = ['name' => $formClass::getName(), 'formset' => $formset];
}
return $pages;

View File

@ -73,16 +73,8 @@ class HomeController extends AbstractController
'dsn' => $this->config->getServerDSN($id),
'params' => [
'token' => $_SESSION[' PMA_token '],
'edit' => [
'page' => 'servers',
'mode' => 'edit',
'id' => $id,
],
'remove' => [
'page' => 'servers',
'mode' => 'remove',
'id' => $id,
],
'edit' => ['page' => 'servers', 'mode' => 'edit', 'id' => $id],
'remove' => ['page' => 'servers', 'mode' => 'remove', 'id' => $id],
],
];
}

View File

@ -65,9 +65,7 @@ final class MainController
/** @var mixed $mode */
$mode = $request->getQueryParam('mode');
if ($mode === 'remove' && $request->isPost()) {
$controller->destroy([
'id' => $request->getQueryParam('id'),
]);
$controller->destroy(['id' => $request->getQueryParam('id')]);
header('Location: ../setup/index.php' . Url::getCommonRaw(['route' => '/setup']));
return;

View File

@ -65,10 +65,7 @@ class AddFieldController extends AbstractController
/**
* Defines the url to return to in case of error in a sql statement
*/
$GLOBALS['errorUrl'] = Url::getFromRoute('/table/sql', [
'db' => $GLOBALS['db'],
'table' => $GLOBALS['table'],
]);
$GLOBALS['errorUrl'] = Url::getFromRoute('/table/sql', ['db' => $GLOBALS['db'], 'table' => $GLOBALS['table']]);
// check number of fields to be created
if (isset($_POST['submit_num_fields'])) {

View File

@ -65,17 +65,11 @@ class ExportController extends AbstractController
if (! empty($parser->statements[0]) && ($parser->statements[0] instanceof SelectStatement)) {
// Checking if the WHERE clause has to be replaced.
if (! empty($GLOBALS['where_clause']) && is_array($GLOBALS['where_clause'])) {
$GLOBALS['replaces'][] = [
'WHERE',
'WHERE (' . implode(') OR (', $GLOBALS['where_clause']) . ')',
];
$GLOBALS['replaces'][] = ['WHERE', 'WHERE (' . implode(') OR (', $GLOBALS['where_clause']) . ')'];
}
// Preparing to remove the LIMIT clause.
$GLOBALS['replaces'][] = [
'LIMIT',
'',
];
$GLOBALS['replaces'][] = ['LIMIT', ''];
// Replacing the clauses.
$GLOBALS['sql_query'] = Query::replaceClauses(

View File

@ -260,18 +260,7 @@ class FindReplaceController extends AbstractController
$result = $this->dbi->fetchResult($sqlQuery, 0);
/* Iterate over possible delimiters to get one */
$delimiters = [
'/',
'@',
'#',
'~',
'!',
'$',
'%',
'^',
'&',
'_',
];
$delimiters = ['/', '@', '#', '~', '!', '$', '%', '^', '&', '_'];
foreach ($delimiters as $delimiter) {
if (! str_contains($find, $delimiter)) {

View File

@ -72,10 +72,7 @@ final class IndexRenameController extends AbstractController
{
$this->dbi->selectDb($GLOBALS['db']);
$formParams = [
'db' => $GLOBALS['db'],
'table' => $GLOBALS['table'],
];
$formParams = ['db' => $GLOBALS['db'], 'table' => $GLOBALS['table']];
if (isset($_POST['old_index'])) {
$formParams['old_index'] = $_POST['old_index'];
@ -83,9 +80,6 @@ final class IndexRenameController extends AbstractController
$formParams['old_index'] = $_POST['index'];
}
$this->render('table/index_rename_form', [
'index' => $index,
'form_params' => $formParams,
]);
$this->render('table/index_rename_form', ['index' => $index, 'form_params' => $formParams]);
}
}

View File

@ -107,9 +107,7 @@ class IndexesController extends AbstractController
// Get fields and stores their name/type
if (isset($_POST['create_edit_table'])) {
$fields = json_decode($_POST['columns'], true);
$indexParams = [
'Non_unique' => $_POST['index']['Index_choice'] !== 'UNIQUE',
];
$indexParams = ['Non_unique' => $_POST['index']['Index_choice'] !== 'UNIQUE'];
$index->set($indexParams);
$addFields = count($fields);
} else {
@ -117,10 +115,7 @@ class IndexesController extends AbstractController
->getNameAndTypeOfTheColumns();
}
$formParams = [
'db' => $GLOBALS['db'],
'table' => $GLOBALS['table'],
];
$formParams = ['db' => $GLOBALS['db'], 'table' => $GLOBALS['table']];
if (isset($_POST['create_index'])) {
$formParams['create_index'] = 1;

View File

@ -76,9 +76,6 @@ final class AnalyzeController extends AbstractController
'success',
);
$this->render('table/maintenance/analyze', [
'message' => $message,
'rows' => $rows,
]);
$this->render('table/maintenance/analyze', ['message' => $message, 'rows' => $rows]);
}
}

View File

@ -76,10 +76,6 @@ final class ChecksumController extends AbstractController
'success',
);
$this->render('table/maintenance/checksum', [
'message' => $message,
'rows' => $rows,
'warnings' => $warnings,
]);
$this->render('table/maintenance/checksum', ['message' => $message, 'rows' => $rows, 'warnings' => $warnings]);
}
}

View File

@ -76,9 +76,6 @@ final class OptimizeController extends AbstractController
'success',
);
$this->render('table/maintenance/optimize', [
'message' => $message,
'rows' => $rows,
]);
$this->render('table/maintenance/optimize', ['message' => $message, 'rows' => $rows]);
}
}

View File

@ -76,9 +76,6 @@ final class RepairController extends AbstractController
'success',
);
$this->render('table/maintenance/repair', [
'message' => $message,
'rows' => $rows,
]);
$this->render('table/maintenance/repair', ['message' => $message, 'rows' => $rows]);
}
}

View File

@ -64,9 +64,6 @@ final class DropController extends AbstractController
);
}
$this->render('table/partition/drop', [
'partition_name' => $partitionName,
'message' => $message,
]);
$this->render('table/partition/drop', ['partition_name' => $partitionName, 'message' => $message]);
}
}

View File

@ -64,9 +64,6 @@ final class RebuildController extends AbstractController
);
}
$this->render('table/partition/rebuild', [
'partition_name' => $partitionName,
'message' => $message,
]);
$this->render('table/partition/rebuild', ['partition_name' => $partitionName, 'message' => $message]);
}
}

View File

@ -64,9 +64,6 @@ final class TruncateController extends AbstractController
);
}
$this->render('table/partition/truncate', [
'partition_name' => $partitionName,
'message' => $message,
]);
$this->render('table/partition/truncate', ['partition_name' => $partitionName, 'message' => $message]);
}
}

View File

@ -64,10 +64,7 @@ class PrivilegesController extends AbstractController
$isCreateUser = $this->dbi->isCreateUser();
if (! $this->dbi->isSuperUser() && ! $isGrantUser && ! $isCreateUser) {
$this->render('server/sub_page_header', [
'type' => 'privileges',
'is_image' => false,
]);
$this->render('server/sub_page_header', ['type' => 'privileges', 'is_image' => false]);
$this->response->addHTML(
Message::error(__('No Privileges'))
->getDisplay(),

View File

@ -251,12 +251,7 @@ final class RelationController extends AbstractController
isset($_POST['destination_foreign_db'], $_POST['destination_foreign_table'])
&& isset($_POST['destination_foreign_column'])
) {
[
$html,
$previewSqlData,
$displayQuery,
$seenError,
] = $table->updateForeignKeys(
[$html, $previewSqlData, $displayQuery, $seenError] = $table->updateForeignKeys(
$_POST['destination_foreign_db'],
$multiEditColumnsName,
$_POST['destination_foreign_table'],

View File

@ -72,10 +72,7 @@ final class ReplaceController extends AbstractController
$insertRows = $_POST['insert_rows'] ?? null;
if (is_numeric($insertRows) && $insertRows != $GLOBALS['cfg']['InsertRows']) {
// check whether insert row mode, if so include /table/change
$this->addScriptFiles([
'vendor/jquery/additional-methods.js',
'table/change.js',
]);
$this->addScriptFiles(['vendor/jquery/additional-methods.js', 'table/change.js']);
$GLOBALS['cfg']['InsertRows'] = $_POST['insert_rows'];
/** @var ChangeController $controller */
$controller = Core::getContainerBuilder()->get(ChangeController::class);
@ -84,11 +81,7 @@ final class ReplaceController extends AbstractController
return;
}
$afterInsertActions = [
'new_insert',
'same_insert',
'edit_next',
];
$afterInsertActions = ['new_insert', 'same_insert', 'edit_next'];
if (isset($_POST['after_insert']) && in_array($_POST['after_insert'], $afterInsertActions)) {
$GLOBALS['urlParams']['after_insert'] = $_POST['after_insert'];
if (isset($_POST['where_clause'])) {
@ -111,12 +104,7 @@ final class ReplaceController extends AbstractController
/**
* Prepares the update/insert of a row
*/
[
$loopArray,
$usingKey,
$isInsert,
$isInsertignore,
] = $this->insertEdit->getParamsForUpdateOrInsert();
[$loopArray, $usingKey, $isInsert, $isInsertignore] = $this->insertEdit->getParamsForUpdateOrInsert();
$GLOBALS['query'] = [];
$valueSets = [];
@ -433,10 +421,7 @@ final class ReplaceController extends AbstractController
$extraData = [];
}
$transformationTypes = [
'input_transformation',
'transformation',
];
$transformationTypes = ['input_transformation', 'transformation'];
foreach ($mimeMap as $transformation) {
$columnName = $transformation['column_name'];
foreach ($transformationTypes as $type) {

View File

@ -395,11 +395,6 @@ class SearchController extends AbstractController
'is_float' => $isFloat,
]);
return [
'type' => $type,
'collation' => $collation,
'func' => $func,
'value' => $value,
];
return ['type' => $type, 'collation' => $collation, 'func' => $func, 'value' => $value];
}
}

View File

@ -94,12 +94,7 @@ final class MoveColumnsController extends AbstractController
$defaultType = 'USER_DEFINED';
}
$virtual = [
'VIRTUAL',
'PERSISTENT',
'VIRTUAL GENERATED',
'STORED GENERATED',
];
$virtual = ['VIRTUAL', 'PERSISTENT', 'VIRTUAL GENERATED', 'STORED GENERATED'];
$data['Virtuality'] = '';
$data['Expression'] = '';
if (isset($data['Extra']) && in_array($data['Extra'], $virtual)) {

View File

@ -64,10 +64,7 @@ final class SaveController extends AbstractController
*/
private function updateColumns(): bool
{
$errUrl = Url::getFromRoute('/table/structure', [
'db' => $GLOBALS['db'],
'table' => $GLOBALS['table'],
]);
$errUrl = Url::getFromRoute('/table/structure', ['db' => $GLOBALS['db'], 'table' => $GLOBALS['table']]);
$regenerate = false;
$fieldCnt = count($_POST['field_name'] ?? []);
$changes = [];

View File

@ -356,10 +356,7 @@ class StructureController extends AbstractController
$GLOBALS['tbl_collation'],
);
if ($collation !== null) {
$tableCollation = [
'name' => $collation->getName(),
'description' => $collation->getDescription(),
];
$tableCollation = ['name' => $collation->getName(), 'description' => $collation->getDescription()];
}
if (isset($GLOBALS['showtable']['Create_time'])) {

View File

@ -480,11 +480,6 @@ class ZoomSearchController extends AbstractController
'is_float' => $isFloat,
]);
return [
'type' => $type,
'collation' => $collation,
'func' => $func,
'value' => $value,
];
return ['type' => $type, 'collation' => $collation, 'func' => $func, 'value' => $value];
}
}

View File

@ -34,16 +34,10 @@ class OverviewController extends AbstractController
$mimeTypes = [];
foreach ($types['mimetype'] as $mimeType) {
$mimeTypes[] = [
'name' => $mimeType,
'is_empty' => isset($types['empty_mimetype'][$mimeType]),
];
$mimeTypes[] = ['name' => $mimeType, 'is_empty' => isset($types['empty_mimetype'][$mimeType])];
}
$transformations = [
'transformation' => [],
'input_transformation' => [],
];
$transformations = ['transformation' => [], 'input_transformation' => []];
foreach (array_keys($transformations) as $type) {
foreach ($types[$type] as $key => $transformation) {
@ -54,9 +48,6 @@ class OverviewController extends AbstractController
}
}
$this->render('transformation_overview', [
'mime_types' => $mimeTypes,
'transformations' => $transformations,
]);
$this->render('transformation_overview', ['mime_types' => $mimeTypes, 'transformations' => $transformations]);
}
}

View File

@ -55,9 +55,6 @@ class VersionCheckController extends AbstractController
$date = $latestCompatible['date'];
}
echo json_encode([
'version' => ! empty($version) ? $version : '',
'date' => ! empty($date) ? $date : '',
]);
echo json_encode(['version' => ! empty($version) ? $version : '', 'date' => ! empty($date) ? $date : '']);
}
}

View File

@ -34,21 +34,11 @@ use function substr;
class CreateController extends AbstractController
{
/** @todo Move the whole view rebuilding logic to SQL parser */
private const VIEW_SECURITY_OPTIONS = [
'DEFINER',
'INVOKER',
];
private const VIEW_SECURITY_OPTIONS = ['DEFINER', 'INVOKER'];
private const VIEW_ALGORITHM_OPTIONS = [
'UNDEFINED',
'MERGE',
'TEMPTABLE',
];
private const VIEW_ALGORITHM_OPTIONS = ['UNDEFINED', 'MERGE', 'TEMPTABLE'];
private const VIEW_WITH_OPTIONS = [
'CASCADED',
'LOCAL',
];
private const VIEW_WITH_OPTIONS = ['CASCADED', 'LOCAL'];
public function __construct(ResponseRenderer $response, Template $template, private DatabaseInterface $dbi)
{

View File

@ -83,16 +83,7 @@ class Core
public static function getPHPDocLink(string $target): string
{
/* List of PHP documentation translations */
$phpDocLanguages = [
'pt_BR',
'zh_CN',
'fr',
'de',
'ja',
'ru',
'es',
'tr',
];
$phpDocLanguages = ['pt_BR', 'zh_CN', 'fr', 'de', 'ja', 'ru', 'es', 'tr'];
$lang = 'en';
if (isset($GLOBALS['lang']) && in_array($GLOBALS['lang'], $phpDocLanguages)) {

View File

@ -41,14 +41,7 @@ class CreateAddField
$fieldFullText = json_decode($_POST['fulltext_indexes'], true);
$fieldSpatial = json_decode($_POST['spatial_indexes'], true);
return [
$fieldCount,
$fieldPrimary,
$fieldIndex,
$fieldUnique,
$fieldFullText,
$fieldSpatial,
];
return [$fieldCount, $fieldPrimary, $fieldIndex, $fieldUnique, $fieldFullText, $fieldSpatial];
}
/**

View File

@ -941,10 +941,7 @@ class CentralColumns
foreach ($charsets as $charset) {
$collationsList = [];
foreach ($collations[$charset->getName()] as $collation) {
$collationsList[] = [
'name' => $collation->getName(),
'description' => $collation->getDescription(),
];
$collationsList[] = ['name' => $collation->getName(), 'description' => $collation->getDescription()];
}
$charsetsList[] = [

View File

@ -171,10 +171,7 @@ class Common
$retval[$ti][$cNameI] = [];
if (in_array($dtnI, $tableDbNames) && in_array($con['STN'][$i], $tableDbNames)) {
$retval[$ti][$cNameI][$dtnI] = [];
$retval[$ti][$cNameI][$dtnI][$con['DCN'][$i]] = [
0 => $con['STN'][$i],
1 => $con['SCN'][$i],
];
$retval[$ti][$cNameI][$dtnI][$con['DCN'][$i]] = [0 => $con['STN'][$i], 1 => $con['SCN'][$i]];
}
$ti++;
@ -234,10 +231,7 @@ class Common
*/
public function getScriptTabs(array $designerTables): array
{
$retval = [
'j_tabs' => [],
'h_tabs' => [],
];
$retval = ['j_tabs' => [], 'h_tabs' => []];
foreach ($designerTables as $designerTable) {
$key = rawurlencode($designerTable->getDbTableString());
@ -490,10 +484,7 @@ class Common
$updQuery = new Table($table, $db, $this->dbi);
$updQuery->updateDisplayField($field, $displayFeature);
return [
true,
null,
];
return [true, null];
}
/**
@ -534,10 +525,7 @@ class Common
$existRelForeign = $this->relation->getForeigners($db2, $t2, '', 'foreign');
$foreigner = $this->relation->searchColumnInForeigners($existRelForeign, $f2);
if ($foreigner && isset($foreigner['constraint'])) {
return [
false,
__('Error: relationship already exists.'),
];
return [false, __('Error: relationship already exists.')];
}
// note: in InnoDB, the index does not requires to be on a PRIMARY
@ -586,33 +574,20 @@ class Common
$updQuery .= ';';
if ($this->dbi->tryQuery($updQuery)) {
return [
true,
__('FOREIGN KEY relationship has been added.'),
];
return [true, __('FOREIGN KEY relationship has been added.')];
}
$error = $this->dbi->getError();
return [
false,
__('Error: FOREIGN KEY relationship could not be added!')
. '<br>' . $error,
];
return [false, __('Error: FOREIGN KEY relationship could not be added!') . '<br>' . $error];
}
return [
false,
__('Error: Missing index on column(s).'),
];
return [false, __('Error: Missing index on column(s).')];
}
$relationFeature = $this->relation->getRelationParameters()->relationFeature;
if ($relationFeature === null) {
return [
false,
__('Error: Relational features are disabled!'),
];
return [false, __('Error: Relational features are disabled!')];
}
// no need to recheck if the keys are primary or unique at this point,
@ -633,19 +608,12 @@ class Common
. "'" . $this->dbi->escapeString($f1) . "')";
if ($this->dbi->tryQueryAsControlUser($q)) {
return [
true,
__('Internal relationship has been added.'),
];
return [true, __('Internal relationship has been added.')];
}
$error = $this->dbi->getError(Connection::TYPE_CONTROL);
return [
false,
__('Error: Internal relationship could not be added!')
. '<br>' . $error,
];
return [false, __('Error: Internal relationship could not be added!') . '<br>' . $error];
}
/**
@ -679,19 +647,13 @@ class Common
. Util::backquote($foreigner['constraint']) . ';';
$this->dbi->query($updQuery);
return [
true,
__('FOREIGN KEY relationship has been removed.'),
];
return [true, __('FOREIGN KEY relationship has been removed.')];
}
}
$relationFeature = $this->relation->getRelationParameters()->relationFeature;
if ($relationFeature === null) {
return [
false,
__('Error: Relational features are disabled!'),
];
return [false, __('Error: Relational features are disabled!')];
}
// internal relations
@ -710,16 +672,10 @@ class Common
if (! $result) {
$error = $this->dbi->getError(Connection::TYPE_CONTROL);
return [
false,
__('Error: Internal relationship could not be removed!') . '<br>' . $error,
];
return [false, __('Error: Internal relationship could not be removed!') . '<br>' . $error];
}
return [
true,
__('Internal relationship has been removed.'),
];
return [true, __('Internal relationship has been removed.')];
}
/**

View File

@ -608,11 +608,7 @@ class Events
$events = $this->dbi->fetchResult($query);
foreach ($events as $event) {
$result[] = [
'name' => $event['Name'],
'type' => $event['Type'],
'status' => $event['Status'],
];
$result[] = ['name' => $event['Name'], 'type' => $event['Type'], 'status' => $event['Status']];
}
// Sort results by name

View File

@ -1109,10 +1109,7 @@ class Qbe
}
}
return [
'unique' => $uniqueColumns,
'index' => $indexColumns,
];
return ['unique' => $uniqueColumns, 'index' => $indexColumns];
}
/**
@ -1302,10 +1299,7 @@ class Qbe
$whereClauseTables[$table] = $table;
}
return [
'where_clause_tables' => $whereClauseTables,
'where_clause_columns' => $whereClauseColumns,
];
return ['where_clause_tables' => $whereClauseTables, 'where_clause_columns' => $whereClauseColumns];
}
/**
@ -1712,38 +1706,26 @@ class Qbe
$candidateColumns = $uniqueColumns;
$needSort = 1;
return [
$candidateColumns,
$needSort,
];
return [$candidateColumns, $needSort];
}
if (isset($indexColumns) && count($indexColumns) > 0) {
$candidateColumns = $indexColumns;
$needSort = 1;
return [
$candidateColumns,
$needSort,
];
return [$candidateColumns, $needSort];
}
if (isset($whereClauseColumns) && count($whereClauseColumns) > 0) {
$candidateColumns = $whereClauseColumns;
$needSort = 0;
return [
$candidateColumns,
$needSort,
];
return [$candidateColumns, $needSort];
}
$candidateColumns = $searchTables;
$needSort = 0;
return [
$candidateColumns,
$needSort,
];
return [$candidateColumns, $needSort];
}
}

View File

@ -343,10 +343,7 @@ class Routines
$errors = $this->checkResult($createRoutine, $errors);
}
return [
$errors,
null,
];
return [$errors, null];
}
// Default value
@ -373,10 +370,7 @@ class Routines
$message = $this->flushPrivileges($resultAdjust);
return [
[],
$message,
];
return [[], $message];
}
/**

View File

@ -231,11 +231,7 @@ class Search
$resultCount = (int) $this->dbi->fetchValue($newSearchSqls['select_count']);
$resultTotal += $resultCount;
// Gets the result row's HTML for a table
$rows[] = [
'table' => $eachTable,
'new_search_sqls' => $newSearchSqls,
'result_count' => $resultCount,
];
$rows[] = ['table' => $eachTable, 'new_search_sqls' => $newSearchSqls, 'result_count' => $resultCount];
}
return $this->template->render('database/search/results', [

View File

@ -415,10 +415,7 @@ class DatabaseInterface implements DbalInterface
/** @var mixed[][][] $tables */
$tables = $this->fetchResult(
$sql,
[
'TABLE_SCHEMA',
'TABLE_NAME',
],
['TABLE_SCHEMA', 'TABLE_NAME'],
null,
$connectionType,
);

View File

@ -301,16 +301,10 @@ class Results
'views' => ['view_definition' => $sqlHighlightingData],
],
'mysql' => [
'event' => [
'body' => $blobSqlHighlightingData,
'body_utf8' => $blobSqlHighlightingData,
],
'event' => ['body' => $blobSqlHighlightingData, 'body_utf8' => $blobSqlHighlightingData],
'general_log' => ['argument' => $sqlHighlightingData],
'help_category' => ['url' => $linkData],
'help_topic' => [
'example' => $sqlHighlightingData,
'url' => $linkData,
],
'help_topic' => ['example' => $sqlHighlightingData, 'url' => $linkData],
'proc' => [
'param_list' => $blobSqlHighlightingData,
'returns' => $blobSqlHighlightingData,
@ -611,10 +605,7 @@ class Results
// if for COUNT query, number of rows returned more than 1
// (may be being used GROUP BY)
if ($this->properties['is_count'] && $numRows > 1) {
$displayParts = $displayParts->with([
'hasNavigationBar' => true,
'hasSortLink' => true,
]);
$displayParts = $displayParts->with(['hasNavigationBar' => true, 'hasSortLink' => true]);
}
// 4. If navigation bar or sorting fields names URLs should be
@ -631,10 +622,7 @@ class Results
}
}
return [
$displayParts,
(int) $theTotal,
];
return [$displayParts, (int) $theTotal];
}
/**
@ -687,10 +675,7 @@ class Results
]);
}
return [
$output,
$nbTotalPage,
];
return [$output, $nbTotalPage];
}
/**
@ -716,10 +701,7 @@ class Results
$pageSelector = '';
$numberTotalPage = 1;
if (! $isShowingAll) {
[
$pageSelector,
$numberTotalPage,
] = $this->getHtmlPageSelector();
[$pageSelector, $numberTotalPage] = $this->getHtmlPageSelector();
}
$isLastPage = $this->properties['unlim_num_rows'] !== -1 && $this->properties['unlim_num_rows'] !== false
@ -1061,11 +1043,7 @@ class Results
];
}
$options[] = [
'value' => $unsortedSqlQuery,
'content' => __('None'),
'is_selected' => ! $isIndexUsed,
];
$options[] = ['value' => $unsortedSqlQuery, 'content' => __('None'), 'is_selected' => ! $isIndexUsed];
return ['hidden_fields' => $hiddenFields, 'options' => $options];
}
@ -1521,11 +1499,7 @@ class Results
$sortOrderColumns[] = $sortOrder;
}
return [
$singleSortOrder,
implode(', ', $sortOrderColumns),
$orderImg ?? '',
];
return [$singleSortOrder, implode(', ', $sortOrderColumns), $orderImg ?? ''];
}
/**
@ -1612,43 +1586,28 @@ class Results
$orderImg = ' ' . Generator::getImage(
's_desc',
__('Descending'),
[
'class' => 'soimg',
'title' => '',
],
['class' => 'soimg', 'title' => ''],
);
$orderImg .= ' ' . Generator::getImage(
's_asc',
__('Ascending'),
[
'class' => 'soimg hide',
'title' => '',
],
['class' => 'soimg hide', 'title' => ''],
);
} else {
$sortOrder .= self::DESCENDING_SORT_DIR;
$orderImg = ' ' . Generator::getImage(
's_asc',
__('Ascending'),
[
'class' => 'soimg',
'title' => '',
],
['class' => 'soimg', 'title' => ''],
);
$orderImg .= ' ' . Generator::getImage(
's_desc',
__('Descending'),
[
'class' => 'soimg hide',
'title' => '',
],
['class' => 'soimg hide', 'title' => ''],
);
}
return [
$sortOrder,
$orderImg,
];
return [$sortOrder, $orderImg];
}
/**
@ -1883,10 +1842,7 @@ class Results
bool $isFieldTruncated = false,
bool $hasTransformationPlugin = false,
): string {
$classes = array_filter([
$class,
$nowrap,
]);
$classes = array_filter([$class, $nowrap]);
if ($meta->internalMediaType !== null) {
$classes[] = preg_replace('/\//', '_', $meta->internalMediaType);
@ -2413,10 +2369,7 @@ class Results
);
$transformationPlugin = new Text_Plain_Link();
$transformOptions = [
0 => $linkingUrl,
2 => true,
];
$transformOptions = [0 => $linkingUrl, 2 => true];
$meta->internalMediaType = str_replace('_', '/', 'Text/Plain');
}
@ -2669,10 +2622,7 @@ class Results
$colVisib = false;
}
return [
$colOrder,
$colVisib,
];
return [$colOrder, $colVisib];
}
/**
@ -2754,13 +2704,7 @@ class Results
__('Copy'),
);
return [
$editUrl,
$copyUrl,
$editStr,
$copyStr,
$urlParams,
];
return [$editUrl, $copyUrl, $editStr, $copyStr, $urlParams];
}
/**
@ -2827,11 +2771,7 @@ class Results
$kill = $this->dbi->getKillQuery($processId);
$urlParams = [
'db' => 'mysql',
'sql_query' => $kill,
'goto' => $linkGoto,
];
$urlParams = ['db' => 'mysql', 'sql_query' => $kill, 'goto' => $linkGoto];
$deleteUrl = Url::getFromRoute('/sql');
$jsConf = $kill;
@ -2843,12 +2783,7 @@ class Results
$deleteUrl = $deleteString = $jsConf = $urlParams = null;
}
return [
$deleteUrl,
$deleteString,
$jsConf,
$urlParams,
];
return [$deleteUrl, $deleteString, $jsConf, $urlParams];
}
/**
@ -3139,11 +3074,7 @@ class Results
&& str_contains($transformationPlugin->getName(), 'Link'))
&& ! $meta->isBinary()
) {
[
$isFieldTruncated,
$column,
$originalLength,
] = $this->getPartialText($column);
[$isFieldTruncated, $column, $originalLength] = $this->getPartialText($column);
}
if ($meta->isMappedTypeBit) {
@ -3411,10 +3342,7 @@ class Results
// 1.1 Gets the information about which functionalities should be
// displayed
[
$displayParts,
$total,
] = $this->setDisplayPartsAndTotal($displayParts);
[$displayParts, $total] = $this->setDisplayPartsAndTotal($displayParts);
// 1.2 Defines offsets for the next and previous pages
$posNext = 0;
@ -3834,12 +3762,7 @@ class Results
foreach ($existRel as $masterField => $rel) {
if ($masterField !== 'foreign_keys_data') {
$displayField = $this->relation->getDisplayField($rel['foreign_db'], $rel['foreign_table']);
$map[$masterField] = [
$rel['foreign_table'],
$rel['foreign_field'],
$displayField,
$rel['foreign_db'],
];
$map[$masterField] = [$rel['foreign_table'], $rel['foreign_field'], $displayField, $rel['foreign_db']];
} else {
foreach ($rel as $oneKey) {
foreach ($oneKey['index_list'] as $index => $oneField) {
@ -4303,10 +4226,6 @@ class Results
$truncated = false;
}
return [
$truncated,
$str,
$originalLength,
];
return [$truncated, $str, $originalLength];
}
}

View File

@ -65,26 +65,10 @@ class Encoding
* @var array
*/
private static array $enginemap = [
'iconv' => [
'iconv',
self::ENGINE_ICONV,
'iconv',
],
'recode' => [
'recode_string',
self::ENGINE_RECODE,
'recode',
],
'mb' => [
'mb_convert_encoding',
self::ENGINE_MB,
'mbstring',
],
'none' => [
'isset',
self::ENGINE_NONE,
'',
],
'iconv' => ['iconv', self::ENGINE_ICONV, 'iconv'],
'recode' => ['recode_string', self::ENGINE_RECODE, 'recode'],
'mb' => ['mb_convert_encoding', self::ENGINE_MB, 'mbstring'],
'none' => ['isset', self::ENGINE_NONE, ''],
];
/**
@ -92,11 +76,7 @@ class Encoding
*
* @var array
*/
private static array $engineorder = [
'iconv',
'mb',
'recode',
];
private static array $engineorder = ['iconv', 'mb', 'recode'];
/**
* Kanji encodings list

View File

@ -24,9 +24,7 @@ class Bdb extends StorageEngine
public function getVariables(): array
{
return [
'version_bdb' => [
'title' => __('Version information'),
],
'version_bdb' => ['title' => __('Version information')],
'bdb_cache_size' => ['type' => StorageEngine::DETAILS_TYPE_SIZE],
'bdb_home' => [],
'bdb_log_buffer_size' => ['type' => StorageEngine::DETAILS_TYPE_SIZE],

View File

@ -31,9 +31,7 @@ class Innodb extends StorageEngine
'title' => __('Data home directory'),
'desc' => __('The common part of the directory path for all InnoDB data files.'),
],
'innodb_data_file_path' => [
'title' => __('Data files'),
],
'innodb_data_file_path' => ['title' => __('Data files')],
'innodb_autoextend_increment' => [
'title' => __('Autoextend increment'),
'desc' => __(
@ -103,10 +101,7 @@ class Innodb extends StorageEngine
return [];
}
return [
'Bufferpool' => __('Buffer Pool'),
'Status' => __('InnoDB Status'),
];
return ['Bufferpool' => __('Buffer Pool'), 'Status' => __('InnoDB Status')];
}
/**

View File

@ -21,8 +21,6 @@ class Memory extends StorageEngine
*/
public function getVariables(): array
{
return [
'max_heap_table_size' => ['type' => StorageEngine::DETAILS_TYPE_SIZE],
];
return ['max_heap_table_size' => ['type' => StorageEngine::DETAILS_TYPE_SIZE]];
}
}

View File

@ -21,9 +21,7 @@ class Ndbcluster extends StorageEngine
*/
public function getVariables(): array
{
return [
'ndb_connectstring' => [],
];
return ['ndb_connectstring' => []];
}
/**

View File

@ -157,12 +157,7 @@ class Error extends Message
{
$result = [];
$members = [
'line',
'function',
'class',
'type',
];
$members = ['line', 'function', 'class', 'type'];
foreach ($backtrace as $idx => $step) {
/* Create new backtrace entry */
@ -415,12 +410,7 @@ class Error extends Message
public static function getArg(mixed $arg, string $function): string
{
$retval = '';
$includeFunctions = [
'include',
'include_once',
'require',
'require_once',
];
$includeFunctions = ['include', 'include_once', 'require', 'require_once'];
$connectFunctions = [
'mysql_connect',
'mysql_pconnect',

View File

@ -192,10 +192,7 @@ class ErrorReport
$uri = $scriptName . '?' . $query;
return [
$uri,
$scriptName,
];
return [$uri, $scriptName];
}
/**

View File

@ -318,10 +318,7 @@ class Export
$mediaType = 'application/zip';
}
return [
$filename,
$mediaType,
];
return [$filename, $mediaType];
}
/**
@ -437,11 +434,7 @@ class Export
}
}
return [
$saveFilename,
$message,
$fileHandle,
];
return [$saveFilename, $message, $fileHandle];
}
/**

View File

@ -76,10 +76,7 @@ final class Options
$isSelected = true;
}
$databases[] = [
'name' => $currentDb,
'is_selected' => $isSelected,
];
$databases[] = ['name' => $currentDb, 'is_selected' => $isSelected];
}
return $databases;

View File

@ -84,10 +84,7 @@ class FileListing
$template = new Template();
return $template->render('file_select_options', [
'filesList' => $list,
'active' => $active,
]);
return $template->render('file_select_options', ['filesList' => $list, 'active' => $active]);
}
/**

View File

@ -30,51 +30,17 @@ class Font
$charLists = [];
//ijl
$charLists[] = [
'chars' => [
'i',
'j',
'l',
],
'modifier' => 0.23,
];
$charLists[] = ['chars' => ['i', 'j', 'l'], 'modifier' => 0.23];
//f
$charLists[] = [
'chars' => ['f'],
'modifier' => 0.27,
];
$charLists[] = ['chars' => ['f'], 'modifier' => 0.27];
//tI
$charLists[] = [
'chars' => [
't',
'I',
],
'modifier' => 0.28,
];
$charLists[] = ['chars' => ['t', 'I'], 'modifier' => 0.28];
//r
$charLists[] = [
'chars' => ['r'],
'modifier' => 0.34,
];
$charLists[] = ['chars' => ['r'], 'modifier' => 0.34];
//1
$charLists[] = [
'chars' => ['1'],
'modifier' => 0.49,
];
$charLists[] = ['chars' => ['1'], 'modifier' => 0.49];
//cksvxyzJ
$charLists[] = [
'chars' => [
'c',
'k',
's',
'v',
'x',
'y',
'z',
'J',
],
'modifier' => 0.5,
];
$charLists[] = ['chars' => ['c', 'k', 's', 'v', 'x', 'y', 'z', 'J'], 'modifier' => 0.5];
//abdeghnopquL023456789
$charLists[] = [
'chars' => [
@ -103,69 +69,19 @@ class Font
'modifier' => 0.56,
];
//FTZ
$charLists[] = [
'chars' => [
'F',
'T',
'Z',
],
'modifier' => 0.61,
];
$charLists[] = ['chars' => ['F', 'T', 'Z'], 'modifier' => 0.61];
//ABEKPSVXY
$charLists[] = [
'chars' => [
'A',
'B',
'E',
'K',
'P',
'S',
'V',
'X',
'Y',
],
'modifier' => 0.67,
];
$charLists[] = ['chars' => ['A', 'B', 'E', 'K', 'P', 'S', 'V', 'X', 'Y'], 'modifier' => 0.67];
//wCDHNRU
$charLists[] = [
'chars' => [
'w',
'C',
'D',
'H',
'N',
'R',
'U',
],
'modifier' => 0.73,
];
$charLists[] = ['chars' => ['w', 'C', 'D', 'H', 'N', 'R', 'U'], 'modifier' => 0.73];
//GOQ
$charLists[] = [
'chars' => [
'G',
'O',
'Q',
],
'modifier' => 0.78,
];
$charLists[] = ['chars' => ['G', 'O', 'Q'], 'modifier' => 0.78];
//mM
$charLists[] = [
'chars' => [
'm',
'M',
],
'modifier' => 0.84,
];
$charLists[] = ['chars' => ['m', 'M'], 'modifier' => 0.84];
//W
$charLists[] = [
'chars' => ['W'],
'modifier' => 0.95,
];
$charLists[] = ['chars' => ['W'], 'modifier' => 0.95];
//" "
$charLists[] = [
'chars' => [' '],
'modifier' => 0.28,
];
$charLists[] = ['chars' => [' '], 'modifier' => 0.28];
return $charLists;
}

Some files were not shown because too many files have changed in this diff Show More