You've already forked phpmyadmin
mirror of
https://github.com/phpmyadmin/phpmyadmin.git
synced 2026-10-23 18:29:15 +03:00
Refactor getVariablesStatus()
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
This commit is contained in:
@@ -12771,12 +12771,6 @@ parameters:
|
||||
count: 1
|
||||
path: src/StorageEngine.php
|
||||
|
||||
-
|
||||
message: '#^Cannot access offset ''desc'' on mixed\.$#'
|
||||
identifier: offsetAccess.nonOffsetAccessible
|
||||
count: 1
|
||||
path: src/StorageEngine.php
|
||||
|
||||
-
|
||||
message: '#^Cannot access offset ''disk_usage'' on mixed\.$#'
|
||||
identifier: offsetAccess.nonOffsetAccessible
|
||||
@@ -12789,22 +12783,10 @@ parameters:
|
||||
count: 1
|
||||
path: src/StorageEngine.php
|
||||
|
||||
-
|
||||
message: '#^Cannot access offset ''title'' on mixed\.$#'
|
||||
identifier: offsetAccess.nonOffsetAccessible
|
||||
count: 3
|
||||
path: src/StorageEngine.php
|
||||
|
||||
-
|
||||
message: '#^Cannot access offset ''type'' on mixed\.$#'
|
||||
identifier: offsetAccess.nonOffsetAccessible
|
||||
count: 4
|
||||
path: src/StorageEngine.php
|
||||
|
||||
-
|
||||
message: '#^Cannot access offset ''value'' on mixed\.$#'
|
||||
identifier: offsetAccess.nonOffsetAccessible
|
||||
count: 4
|
||||
count: 1
|
||||
path: src/StorageEngine.php
|
||||
|
||||
-
|
||||
@@ -12832,31 +12814,7 @@ parameters:
|
||||
path: src/StorageEngine.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#1 \$haystack of function mb_stripos expects string, string\|null given\.$#'
|
||||
identifier: argument.type
|
||||
count: 1
|
||||
path: src/StorageEngine.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#1 \$message of static method PhpMyAdmin\\Html\\Generator\:\:showHint\(\) expects string, mixed given\.$#'
|
||||
identifier: argument.type
|
||||
count: 1
|
||||
path: src/StorageEngine.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#1 \$string of function htmlspecialchars expects string, mixed given\.$#'
|
||||
identifier: argument.type
|
||||
count: 2
|
||||
path: src/StorageEngine.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#1 \$value of method PhpMyAdmin\\StorageEngine\:\:resolveTypeSize\(\) expects int\|string, mixed given\.$#'
|
||||
identifier: argument.type
|
||||
count: 1
|
||||
path: src/StorageEngine.php
|
||||
|
||||
-
|
||||
message: '#^Parameter \#1 \$value of static method PhpMyAdmin\\Util\:\:formatNumber\(\) expects float\|int\|numeric\-string, mixed given\.$#'
|
||||
message: '#^Parameter \#1 \$value of static method PhpMyAdmin\\Util\:\:formatNumber\(\) expects float\|int\|numeric\-string, string given\.$#'
|
||||
identifier: argument.type
|
||||
count: 1
|
||||
path: src/StorageEngine.php
|
||||
|
||||
@@ -7552,6 +7552,9 @@
|
||||
</RiskyTruthyFalsyComparison>
|
||||
</file>
|
||||
<file src="src/StorageEngine.php">
|
||||
<ArgumentTypeCoercion>
|
||||
<code><![CDATA[$details['value']]]></code>
|
||||
</ArgumentTypeCoercion>
|
||||
<DeprecatedMethod>
|
||||
<code><![CDATA[DatabaseInterface::getInstance()]]></code>
|
||||
<code><![CDATA[DatabaseInterface::getInstance()]]></code>
|
||||
@@ -7559,37 +7562,17 @@
|
||||
<code><![CDATA[DatabaseInterface::getInstance()]]></code>
|
||||
<code><![CDATA[DatabaseInterface::getInstance()]]></code>
|
||||
</DeprecatedMethod>
|
||||
<MixedArgument>
|
||||
<code><![CDATA[$details['desc']]]></code>
|
||||
<code><![CDATA[$details['title']]]></code>
|
||||
<code><![CDATA[$details['value']]]></code>
|
||||
<code><![CDATA[$details['value']]]></code>
|
||||
<code><![CDATA[$details['value']]]></code>
|
||||
</MixedArgument>
|
||||
<MixedArrayAccess>
|
||||
<code><![CDATA[$decodedData['disk_usage']]]></code>
|
||||
<code><![CDATA[$decodedData['disk_usage']]]></code>
|
||||
<code><![CDATA[$details['desc']]]></code>
|
||||
<code><![CDATA[$details['title']]]></code>
|
||||
<code><![CDATA[$details['type']]]></code>
|
||||
<code><![CDATA[$details['value']]]></code>
|
||||
<code><![CDATA[$details['value']]]></code>
|
||||
<code><![CDATA[$details['value']]]></code>
|
||||
<code><![CDATA[$mroongaData['type']]]></code>
|
||||
<code><![CDATA[$mroongaData['type']['id']]]></code>
|
||||
</MixedArrayAccess>
|
||||
<MixedArrayAssignment>
|
||||
<code><![CDATA[$mysqlVars[$row['Variable_name']]['title']]]></code>
|
||||
<code><![CDATA[$mysqlVars[$row['Variable_name']]['type']]]></code>
|
||||
<code><![CDATA[$mysqlVars[$row['Variable_name']]['value']]]></code>
|
||||
</MixedArrayAssignment>
|
||||
<MixedAssignment>
|
||||
<code><![CDATA[$dataLength]]></code>
|
||||
<code><![CDATA[$decodedData]]></code>
|
||||
<code><![CDATA[$details]]></code>
|
||||
<code><![CDATA[$indexLength]]></code>
|
||||
<code><![CDATA[$mroongaData]]></code>
|
||||
<code><![CDATA[$mysqlVars[$row['Variable_name']]]]></code>
|
||||
</MixedAssignment>
|
||||
<MixedOperand>
|
||||
<code><![CDATA[$decodedData['disk_usage']]]></code>
|
||||
@@ -7602,19 +7585,10 @@
|
||||
<code><![CDATA[[$dataLength, $indexLength]]]></code>
|
||||
<code><![CDATA[int[]]]></code>
|
||||
</MixedReturnTypeCoercion>
|
||||
<PossiblyNullArgument>
|
||||
<code><![CDATA[$row['Variable_name']]]></code>
|
||||
</PossiblyNullArgument>
|
||||
<PossiblyNullArrayOffset>
|
||||
<code><![CDATA[$mysqlVars]]></code>
|
||||
<code><![CDATA[$mysqlVars]]></code>
|
||||
<code><![CDATA[$mysqlVars]]></code>
|
||||
<code><![CDATA[$mysqlVars]]></code>
|
||||
<code><![CDATA[$mysqlVars]]></code>
|
||||
<code><![CDATA[$mysqlVars]]></code>
|
||||
<code><![CDATA[$variables]]></code>
|
||||
<code><![CDATA[$variables]]></code>
|
||||
</PossiblyNullArrayOffset>
|
||||
<RiskyTruthyFalsyComparison>
|
||||
<code><![CDATA[empty($details['desc'])]]></code>
|
||||
<code><![CDATA[empty($variableInfo['title'])]]></code>
|
||||
</RiskyTruthyFalsyComparison>
|
||||
</file>
|
||||
<file src="src/SystemDatabase.php">
|
||||
<PossiblyNullArgument>
|
||||
|
||||
@@ -21,7 +21,7 @@ class Innodb extends StorageEngine
|
||||
/**
|
||||
* Returns array with variable names related to InnoDB storage engine
|
||||
*
|
||||
* @return mixed[] variable names
|
||||
* @return array<string, array{title?: string, desc?: string, type?: int}> variable names
|
||||
*/
|
||||
public function getVariables(): array
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@ class Memory extends StorageEngine
|
||||
/**
|
||||
* Returns array with variable names dedicated to MEMORY storage engine
|
||||
*
|
||||
* @return mixed[] variable names
|
||||
* @return array<string, array{title?: string, desc?: string, type?: int}> variable names
|
||||
*/
|
||||
public function getVariables(): array
|
||||
{
|
||||
|
||||
@@ -19,7 +19,7 @@ class Myisam extends StorageEngine
|
||||
/**
|
||||
* Returns array with variable names dedicated to MyISAM storage engine
|
||||
*
|
||||
* @return mixed[] variable names
|
||||
* @return array<string, array{title?: string, desc?: string, type?: int}> variable names
|
||||
*/
|
||||
public function getVariables(): array
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@ class Ndbcluster extends StorageEngine
|
||||
/**
|
||||
* Returns array with variable names related to NDBCLUSTER storage engine
|
||||
*
|
||||
* @return mixed[] variable names
|
||||
* @return array<string, array{title?: string, desc?: string, type?: int}> variable names
|
||||
*/
|
||||
public function getVariables(): array
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@ class Pbxt extends StorageEngine
|
||||
/**
|
||||
* Returns array with variable names dedicated to PBXT storage engine
|
||||
*
|
||||
* @return mixed[] variable names
|
||||
* @return array<string, array{title?: string, desc?: string, type?: int}> variable names
|
||||
*/
|
||||
public function getVariables(): array
|
||||
{
|
||||
|
||||
@@ -340,7 +340,7 @@ class StorageEngine
|
||||
/**
|
||||
* Returns array with detailed info about engine specific server variables
|
||||
*
|
||||
* @return mixed[] array with detailed info about specific engine server variables
|
||||
* @return array<string, array{title: string, desc: string|null, type: int, value: string}>
|
||||
*/
|
||||
public function getVariablesStatus(): array
|
||||
{
|
||||
@@ -355,24 +355,23 @@ class StorageEngine
|
||||
|
||||
$sqlQuery = 'SHOW GLOBAL VARIABLES ' . $like . ';';
|
||||
$res = DatabaseInterface::getInstance()->query($sqlQuery);
|
||||
foreach ($res as $row) {
|
||||
if (isset($variables[$row['Variable_name']])) {
|
||||
$mysqlVars[$row['Variable_name']] = $variables[$row['Variable_name']];
|
||||
} elseif ($like === '' && mb_stripos($row['Variable_name'], $this->engine) !== 0) {
|
||||
/**
|
||||
* @var string $variableName
|
||||
* @var string $value
|
||||
*/
|
||||
foreach ($res as ['Variable_name' => $variableName, 'Value' => $value]) {
|
||||
if (! isset($variables[$variableName]) && $like === '' && mb_stripos($variableName, $this->engine) !== 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$mysqlVars[$row['Variable_name']]['value'] = $row['Value'];
|
||||
$variableInfo = $variables[$variableName] ?? [];
|
||||
|
||||
if (empty($mysqlVars[$row['Variable_name']]['title'])) {
|
||||
$mysqlVars[$row['Variable_name']]['title'] = $row['Variable_name'];
|
||||
}
|
||||
|
||||
if (isset($mysqlVars[$row['Variable_name']]['type'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$mysqlVars[$row['Variable_name']]['type'] = self::DETAILS_TYPE_PLAINTEXT;
|
||||
$mysqlVars[$variableName] = [
|
||||
'title' => empty($variableInfo['title']) ? $variableName : $variableInfo['title'],
|
||||
'desc' => $variableInfo['desc'] ?? null,
|
||||
'type' => $variableInfo['type'] ?? self::DETAILS_TYPE_PLAINTEXT,
|
||||
'value' => $value,
|
||||
];
|
||||
}
|
||||
|
||||
return $mysqlVars;
|
||||
@@ -420,7 +419,7 @@ class StorageEngine
|
||||
* engine. This function should be overridden when extending this class
|
||||
* for a particular engine.
|
||||
*
|
||||
* @return mixed[] The list of variables.
|
||||
* @return array<string, array{title?: string, desc?: string, type?: int}> The list of variables.
|
||||
*/
|
||||
public function getVariables(): array
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user