Merge pull request #18869 from kamil-tekiela/getStatusInfo-$disableError
Refactoring getStatusInfo() and Cache
This commit is contained in:
commit
18d91ef865
@ -1585,11 +1585,6 @@ parameters:
|
||||
count: 1
|
||||
path: src/Controllers/Database/DataDictionaryController.php
|
||||
|
||||
-
|
||||
message: "#^Cannot cast mixed to string\\.$#"
|
||||
count: 1
|
||||
path: src/Controllers/Database/DataDictionaryController.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'dbName' on mixed\\.$#"
|
||||
count: 2
|
||||
@ -3360,11 +3355,6 @@ parameters:
|
||||
count: 2
|
||||
path: src/Controllers/Operations/DatabaseController.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'Row_format' on mixed\\.$#"
|
||||
count: 1
|
||||
path: src/Controllers/Operations/TableController.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'back' on mixed\\.$#"
|
||||
count: 2
|
||||
@ -5880,59 +5870,29 @@ parameters:
|
||||
count: 2
|
||||
path: src/Controllers/Table/Structure/SaveController.php
|
||||
|
||||
-
|
||||
message: "#^Binary operation \"\\+\" between int\\|non\\-falsy\\-string and int\\|non\\-falsy\\-string results in an error\\.$#"
|
||||
count: 4
|
||||
path: src/Controllers/Table/StructureController.php
|
||||
|
||||
-
|
||||
message: "#^Binary operation \"\\-\" between mixed and int\\|string results in an error\\.$#"
|
||||
count: 1
|
||||
path: src/Controllers/Table/StructureController.php
|
||||
|
||||
-
|
||||
message: "#^Binary operation \"/\" between mixed and int\\|string\\|null results in an error\\.$#"
|
||||
count: 1
|
||||
path: src/Controllers/Table/StructureController.php
|
||||
|
||||
-
|
||||
message: "#^Call to function in_array\\(\\) requires parameter \\#3 to be set\\.$#"
|
||||
count: 1
|
||||
path: src/Controllers/Table/StructureController.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'Check_time' on mixed\\.$#"
|
||||
count: 1
|
||||
path: src/Controllers/Table/StructureController.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'Create_time' on mixed\\.$#"
|
||||
count: 1
|
||||
path: src/Controllers/Table/StructureController.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'Data_free' on mixed\\.$#"
|
||||
count: 1
|
||||
path: src/Controllers/Table/StructureController.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'Data_length' on mixed\\.$#"
|
||||
count: 7
|
||||
path: src/Controllers/Table/StructureController.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'Index_length' on mixed\\.$#"
|
||||
count: 2
|
||||
path: src/Controllers/Table/StructureController.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'Name' on mixed\\.$#"
|
||||
count: 1
|
||||
path: src/Controllers/Table/StructureController.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'Rows' on mixed\\.$#"
|
||||
count: 1
|
||||
path: src/Controllers/Table/StructureController.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'Type' on mixed\\.$#"
|
||||
count: 1
|
||||
path: src/Controllers/Table/StructureController.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'Update_time' on mixed\\.$#"
|
||||
count: 1
|
||||
path: src/Controllers/Table/StructureController.php
|
||||
|
||||
-
|
||||
message: "#^Cannot use array destructuring on array\\<int, string\\>\\|null\\.$#"
|
||||
count: 1
|
||||
count: 4
|
||||
path: src/Controllers/Table/StructureController.php
|
||||
|
||||
-
|
||||
@ -5946,28 +5906,18 @@ parameters:
|
||||
path: src/Controllers/Table/StructureController.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$datetime of function strtotime expects string, mixed given\\.$#"
|
||||
message: "#^Parameter \\#1 \\$datetime of function strtotime expects string, int\\|string given\\.$#"
|
||||
count: 3
|
||||
path: src/Controllers/Table/StructureController.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$showTableName of method PhpMyAdmin\\\\Table\\\\Table\\:\\:getNumRows\\(\\) expects string, mixed given\\.$#"
|
||||
count: 1
|
||||
path: src/Controllers/Table/StructureController.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$timestamp of static method PhpMyAdmin\\\\Util\\:\\:localisedDate\\(\\) expects int, \\(int\\|false\\) given\\.$#"
|
||||
message: "#^Parameter \\#1 \\$timestamp of static method PhpMyAdmin\\\\Util\\:\\:localisedDate\\(\\) expects int, int\\|false given\\.$#"
|
||||
count: 3
|
||||
path: src/Controllers/Table/StructureController.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$value of static method PhpMyAdmin\\\\Util\\:\\:formatByteDown\\(\\) expects float\\|int\\|string\\|null, \\(array\\|float\\|int\\) given\\.$#"
|
||||
count: 2
|
||||
path: src/Controllers/Table/StructureController.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$value of static method PhpMyAdmin\\\\Util\\:\\:formatByteDown\\(\\) expects float\\|int\\|string\\|null, mixed given\\.$#"
|
||||
count: 3
|
||||
count: 4
|
||||
path: src/Controllers/Table/StructureController.php
|
||||
|
||||
-
|
||||
@ -12995,26 +12945,6 @@ parameters:
|
||||
count: 10
|
||||
path: src/Plugins/Schema/Pdf/PdfRelationSchema.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'Check_time' on mixed\\.$#"
|
||||
count: 1
|
||||
path: src/Plugins/Schema/Pdf/PdfRelationSchema.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'Comment' on mixed\\.$#"
|
||||
count: 1
|
||||
path: src/Plugins/Schema/Pdf/PdfRelationSchema.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'Create_time' on mixed\\.$#"
|
||||
count: 1
|
||||
path: src/Plugins/Schema/Pdf/PdfRelationSchema.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'Update_time' on mixed\\.$#"
|
||||
count: 1
|
||||
path: src/Plugins/Schema/Pdf/PdfRelationSchema.php
|
||||
|
||||
-
|
||||
message: "#^Cannot access offset 'foreign_field' on mixed\\.$#"
|
||||
count: 1
|
||||
@ -13071,7 +13001,7 @@ parameters:
|
||||
path: src/Plugins/Schema/Pdf/PdfRelationSchema.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$datetime of function strtotime expects string, mixed given\\.$#"
|
||||
message: "#^Parameter \\#1 \\$datetime of function strtotime expects string, int\\|string given\\.$#"
|
||||
count: 3
|
||||
path: src/Plugins/Schema/Pdf/PdfRelationSchema.php
|
||||
|
||||
@ -13081,7 +13011,7 @@ parameters:
|
||||
path: src/Plugins/Schema/Pdf/PdfRelationSchema.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$timestamp of static method PhpMyAdmin\\\\Util\\:\\:localisedDate\\(\\) expects int, \\(int\\|false\\) given\\.$#"
|
||||
message: "#^Parameter \\#1 \\$timestamp of static method PhpMyAdmin\\\\Util\\:\\:localisedDate\\(\\) expects int, int\\|false given\\.$#"
|
||||
count: 3
|
||||
path: src/Plugins/Schema/Pdf/PdfRelationSchema.php
|
||||
|
||||
@ -15427,31 +15357,31 @@ parameters:
|
||||
|
||||
-
|
||||
message: "#^Cannot cast mixed to int\\.$#"
|
||||
count: 4
|
||||
count: 1
|
||||
path: src/Table/Table.php
|
||||
|
||||
-
|
||||
message: "#^Cannot cast mixed to string\\.$#"
|
||||
count: 3
|
||||
count: 2
|
||||
path: src/Table/Table.php
|
||||
|
||||
-
|
||||
message: "#^Construct empty\\(\\) is not allowed\\. Use more strict comparison\\.$#"
|
||||
count: 20
|
||||
count: 18
|
||||
path: src/Table/Table.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Table\\\\Table\\:\\:getAutoIncrement\\(\\) should return string but returns mixed\\.$#"
|
||||
message: "#^Method PhpMyAdmin\\\\Table\\\\Table\\:\\:getAutoIncrement\\(\\) should return string but returns int\\|string\\.$#"
|
||||
count: 1
|
||||
path: src/Table/Table.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Table\\\\Table\\:\\:getCollation\\(\\) should return string but returns mixed\\.$#"
|
||||
message: "#^Method PhpMyAdmin\\\\Table\\\\Table\\:\\:getCollation\\(\\) should return string but returns int\\|string\\.$#"
|
||||
count: 1
|
||||
path: src/Table/Table.php
|
||||
|
||||
-
|
||||
message: "#^Method PhpMyAdmin\\\\Table\\\\Table\\:\\:getComment\\(\\) should return string but returns mixed\\.$#"
|
||||
message: "#^Method PhpMyAdmin\\\\Table\\\\Table\\:\\:getComment\\(\\) should return string but returns int\\|string\\.$#"
|
||||
count: 1
|
||||
path: src/Table/Table.php
|
||||
|
||||
@ -15577,11 +15507,6 @@ parameters:
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, mixed given\\.$#"
|
||||
count: 2
|
||||
path: src/Table/Table.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$array of function array_key_exists expects array, mixed given\\.$#"
|
||||
count: 1
|
||||
path: src/Table/Table.php
|
||||
|
||||
@ -15607,7 +15532,7 @@ parameters:
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$string of function explode expects string, mixed given\\.$#"
|
||||
count: 3
|
||||
count: 2
|
||||
path: src/Table/Table.php
|
||||
|
||||
-
|
||||
|
||||
@ -2394,15 +2394,10 @@
|
||||
<code>$tableAlters</code>
|
||||
<code>is_array($partitionNames) ? $partitionNames : []</code>
|
||||
</MixedArgumentTypeCoercion>
|
||||
<MixedArrayAccess>
|
||||
<code><![CDATA[$showTable['Row_format']]]></code>
|
||||
</MixedArrayAccess>
|
||||
<MixedAssignment>
|
||||
<code><![CDATA[$GLOBALS['auto_increment']]]></code>
|
||||
<code><![CDATA[$GLOBALS['errorUrl']]]></code>
|
||||
<code><![CDATA[$GLOBALS['message_to_show']]]></code>
|
||||
<code>$showTable</code>
|
||||
<code>$showTable</code>
|
||||
</MixedAssignment>
|
||||
</file>
|
||||
<file src="src/Controllers/Operations/ViewController.php">
|
||||
@ -4088,47 +4083,34 @@
|
||||
<InvalidArrayOffset>
|
||||
<code><![CDATA[$GLOBALS['errorUrl']]]></code>
|
||||
</InvalidArrayOffset>
|
||||
<MixedArgument>
|
||||
<code><![CDATA[$showTable['Check_time']]]></code>
|
||||
<code><![CDATA[$showTable['Create_time']]]></code>
|
||||
<code><![CDATA[$showTable['Data_free']]]></code>
|
||||
<code><![CDATA[$showTable['Data_length']]]></code>
|
||||
<code><![CDATA[$showTable['Data_length']
|
||||
+ $showTable['Index_length']]]></code>
|
||||
<code><![CDATA[$showTable['Data_length']
|
||||
+ $showTable['Index_length']
|
||||
- $showTable['Data_free']]]></code>
|
||||
<code><![CDATA[$showTable['Data_length'] + $showTable['Index_length']]]></code>
|
||||
<code><![CDATA[$showTable['Index_length']]]></code>
|
||||
<code><![CDATA[$showTable['Name']]]></code>
|
||||
<code><![CDATA[$showTable['Update_time']]]></code>
|
||||
<code><![CDATA[($showTable['Data_length']
|
||||
+ $showTable['Index_length'])
|
||||
/ $showTable['Rows']]]></code>
|
||||
</MixedArgument>
|
||||
<MixedArrayAccess>
|
||||
<code><![CDATA[$showTable['Name']]]></code>
|
||||
<code><![CDATA[$showTable['Rows']]]></code>
|
||||
</MixedArrayAccess>
|
||||
<MixedArrayAssignment>
|
||||
<code><![CDATA[$showTable['Data_length']]]></code>
|
||||
<code><![CDATA[$showTable['Index_length']]]></code>
|
||||
</MixedArrayAssignment>
|
||||
<MixedAssignment>
|
||||
<code><![CDATA[$GLOBALS['errorUrl']]]></code>
|
||||
<code>$attributes[$rownum]</code>
|
||||
<code>$showTable</code>
|
||||
</MixedAssignment>
|
||||
<MixedOperand>
|
||||
<code><![CDATA[$displayedFields[$rownum]->icon]]></code>
|
||||
<code><![CDATA[$displayedFields[$rownum]->icon]]></code>
|
||||
<code><![CDATA[$showTable['Data_length']]]></code>
|
||||
<code><![CDATA[$showTable['Data_length']
|
||||
+ $showTable['Index_length']]]></code>
|
||||
<code><![CDATA[$showTable['Index_length']]]></code>
|
||||
<code><![CDATA[$showTable['Index_length']]]></code>
|
||||
<code><![CDATA[$showTable['Index_length']]]></code>
|
||||
</MixedOperand>
|
||||
<PossiblyInvalidArgument>
|
||||
<code><![CDATA[$showTable['Check_time']]]></code>
|
||||
<code><![CDATA[$showTable['Create_time']]]></code>
|
||||
<code><![CDATA[$showTable['Update_time']]]></code>
|
||||
</PossiblyInvalidArgument>
|
||||
<PossiblyInvalidOperand>
|
||||
<code><![CDATA[$showTable['Data_free']]]></code>
|
||||
<code><![CDATA[$showTable['Data_length']]]></code>
|
||||
<code><![CDATA[$showTable['Data_length']]]></code>
|
||||
<code><![CDATA[$showTable['Data_length']]]></code>
|
||||
<code><![CDATA[$showTable['Data_length']]]></code>
|
||||
<code><![CDATA[$showTable['Index_length']]]></code>
|
||||
<code><![CDATA[$showTable['Index_length']]]></code>
|
||||
<code><![CDATA[$showTable['Index_length']]]></code>
|
||||
<code><![CDATA[$showTable['Index_length']]]></code>
|
||||
<code><![CDATA[$showTable['Rows']]]></code>
|
||||
</PossiblyInvalidOperand>
|
||||
<PossiblyNullOperand>
|
||||
<code><![CDATA[$showTable['Rows']]]></code>
|
||||
</PossiblyNullOperand>
|
||||
</file>
|
||||
<file src="src/Controllers/Table/TrackingController.php">
|
||||
<DeprecatedMethod>
|
||||
@ -5521,7 +5503,6 @@
|
||||
<code>$query</code>
|
||||
<code>$rel</code>
|
||||
<code>$relationalDisplay</code>
|
||||
<code>$tableCreateTime</code>
|
||||
<code>$value</code>
|
||||
</MixedAssignment>
|
||||
<MixedInferredReturnType>
|
||||
@ -9798,9 +9779,6 @@
|
||||
<code><![CDATA[$oneKey['ref_table_name']]]></code>
|
||||
<code><![CDATA[$rel['foreign_field']]]></code>
|
||||
<code><![CDATA[$rel['foreign_table']]]></code>
|
||||
<code><![CDATA[$showTable['Check_time']]]></code>
|
||||
<code><![CDATA[$showTable['Create_time']]]></code>
|
||||
<code><![CDATA[$showTable['Update_time']]]></code>
|
||||
<code>$table</code>
|
||||
<code>$table</code>
|
||||
<code>$table</code>
|
||||
@ -9823,10 +9801,6 @@
|
||||
<code><![CDATA[$rel['foreign_field']]]></code>
|
||||
<code><![CDATA[$rel['foreign_table']]]></code>
|
||||
<code><![CDATA[$rel['foreign_table']]]></code>
|
||||
<code><![CDATA[$showTable['Check_time']]]></code>
|
||||
<code><![CDATA[$showTable['Comment']]]></code>
|
||||
<code><![CDATA[$showTable['Create_time']]]></code>
|
||||
<code><![CDATA[$showTable['Update_time']]]></code>
|
||||
<code><![CDATA[$this->pdf->customLinks['RT']['-']]]></code>
|
||||
<code><![CDATA[$this->pdf->customLinks['doc'][$foreigner['foreign_table']]]]></code>
|
||||
<code><![CDATA[$this->pdf->customLinks['doc'][$table]]]></code>
|
||||
@ -9864,8 +9838,6 @@
|
||||
<code>$oneField</code>
|
||||
<code>$oneKey</code>
|
||||
<code>$rel</code>
|
||||
<code>$showComment</code>
|
||||
<code>$showTable</code>
|
||||
<code>$table</code>
|
||||
<code>$table</code>
|
||||
<code>$type</code>
|
||||
@ -9876,12 +9848,14 @@
|
||||
<code><![CDATA[$foreigner['foreign_table']]]></code>
|
||||
<code><![CDATA[$foreigner['on_delete']]]></code>
|
||||
<code><![CDATA[$foreigner['on_update']]]></code>
|
||||
<code>$showComment</code>
|
||||
<code>$table</code>
|
||||
<code>$table</code>
|
||||
</MixedOperand>
|
||||
<PossiblyInvalidArgument>
|
||||
<code><![CDATA[$_REQUEST['pdf_table_order']]]></code>
|
||||
<code><![CDATA[$showTable['Check_time']]]></code>
|
||||
<code><![CDATA[$showTable['Create_time']]]></code>
|
||||
<code><![CDATA[$showTable['Update_time']]]></code>
|
||||
</PossiblyInvalidArgument>
|
||||
<PossiblyInvalidCast>
|
||||
<code><![CDATA[$_REQUEST['pdf_orientation']]]></code>
|
||||
@ -11580,12 +11554,20 @@
|
||||
<code><![CDATA[$GLOBALS['sql_auto_increments']]]></code>
|
||||
<code><![CDATA[$GLOBALS['sql_indexes']]]></code>
|
||||
</InvalidArrayOffset>
|
||||
<InvalidReturnStatement>
|
||||
<code><![CDATA[$tableAutoIncrement ?? '']]></code>
|
||||
<code><![CDATA[$this->getStatusInfo('TABLE_COLLATION') ?? '']]></code>
|
||||
<code><![CDATA[$this->getStatusInfo('TABLE_COMMENT') ?? '']]></code>
|
||||
</InvalidReturnStatement>
|
||||
<InvalidReturnType>
|
||||
<code>string</code>
|
||||
<code>string</code>
|
||||
<code>string</code>
|
||||
</InvalidReturnType>
|
||||
<MixedArgument>
|
||||
<code><![CDATA[$GLOBALS['sql_auto_increments']]]></code>
|
||||
<code><![CDATA[$GLOBALS['sql_indexes']]]></code>
|
||||
<code><![CDATA[$_POST['constraint_name'][$masterFieldMd5]]]></code>
|
||||
<code>$cachedResult</code>
|
||||
<code>$cachedResult</code>
|
||||
<code>$column</code>
|
||||
<code>$column</code>
|
||||
<code><![CDATA[$column['Extra']]]></code>
|
||||
@ -11621,7 +11603,6 @@
|
||||
<code><![CDATA[$optionsArray[$existrelForeign[$masterFieldMd5]['on_update'] ?? ''] ?? null]]></code>
|
||||
<code><![CDATA[$options['expr']]]></code>
|
||||
<code><![CDATA[$row['Type']]]></code>
|
||||
<code>$tableOptions</code>
|
||||
<code><![CDATA[$this->uiprefs[$property]]]></code>
|
||||
<code><![CDATA[$this->uiprefs[$property]]]></code>
|
||||
<code>$value</code>
|
||||
@ -11692,14 +11673,11 @@
|
||||
<code><![CDATA[$GLOBALS['errorUrl']]]></code>
|
||||
<code>$altered</code>
|
||||
<code>$altered</code>
|
||||
<code>$cachedResult</code>
|
||||
<code>$cachedResult</code>
|
||||
<code>$column</code>
|
||||
<code>$column</code>
|
||||
<code>$column</code>
|
||||
<code><![CDATA[$columns[$row['Field']]]]></code>
|
||||
<code>$constraintName</code>
|
||||
<code>$currCreateTime</code>
|
||||
<code>$eachCol</code>
|
||||
<code>$foreignDb</code>
|
||||
<code>$foreignDb</code>
|
||||
@ -11719,15 +11697,6 @@
|
||||
<code>$refDbName</code>
|
||||
<code>$ret[]</code>
|
||||
<code>$row</code>
|
||||
<code>$rowCount</code>
|
||||
<code>$tableAutoIncrement</code>
|
||||
<code>$tableCollation</code>
|
||||
<code>$tableComment</code>
|
||||
<code>$tableNumRowInfo</code>
|
||||
<code>$tableOptions</code>
|
||||
<code>$tableRowFormat</code>
|
||||
<code>$tableStorageEngine</code>
|
||||
<code>$type</code>
|
||||
<code>$value</code>
|
||||
<code>$value</code>
|
||||
<code>$value</code>
|
||||
@ -11736,9 +11705,6 @@
|
||||
<code>mixed[]</code>
|
||||
<code>string</code>
|
||||
<code>string</code>
|
||||
<code>string</code>
|
||||
<code>string</code>
|
||||
<code>string</code>
|
||||
</MixedInferredReturnType>
|
||||
<MixedMethodCall>
|
||||
<code>has</code>
|
||||
@ -11757,11 +11723,6 @@
|
||||
<code><![CDATA[$altered->options]]></code>
|
||||
</MixedPropertyFetch>
|
||||
<MixedReturnStatement>
|
||||
<code><![CDATA[$tableAutoIncrement ?? '']]></code>
|
||||
<code><![CDATA[$tableAutoIncrement ?? '']]></code>
|
||||
<code><![CDATA[$tableCollation ?? '']]></code>
|
||||
<code><![CDATA[$tableCollation ?? '']]></code>
|
||||
<code>$tableComment</code>
|
||||
<code><![CDATA[end($this->errors)]]></code>
|
||||
<code><![CDATA[end($this->messages)]]></code>
|
||||
<code>json_decode($value, true)</code>
|
||||
|
||||
@ -112,12 +112,6 @@ final class ImportController extends AbstractController
|
||||
// default values
|
||||
$GLOBALS['reload'] = false;
|
||||
|
||||
// Use to identify current cycle is executing
|
||||
// a multiquery statement or stored routine
|
||||
if (! isset($_SESSION['is_multi_query'])) {
|
||||
$_SESSION['is_multi_query'] = false;
|
||||
}
|
||||
|
||||
$GLOBALS['ajax_reload'] = [];
|
||||
$GLOBALS['import_text'] = '';
|
||||
// Are we just executing plain query or sql file?
|
||||
@ -678,9 +672,7 @@ final class ImportController extends AbstractController
|
||||
}
|
||||
|
||||
if ($GLOBALS['go_sql']) {
|
||||
if ($queriesToBeExecuted !== []) {
|
||||
$_SESSION['is_multi_query'] = true;
|
||||
} else {
|
||||
if ($queriesToBeExecuted === []) {
|
||||
$queriesToBeExecuted = [$GLOBALS['sql_query']];
|
||||
}
|
||||
|
||||
|
||||
@ -118,7 +118,7 @@ class TableController extends AbstractController
|
||||
*/
|
||||
$this->dbi->selectDb(Current::$database);
|
||||
|
||||
$showTable = $pmaTable->getStatusInfo();
|
||||
$rowFormat = $pmaTable->getStatusInfo('Row_format');
|
||||
if ($pmaTable->isView()) {
|
||||
$tableIsAView = true;
|
||||
$tableStorageEngine = __('View');
|
||||
@ -327,7 +327,7 @@ class TableController extends AbstractController
|
||||
// a change, clear the cache
|
||||
$this->dbi->getCache()->clearTableCache();
|
||||
$this->dbi->selectDb(Current::$database);
|
||||
$showTable = $pmaTable->getStatusInfo(forceRead: true);
|
||||
$rowFormat = $pmaTable->getStatusInfo('Row_format');
|
||||
if ($pmaTable->isView()) {
|
||||
$tableIsAView = true;
|
||||
$tableStorageEngine = __('View');
|
||||
@ -501,7 +501,7 @@ class TableController extends AbstractController
|
||||
'collations' => $collations,
|
||||
'tbl_collation' => $tableCollation,
|
||||
'row_formats' => $possibleRowFormats[$tableStorageEngine] ?? [],
|
||||
'row_format_current' => $showTable['Row_format'],
|
||||
'row_format_current' => $rowFormat,
|
||||
'has_auto_increment' => $hasAutoIncrement,
|
||||
'auto_increment' => $GLOBALS['auto_increment'],
|
||||
'has_pack_keys' => $hasPackKeys,
|
||||
|
||||
@ -39,7 +39,6 @@ use stdClass;
|
||||
|
||||
use function __;
|
||||
use function in_array;
|
||||
use function is_string;
|
||||
use function str_contains;
|
||||
use function strtotime;
|
||||
|
||||
@ -49,7 +48,7 @@ use function strtotime;
|
||||
*/
|
||||
class StructureController extends AbstractController
|
||||
{
|
||||
protected readonly Table $tableObj;
|
||||
private readonly Table $tableObj;
|
||||
|
||||
public function __construct(
|
||||
ResponseRenderer $response,
|
||||
@ -151,7 +150,7 @@ class StructureController extends AbstractController
|
||||
* @param (string|int)[] $columnsWithIndex Columns with index
|
||||
* @psalm-param non-empty-string $route
|
||||
*/
|
||||
protected function displayStructure(
|
||||
private function displayStructure(
|
||||
RelationParameters $relationParameters,
|
||||
array $columnsWithUniqueIndex,
|
||||
Index|null $primaryIndex,
|
||||
@ -293,17 +292,14 @@ class StructureController extends AbstractController
|
||||
/**
|
||||
* Get HTML snippet for display table statistics
|
||||
*/
|
||||
protected function getTableStats(
|
||||
private function getTableStats(
|
||||
bool $isSystemSchema,
|
||||
bool $tableIsAView,
|
||||
string $tableStorageEngine,
|
||||
): string {
|
||||
$showTable = $this->dbi->getTable(Current::$database, Current::$table)->getStatusInfo(forceRead: true);
|
||||
$tableInfoNunRows = $this->tableObj->getNumRows($showTable['Name']);
|
||||
|
||||
if (is_string($showTable)) {
|
||||
$showTable = [];
|
||||
}
|
||||
// Clear the cache as some table information might have gotten changed due to the user action.
|
||||
$this->dbi->getCache()->clearTableCache();
|
||||
$showTable = $this->tableObj->getStatusInfo();
|
||||
|
||||
if (empty($showTable['Data_length'])) {
|
||||
$showTable['Data_length'] = 0;
|
||||
@ -352,7 +348,7 @@ class StructureController extends AbstractController
|
||||
|
||||
$avgSize = '';
|
||||
$avgUnit = '';
|
||||
if ($tableInfoNunRows > 0) {
|
||||
if ($this->tableObj->getNumRows() > 0) {
|
||||
[$avgSize, $avgUnit] = Util::formatByteDown(
|
||||
($showTable['Data_length']
|
||||
+ $showTable['Index_length'])
|
||||
@ -392,7 +388,6 @@ class StructureController extends AbstractController
|
||||
'db' => Current::$database,
|
||||
'table' => Current::$table,
|
||||
'showtable' => $showTable,
|
||||
'table_info_num_rows' => $tableInfoNunRows,
|
||||
'tbl_is_view' => $tableIsAView,
|
||||
'db_is_system_schema' => $isSystemSchema,
|
||||
'tbl_storage_engine' => $tableStorageEngine,
|
||||
|
||||
@ -537,11 +537,7 @@ class PdfRelationSchema extends ExportRelationSchema
|
||||
$mimeMap = $this->transformations->getMime($this->db->getName(), $table, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets table information
|
||||
*/
|
||||
$showTable = $dbi->getTable($this->db->getName(), $table)
|
||||
->getStatusInfo();
|
||||
$showTable = $dbi->getTable($this->db->getName(), $table)->getStatusInfo();
|
||||
$showComment = $showTable['Comment'] ?? '';
|
||||
$createTime = isset($showTable['Create_time'])
|
||||
? Util::localisedDate(
|
||||
|
||||
@ -4,8 +4,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Query;
|
||||
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
/**
|
||||
* Handles caching results
|
||||
*/
|
||||
@ -46,14 +44,19 @@ class Cache
|
||||
/**
|
||||
* Get a cached value from table cache.
|
||||
*
|
||||
* @param (int|string)[] $contentPath Array of the name of the target value
|
||||
* @param mixed $default Return value on cache miss
|
||||
* @param T $key
|
||||
*
|
||||
* @return mixed cached value or default
|
||||
* @return (T is null ? (string|int|null)[] : (string|int|null))|null
|
||||
*
|
||||
* @template T of string|null
|
||||
*/
|
||||
public function getCachedTableContent(array $contentPath, mixed $default = null): mixed
|
||||
public function getCachedTableContent(string $db, string $table, string|null $key = null): array|string|int|null
|
||||
{
|
||||
return Util::getValueByKey($this->tableCache, $contentPath, $default);
|
||||
if ($key === null) {
|
||||
return $this->tableCache[$db][$table] ?? null;
|
||||
}
|
||||
|
||||
return $this->tableCache[$db][$table][$key] ?? null;
|
||||
}
|
||||
|
||||
public function clearTableCache(): void
|
||||
|
||||
@ -1088,7 +1088,6 @@ class Sql
|
||||
);
|
||||
}
|
||||
|
||||
$_SESSION['is_multi_query'] = false;
|
||||
$displayResultsObject->setProperties(
|
||||
$unlimNumRows,
|
||||
$this->dbi->getFieldsMeta($result),
|
||||
|
||||
@ -34,7 +34,6 @@ use PhpMyAdmin\Util;
|
||||
use Stringable;
|
||||
|
||||
use function __;
|
||||
use function array_key_exists;
|
||||
use function array_keys;
|
||||
use function array_map;
|
||||
use function array_merge;
|
||||
@ -64,11 +63,8 @@ use function strtolower;
|
||||
use function strtoupper;
|
||||
use function substr;
|
||||
use function substr_compare;
|
||||
use function trigger_error;
|
||||
use function trim;
|
||||
|
||||
use const E_USER_WARNING;
|
||||
|
||||
/**
|
||||
* Handles everything related to tables
|
||||
*
|
||||
@ -222,7 +218,7 @@ class Table implements Stringable
|
||||
|
||||
// use cached data or load information with SHOW command
|
||||
if (
|
||||
$this->dbi->getCache()->getCachedTableContent([$this->dbName, $this->name]) != null
|
||||
$this->dbi->getCache()->getCachedTableContent($this->dbName, $this->name) !== null
|
||||
|| Config::getInstance()->selectedServer['DisableIS']
|
||||
) {
|
||||
$type = $this->getStatusInfo('TABLE_TYPE');
|
||||
@ -277,54 +273,34 @@ class Table implements Stringable
|
||||
* Returns full table status info, or specific if $info provided
|
||||
* this info is collected from information_schema
|
||||
*
|
||||
* @param string|null $info specific information to be fetched
|
||||
* @param bool $forceRead read new rather than serving from cache
|
||||
* @param bool $disableError if true, disables error message
|
||||
* @param T $info specific information to be fetched
|
||||
*
|
||||
* @todo DatabaseInterface::getTablesFull needs to be merged
|
||||
* somehow into this class or at least better documented
|
||||
* @return (T is null ? (string|int|null)[]|null : (string|int|null))
|
||||
*
|
||||
* @template T of string|null
|
||||
*/
|
||||
public function getStatusInfo(
|
||||
string|null $info = null,
|
||||
bool $forceRead = false,
|
||||
bool $disableError = false,
|
||||
): mixed {
|
||||
if (! empty($_SESSION['is_multi_query'])) {
|
||||
$disableError = true;
|
||||
}
|
||||
|
||||
$cachedResult = $this->dbi->getCache()->getCachedTableContent([$this->dbName, $this->name]);
|
||||
public function getStatusInfo(string|null $info = null): array|string|int|null
|
||||
{
|
||||
$cachedResult = $this->dbi->getCache()->getCachedTableContent($this->dbName, $this->name);
|
||||
|
||||
// sometimes there is only one entry (ExactRows) so
|
||||
// we have to get the table's details
|
||||
if ($cachedResult === null || $forceRead || count($cachedResult) === 1) {
|
||||
if ($cachedResult === null || count($cachedResult) === 1) {
|
||||
$this->dbi->getTablesFull($this->dbName, $this->name);
|
||||
$cachedResult = $this->dbi->getCache()->getCachedTableContent([$this->dbName, $this->name]);
|
||||
$cachedResult = $this->dbi->getCache()->getCachedTableContent($this->dbName, $this->name);
|
||||
}
|
||||
|
||||
if ($cachedResult === null) {
|
||||
// happens when we enter the table creation dialog
|
||||
// or when we really did not get any status info, for example
|
||||
// when $table === 'TABLE_NAMES' after the user tried SHOW TABLES
|
||||
return '';
|
||||
return null;
|
||||
}
|
||||
|
||||
if ($info === null) {
|
||||
return $cachedResult;
|
||||
}
|
||||
|
||||
// array_key_exists allows for null values
|
||||
if (! array_key_exists($info, $cachedResult)) {
|
||||
if (! $disableError) {
|
||||
trigger_error(
|
||||
__('Unknown table status:') . ' ' . $info,
|
||||
E_USER_WARNING,
|
||||
);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return $cachedResult[$info];
|
||||
}
|
||||
|
||||
@ -336,7 +312,7 @@ class Table implements Stringable
|
||||
*/
|
||||
public function getStorageEngine(): string
|
||||
{
|
||||
$tableStorageEngine = $this->getStatusInfo('ENGINE', false, true);
|
||||
$tableStorageEngine = $this->getStatusInfo('ENGINE');
|
||||
|
||||
return strtoupper((string) $tableStorageEngine);
|
||||
}
|
||||
@ -348,12 +324,7 @@ class Table implements Stringable
|
||||
*/
|
||||
public function getComment(): string
|
||||
{
|
||||
$tableComment = $this->getStatusInfo('TABLE_COMMENT', false, true);
|
||||
if ($tableComment === false) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $tableComment;
|
||||
return $this->getStatusInfo('TABLE_COMMENT') ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -363,12 +334,7 @@ class Table implements Stringable
|
||||
*/
|
||||
public function getCollation(): string
|
||||
{
|
||||
$tableCollation = $this->getStatusInfo('TABLE_COLLATION', false, true);
|
||||
if ($tableCollation === false) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $tableCollation ?? '';
|
||||
return $this->getStatusInfo('TABLE_COLLATION') ?? '';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -376,15 +342,9 @@ class Table implements Stringable
|
||||
*
|
||||
* @return int Return no of rows info if it is not null for the selected table or return 0.
|
||||
*/
|
||||
public function getNumRows(string $showTableName): int
|
||||
public function getNumRows(): int
|
||||
{
|
||||
$tableNumRowInfo = $this->getStatusInfo('TABLE_ROWS', false, true);
|
||||
if ($tableNumRowInfo === false) {
|
||||
$tableNumRowInfo = $this->dbi->getTable($this->dbName, $showTableName)
|
||||
->countRecords(true);
|
||||
}
|
||||
|
||||
return (int) $tableNumRowInfo;
|
||||
return (int) $this->getStatusInfo('TABLE_ROWS');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -394,7 +354,7 @@ class Table implements Stringable
|
||||
*/
|
||||
public function getRowFormat(): string
|
||||
{
|
||||
$tableRowFormat = $this->getStatusInfo('ROW_FORMAT', false, true);
|
||||
$tableRowFormat = $this->getStatusInfo('ROW_FORMAT');
|
||||
|
||||
return is_string($tableRowFormat) ? $tableRowFormat : '';
|
||||
}
|
||||
@ -406,7 +366,7 @@ class Table implements Stringable
|
||||
*/
|
||||
public function getAutoIncrement(): string
|
||||
{
|
||||
$tableAutoIncrement = $this->getStatusInfo('AUTO_INCREMENT', false, true);
|
||||
$tableAutoIncrement = $this->getStatusInfo('AUTO_INCREMENT');
|
||||
|
||||
return $tableAutoIncrement ?? '';
|
||||
}
|
||||
@ -418,8 +378,8 @@ class Table implements Stringable
|
||||
*/
|
||||
public function getCreateOptions(): array
|
||||
{
|
||||
$tableOptions = $this->getStatusInfo('CREATE_OPTIONS', false, true);
|
||||
$createOptionsTmp = empty($tableOptions) ? [] : explode(' ', $tableOptions);
|
||||
$tableOptions = $this->getStatusInfo('CREATE_OPTIONS');
|
||||
$createOptionsTmp = is_string($tableOptions) && $tableOptions !== '' ? explode(' ', $tableOptions) : [];
|
||||
$createOptions = [];
|
||||
// export create options by its name as variables into global namespace
|
||||
// f.e. pack_keys=1 becomes available as $pack_keys with value of '1'
|
||||
@ -689,7 +649,7 @@ class Table implements Stringable
|
||||
$isView = $this->isView();
|
||||
$cache = $this->dbi->getCache();
|
||||
|
||||
$exactRowsCached = $cache->getCachedTableContent([$this->dbName, $this->name, 'ExactRows']);
|
||||
$exactRowsCached = $cache->getCachedTableContent($this->dbName, $this->name, 'ExactRows');
|
||||
if ($exactRowsCached !== null) {
|
||||
return (int) $exactRowsCached;
|
||||
}
|
||||
@ -697,11 +657,11 @@ class Table implements Stringable
|
||||
$rowCount = null;
|
||||
|
||||
if (! $forceExact) {
|
||||
if (($cache->getCachedTableContent([$this->dbName, $this->name, 'Rows']) === null) && ! $isView) {
|
||||
if (($cache->getCachedTableContent($this->dbName, $this->name, 'Rows') === null) && ! $isView) {
|
||||
$this->dbi->getTablesFull($this->dbName, $this->name);
|
||||
}
|
||||
|
||||
$rowCount = $cache->getCachedTableContent([$this->dbName, $this->name, 'Rows']);
|
||||
$rowCount = $cache->getCachedTableContent($this->dbName, $this->name, 'Rows');
|
||||
}
|
||||
|
||||
// for a VIEW, $row_count is always false at this point
|
||||
@ -1800,7 +1760,7 @@ class Table implements Stringable
|
||||
// we want to save the create time if the property is PROP_COLUMN_ORDER
|
||||
if (! $this->isView() && ($property == self::PROP_COLUMN_ORDER || $property == self::PROP_COLUMN_VISIB)) {
|
||||
$currCreateTime = $this->getStatusInfo('CREATE_TIME');
|
||||
if (! isset($tableCreateTime) || $tableCreateTime != $currCreateTime) {
|
||||
if ($tableCreateTime === null || $tableCreateTime != $currCreateTime) {
|
||||
// there is no $table_create_time, or
|
||||
// supplied $table_create_time is older than current create time,
|
||||
// so don't save
|
||||
|
||||
@ -1446,7 +1446,7 @@ class TableTest extends AbstractTestCase
|
||||
$extension = new DbiDummy();
|
||||
$dbi = new DatabaseInterface($extension);
|
||||
$tblObject = new Table($targetTable, $targetDb, $dbi);
|
||||
$tblObject->getStatusInfo(null, true);
|
||||
$tblObject->getStatusInfo(null);
|
||||
$expect = 'DBIDUMMY';
|
||||
$tblStorageEngine = $dbi->getTable($targetDb, $targetTable)->getStorageEngine();
|
||||
$this->assertEquals($expect, $tblStorageEngine);
|
||||
@ -1462,7 +1462,7 @@ class TableTest extends AbstractTestCase
|
||||
$extension = new DbiDummy();
|
||||
$dbi = new DatabaseInterface($extension);
|
||||
$tblObject = new Table($targetTable, $targetDb, $dbi);
|
||||
$tblObject->getStatusInfo(null, true);
|
||||
$tblObject->getStatusInfo(null);
|
||||
$expect = 'Test comment for "table1" in \'pma_test\'';
|
||||
$showComment = $dbi->getTable($targetDb, $targetTable)->getComment();
|
||||
$this->assertEquals($expect, $showComment);
|
||||
@ -1478,7 +1478,7 @@ class TableTest extends AbstractTestCase
|
||||
$extension = new DbiDummy();
|
||||
$dbi = new DatabaseInterface($extension);
|
||||
$tblObject = new Table($targetTable, $targetDb, $dbi);
|
||||
$tblObject->getStatusInfo(null, true);
|
||||
$tblObject->getStatusInfo(null);
|
||||
$expect = 'utf8mb4_general_ci';
|
||||
$tblCollation = $dbi->getTable($targetDb, $targetTable)->getCollation();
|
||||
$this->assertEquals($expect, $tblCollation);
|
||||
@ -1494,7 +1494,7 @@ class TableTest extends AbstractTestCase
|
||||
$extension = new DbiDummy();
|
||||
$dbi = new DatabaseInterface($extension);
|
||||
$tblObject = new Table($targetTable, $targetDb, $dbi);
|
||||
$tblObject->getStatusInfo(null, true);
|
||||
$tblObject->getStatusInfo(null);
|
||||
$expect = 'Redundant';
|
||||
$rowFormat = $dbi->getTable($targetDb, $targetTable)->getRowFormat();
|
||||
$this->assertEquals($expect, $rowFormat);
|
||||
@ -1510,7 +1510,7 @@ class TableTest extends AbstractTestCase
|
||||
$extension = new DbiDummy();
|
||||
$dbi = new DatabaseInterface($extension);
|
||||
$tblObject = new Table($targetTable, $targetDb, $dbi);
|
||||
$tblObject->getStatusInfo(null, true);
|
||||
$tblObject->getStatusInfo(null);
|
||||
$expect = '5';
|
||||
$autoIncrement = $dbi->getTable($targetDb, $targetTable)->getAutoIncrement();
|
||||
$this->assertEquals($expect, $autoIncrement);
|
||||
@ -1526,7 +1526,7 @@ class TableTest extends AbstractTestCase
|
||||
$extension = new DbiDummy();
|
||||
$dbi = new DatabaseInterface($extension);
|
||||
$tblObject = new Table($targetTable, $targetDb, $dbi);
|
||||
$tblObject->getStatusInfo(null, true);
|
||||
$tblObject->getStatusInfo(null);
|
||||
$expect = ['pack_keys' => 'DEFAULT', 'row_format' => 'REDUNDANT'];
|
||||
$createOptions = $dbi->getTable($targetDb, $targetTable)->getCreateOptions();
|
||||
$this->assertEquals($expect, $createOptions);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user