Skip to content

Commit 525009b

Browse files
kamil-tekielaMauricioFauth
authored andcommitted
Remove localised_date Twig extension
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
1 parent 3a78383 commit 525009b

5 files changed

Lines changed: 24 additions & 7 deletions

File tree

libraries/classes/Controllers/Table/StructureController.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
use function in_array;
3535
use function is_string;
3636
use function str_contains;
37+
use function strtotime;
3738

3839
/**
3940
* Displays table structure infos like columns, indexes, size, rows
@@ -361,6 +362,18 @@ protected function getTableStats(bool $isSystemSchema): string
361362
];
362363
}
363364

365+
if (isset($GLOBALS['showtable']['Create_time'])) {
366+
$GLOBALS['showtable']['Create_time'] = Util::localisedDate(strtotime($GLOBALS['showtable']['Create_time']));
367+
}
368+
369+
if (isset($GLOBALS['showtable']['Update_time'])) {
370+
$GLOBALS['showtable']['Update_time'] = Util::localisedDate(strtotime($GLOBALS['showtable']['Update_time']));
371+
}
372+
373+
if (isset($GLOBALS['showtable']['Check_time'])) {
374+
$GLOBALS['showtable']['Check_time'] = Util::localisedDate(strtotime($GLOBALS['showtable']['Check_time']));
375+
}
376+
364377
return $this->template->render('table/structure/display_table_stats', [
365378
'db' => $GLOBALS['db'],
366379
'table' => $GLOBALS['table'],

libraries/classes/Twig/UtilExtension.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,6 @@ public function getFunctions(): array
100100
Generator::linkToVarDocumentation(...),
101101
['is_safe' => ['html']],
102102
),
103-
new TwigFunction(
104-
'localised_date',
105-
Util::localisedDate(...),
106-
),
107103
new TwigFunction(
108104
'show_hint',
109105
Generator::showHint(...),

phpstan-baseline.neon

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2495,6 +2495,11 @@ parameters:
24952495
count: 1
24962496
path: libraries/classes/Controllers/Table/StructureController.php
24972497

2498+
-
2499+
message: "#^Parameter \\#1 \\$timestamp of static method PhpMyAdmin\\\\Util\\:\\:localisedDate\\(\\) expects int, \\(int\\|false\\) given\\.$#"
2500+
count: 3
2501+
path: libraries/classes/Controllers/Table/StructureController.php
2502+
24982503
-
24992504
message: "#^Parameter \\#1 \\$value of static method PhpMyAdmin\\\\Util\\:\\:formatByteDown\\(\\) expects float\\|int\\|string\\|null, \\(array\\|float\\|int\\) given\\.$#"
25002505
count: 2

psalm-baseline.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4409,6 +4409,8 @@
44094409
<code><![CDATA[$GLOBALS['tbl_is_view']]]></code>
44104410
</InvalidArrayOffset>
44114411
<MixedArgument>
4412+
<code><![CDATA[$GLOBALS['showtable']['Check_time']]]></code>
4413+
<code><![CDATA[$GLOBALS['showtable']['Create_time']]]></code>
44124414
<code><![CDATA[$GLOBALS['showtable']['Data_free']]]></code>
44134415
<code><![CDATA[$GLOBALS['showtable']['Data_length']]]></code>
44144416
<code><![CDATA[$GLOBALS['showtable']['Data_length']
@@ -4418,6 +4420,7 @@
44184420
- $GLOBALS['showtable']['Data_free']]]></code>
44194421
<code><![CDATA[$GLOBALS['showtable']['Data_length'] + $GLOBALS['showtable']['Index_length']]]></code>
44204422
<code><![CDATA[$GLOBALS['showtable']['Index_length']]]></code>
4423+
<code><![CDATA[$GLOBALS['showtable']['Update_time']]]></code>
44214424
<code><![CDATA[$GLOBALS['tbl_collation']]]></code>
44224425
<code><![CDATA[$field['Collation'] ?? '']]></code>
44234426
<code><![CDATA[$field['Extra']]]></code>

templates/table/structure/display_table_stats.twig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,21 +152,21 @@
152152
{% if showtable['Create_time'] is defined %}
153153
<tr>
154154
<th class="name">{% trans 'Creation' %}</th>
155-
<td class="value">{{ localised_date(showtable['Create_time']|date('U')) }}</td>
155+
<td class="value">{{ showtable['Create_time'] }}</td>
156156
</tr>
157157
{% endif %}
158158

159159
{% if showtable['Update_time'] is defined %}
160160
<tr>
161161
<th class="name">{% trans 'Last update' %}</th>
162-
<td class="value">{{ localised_date(showtable['Update_time']|date('U')) }}</td>
162+
<td class="value">{{ showtable['Update_time'] }}</td>
163163
</tr>
164164
{% endif %}
165165

166166
{% if showtable['Check_time'] is defined %}
167167
<tr>
168168
<th class="name">{% trans 'Last check' %}</th>
169-
<td class="value">{{ localised_date(showtable['Check_time']|date('U')) }}</td>
169+
<td class="value">{{ showtable['Check_time'] }}</td>
170170
</tr>
171171
{% endif %}
172172
</tbody>

0 commit comments

Comments
 (0)