Visitar URL original
Merge branch 'QA_5_2' · phpmyadmin/phpmyadmin@081d6c1 · GitHub
Skip to content

Commit 081d6c1

Browse files
committed
Merge branch 'QA_5_2'
Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
2 parents 3355837 + 9ee8e20 commit 081d6c1

6 files changed

Lines changed: 9 additions & 38 deletions

File tree

‎phpstan-baseline.neon‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2520,7 +2520,7 @@ parameters:
25202520
-
25212521
message: '#^Loose comparison via "\=\=" is not allowed\.$#'
25222522
identifier: equal.notAllowed
2523-
count: 5
2523+
count: 3
25242524
path: src/Controllers/Database/StructureController.php
25252525

25262526
-
@@ -16081,7 +16081,7 @@ parameters:
1608116081
path: src/Sql.php
1608216082

1608316083
-
16084-
message: '#^Parameter \#9 \$queryTime of method PhpMyAdmin\\Display\\Results\:\:setProperties\(\) expects float, mixed given\.$#'
16084+
message: '#^Parameter \#8 \$queryTime of method PhpMyAdmin\\Display\\Results\:\:setProperties\(\) expects float, mixed given\.$#'
1608516085
identifier: argument.type
1608616086
count: 2
1608716087
path: src/Sql.php

‎src/Display/DisplayParts.php‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ private function __construct(
1515
public bool $hasBookmarkForm,
1616
public bool $hasTextButton,
1717
public bool $hasPrintLink,
18-
public bool $hasQueryStats,
1918
) {
2019
}
2120

@@ -28,8 +27,7 @@ private function __construct(
2827
* hasNavigationBar?: bool,
2928
* hasBookmarkForm?: bool,
3029
* hasTextButton?: bool,
31-
* hasPrintLink?: bool,
32-
* hasQueryStats?: bool
30+
* hasPrintLink?: bool
3331
* } $parts
3432
*/
3533
public static function fromArray(array $parts): self
@@ -42,7 +40,6 @@ public static function fromArray(array $parts): self
4240
$parts['hasBookmarkForm'] ?? false,
4341
$parts['hasTextButton'] ?? false,
4442
$parts['hasPrintLink'] ?? false,
45-
$parts['hasQueryStats'] ?? false,
4643
);
4744
}
4845

@@ -55,8 +52,7 @@ public static function fromArray(array $parts): self
5552
* hasNavigationBar?: bool,
5653
* hasBookmarkForm?: bool,
5754
* hasTextButton?: bool,
58-
* hasPrintLink?: bool,
59-
* hasQueryStats?: bool
55+
* hasPrintLink?: bool
6056
* } $parts
6157
*/
6258
public function with(array $parts): self
@@ -69,7 +65,6 @@ public function with(array $parts): self
6965
$parts['hasBookmarkForm'] ?? $this->hasBookmarkForm,
7066
$parts['hasTextButton'] ?? $this->hasTextButton,
7167
$parts['hasPrintLink'] ?? $this->hasPrintLink,
72-
$parts['hasQueryStats'] ?? $this->hasQueryStats,
7368
);
7469
}
7570
}

‎src/Display/Results.php‎

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ class Results
163163
private bool $editable = false;
164164
private bool $printView = false;
165165
private bool $isCount = false;
166-
private bool $isGroup = false;
167166
private bool $isExport = false;
168167
private bool $isFunction = false;
169168
private bool $isAnalyse = false;
@@ -317,7 +316,6 @@ private function setDefaultTransformations(): void
317316
* any appended "LIMIT" clause programmatically
318317
* @param FieldMetadata[] $fieldsMeta meta information about fields
319318
* @param bool $isCount statement is SELECT COUNT
320-
* @param bool $isGroup statement has GROUP BY
321319
* @param bool $isExport statement contains INTO OUTFILE
322320
* @param bool $isFunction statement contains a function like SUM()
323321
* @param bool $isAnalyse statement contains PROCEDURE ANALYSE
@@ -336,7 +334,6 @@ public function setProperties(
336334
int|string $unlimNumRows,
337335
array $fieldsMeta,
338336
bool $isCount,
339-
bool $isGroup,
340337
bool $isExport,
341338
bool $isFunction,
342339
bool $isAnalyse,
@@ -352,7 +349,6 @@ public function setProperties(
352349
$this->unlimNumRows = $unlimNumRows;
353350
$this->fieldsMeta = $fieldsMeta;
354351
$this->isCount = $isCount;
355-
$this->isGroup = $isGroup;
356352
$this->isExport = $isExport;
357353
$this->isFunction = $isFunction;
358354
$this->isAnalyse = $isAnalyse;
@@ -379,7 +375,6 @@ private function setDisplayPartsForPrintView(DisplayParts $displayParts): Displa
379375
'hasBookmarkForm' => false,
380376
'hasTextButton' => false,
381377
'hasPrintLink' => false,
382-
'hasQueryStats' => true,
383378
]);
384379
}
385380

@@ -409,7 +404,6 @@ private function setDisplayPartsForShow(DisplayParts $displayParts): DisplayPart
409404
'hasBookmarkForm' => true,
410405
'hasTextButton' => true,
411406
'hasPrintLink' => true,
412-
'hasQueryStats' => false,
413407
]);
414408
}
415409

@@ -429,7 +423,6 @@ private function setDisplayPartsForNonData(DisplayParts $displayParts): DisplayP
429423
'hasBookmarkForm' => true,
430424
'hasTextButton' => $this->isMaintenance,
431425
'hasPrintLink' => true,
432-
'hasQueryStats' => false,
433426
]);
434427
}
435428

@@ -502,7 +495,7 @@ private function setDisplayPartsAndTotal(DisplayParts $displayParts): array
502495
// 2. Updates the display parts
503496
if ($this->printView) {
504497
$displayParts = $this->setDisplayPartsForPrintView($displayParts);
505-
} elseif ($this->isAnalyse || $this->isMaintenance || $this->isExplain) {
498+
} elseif ($this->isCount || $this->isAnalyse || $this->isMaintenance || $this->isExplain) {
506499
$displayParts = $this->setDisplayPartsForNonData($displayParts);
507500
} elseif ($this->isShow) {
508501
$displayParts = $this->setDisplayPartsForShow($displayParts);
@@ -523,8 +516,8 @@ private function setDisplayPartsAndTotal(DisplayParts $displayParts): array
523516

524517
// if for COUNT query, number of rows returned more than 1
525518
// (may be being used GROUP BY)
526-
if ($this->isCount && ! $this->isGroup) {
527-
$displayParts = $displayParts->with(['hasNavigationBar' => false, 'hasSortLink' => false]);
519+
if ($this->isCount && $this->numRows > 1) {
520+
$displayParts = $displayParts->with(['hasNavigationBar' => true, 'hasSortLink' => true]);
528521
}
529522

530523
// 4. If navigation bar or sorting fields names URLs should be
@@ -3089,7 +3082,7 @@ public function getTable(
30893082
// 1.2 Defines offsets for the next and previous pages
30903083
$posNext = 0;
30913084
$posPrev = 0;
3092-
if ($displayParts->hasNavigationBar || $displayParts->hasQueryStats) {
3085+
if ($displayParts->hasNavigationBar) {
30933086
[$posNext, $posPrev] = $this->getOffsets();
30943087
}
30953088

@@ -3122,7 +3115,7 @@ public function getTable(
31223115

31233116
// 2.1 Prepares a messages with position information
31243117
$sqlQueryMessage = '';
3125-
if ($displayParts->hasQueryStats && $total > 0) {
3118+
if ($displayParts->hasNavigationBar) {
31263119
$message = $this->setMessageInformation(
31273120
$sortedColumnMessage,
31283121
$statementInfo,

‎src/Sql.php‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,6 @@ private function getQueryResponseForNoResultsReturned(
980980
'hasBookmarkForm' => true,
981981
'hasTextButton' => true,
982982
'hasPrintLink' => true,
983-
'hasQueryStats' => true,
984983
]);
985984

986985
$sqlQueryResultsTable = $this->getHtmlForSqlQueryResultsTable(
@@ -1106,7 +1105,6 @@ private function getHtmlForSqlQueryResultsTable(
11061105
$unlimNumRows,
11071106
$this->dbi->getFieldsMeta($result),
11081107
$statementInfo->flags->isCount,
1109-
$statementInfo->flags->isGroup,
11101108
$statementInfo->flags->isExport,
11111109
$statementInfo->flags->isFunc,
11121110
$statementInfo->flags->isAnalyse,
@@ -1142,7 +1140,6 @@ private function getHtmlForStoredProcedureResults(
11421140
$numRows,
11431141
$this->dbi->getFieldsMeta($result),
11441142
$statementInfo->flags->isCount,
1145-
$statementInfo->flags->isGroup,
11461143
$statementInfo->flags->isExport,
11471144
$statementInfo->flags->isFunc,
11481145
$statementInfo->flags->isAnalyse,
@@ -1164,7 +1161,6 @@ private function getHtmlForStoredProcedureResults(
11641161
'hasBookmarkForm' => true,
11651162
'hasTextButton' => true,
11661163
'hasPrintLink' => true,
1167-
'hasQueryStats' => true,
11681164
]);
11691165

11701166
$tableHtml .= $displayResultsObject->getTable(
@@ -1347,7 +1343,6 @@ private function getQueryResponseForResultsReturned(
13471343
'hasBookmarkForm' => true,
13481344
'hasTextButton' => false,
13491345
'hasPrintLink' => true,
1350-
'hasQueryStats' => true,
13511346
]);
13521347

13531348
if (! $editable) {
@@ -1359,7 +1354,6 @@ private function getQueryResponseForResultsReturned(
13591354
'hasBookmarkForm' => true,
13601355
'hasTextButton' => true,
13611356
'hasPrintLink' => true,
1362-
'hasQueryStats' => true,
13631357
]);
13641358
}
13651359

@@ -1372,7 +1366,6 @@ private function getQueryResponseForResultsReturned(
13721366
'hasBookmarkForm' => false,
13731367
'hasTextButton' => false,
13741368
'hasPrintLink' => false,
1375-
'hasQueryStats' => false,
13761369
]);
13771370
}
13781371

‎tests/unit/Display/DisplayPartsTest.php‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ public function testFromArray(): void
2222
'hasBookmarkForm' => true,
2323
'hasTextButton' => true,
2424
'hasPrintLink' => true,
25-
'hasQueryStats' => true,
2625
]);
2726
self::assertTrue($displayParts->hasEditLink);
2827
self::assertSame(DeleteLinkEnum::DELETE_ROW, $displayParts->deleteLink);
@@ -31,7 +30,6 @@ public function testFromArray(): void
3130
self::assertTrue($displayParts->hasBookmarkForm);
3231
self::assertTrue($displayParts->hasTextButton);
3332
self::assertTrue($displayParts->hasPrintLink);
34-
self::assertTrue($displayParts->hasQueryStats);
3533
}
3634

3735
public function testWith(): void
@@ -44,7 +42,6 @@ public function testWith(): void
4442
self::assertFalse($displayParts->hasBookmarkForm);
4543
self::assertFalse($displayParts->hasTextButton);
4644
self::assertFalse($displayParts->hasPrintLink);
47-
self::assertFalse($displayParts->hasQueryStats);
4845

4946
$displayParts = $displayParts->with([
5047
'hasEditLink' => true,
@@ -54,7 +51,6 @@ public function testWith(): void
5451
'hasBookmarkForm' => true,
5552
'hasTextButton' => true,
5653
'hasPrintLink' => true,
57-
'hasQueryStats' => true,
5854
]);
5955
self::assertTrue($displayParts->hasEditLink);
6056
self::assertSame(DeleteLinkEnum::KILL_PROCESS, $displayParts->deleteLink);
@@ -63,7 +59,6 @@ public function testWith(): void
6359
self::assertTrue($displayParts->hasBookmarkForm);
6460
self::assertTrue($displayParts->hasTextButton);
6561
self::assertTrue($displayParts->hasPrintLink);
66-
self::assertTrue($displayParts->hasQueryStats);
6762

6863
$displayParts = $displayParts->with([]);
6964
self::assertTrue($displayParts->hasEditLink);
@@ -73,6 +68,5 @@ public function testWith(): void
7368
self::assertTrue($displayParts->hasBookmarkForm);
7469
self::assertTrue($displayParts->hasTextButton);
7570
self::assertTrue($displayParts->hasPrintLink);
76-
self::assertTrue($displayParts->hasQueryStats);
7771
}
7872
}

‎tests/unit/Display/ResultsTest.php‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,7 +1178,6 @@ public function testGetTable(): void
11781178
3,
11791179
$fieldsMeta,
11801180
$statementInfo->flags->isCount,
1181-
$statementInfo->flags->isGroup,
11821181
$statementInfo->flags->isExport,
11831182
$statementInfo->flags->isFunc,
11841183
$statementInfo->flags->isAnalyse,
@@ -1215,7 +1214,6 @@ public function testGetTable(): void
12151214
'hasBookmarkForm' => true,
12161215
'hasTextButton' => false,
12171216
'hasPrintLink' => true,
1218-
'hasQueryStats' => true,
12191217
]);
12201218

12211219
self::assertNotFalse($dtResult);
@@ -1472,7 +1470,6 @@ public function testGetTable2(): void
14721470
2,
14731471
$fieldsMeta,
14741472
$statementInfo->flags->isCount,
1475-
$statementInfo->flags->isGroup,
14761473
$statementInfo->flags->isExport,
14771474
$statementInfo->flags->isFunc,
14781475
$statementInfo->flags->isAnalyse,
@@ -1509,7 +1506,6 @@ public function testGetTable2(): void
15091506
'hasBookmarkForm' => true,
15101507
'hasTextButton' => false,
15111508
'hasPrintLink' => true,
1512-
'hasQueryStats' => true,
15131509
]);
15141510

15151511
self::assertNotFalse($dtResult);

0 commit comments

Comments
 (0)