Remove localised_date Twig extension

Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
This commit is contained in:
Kamil Tekiela 2023-02-28 13:30:38 +00:00 committed by Maurício Meneghini Fauth
parent 3a78383df5
commit 525009b2fd
5 changed files with 24 additions and 7 deletions

View File

@ -34,6 +34,7 @@ use function __;
use function in_array;
use function is_string;
use function str_contains;
use function strtotime;
/**
* Displays table structure infos like columns, indexes, size, rows
@ -361,6 +362,18 @@ class StructureController extends AbstractController
];
}
if (isset($GLOBALS['showtable']['Create_time'])) {
$GLOBALS['showtable']['Create_time'] = Util::localisedDate(strtotime($GLOBALS['showtable']['Create_time']));
}
if (isset($GLOBALS['showtable']['Update_time'])) {
$GLOBALS['showtable']['Update_time'] = Util::localisedDate(strtotime($GLOBALS['showtable']['Update_time']));
}
if (isset($GLOBALS['showtable']['Check_time'])) {
$GLOBALS['showtable']['Check_time'] = Util::localisedDate(strtotime($GLOBALS['showtable']['Check_time']));
}
return $this->template->render('table/structure/display_table_stats', [
'db' => $GLOBALS['db'],
'table' => $GLOBALS['table'],

View File

@ -100,10 +100,6 @@ class UtilExtension extends AbstractExtension
Generator::linkToVarDocumentation(...),
['is_safe' => ['html']],
),
new TwigFunction(
'localised_date',
Util::localisedDate(...),
),
new TwigFunction(
'show_hint',
Generator::showHint(...),

View File

@ -2495,6 +2495,11 @@ parameters:
count: 1
path: libraries/classes/Controllers/Table/StructureController.php
-
message: "#^Parameter \\#1 \\$timestamp of static method PhpMyAdmin\\\\Util\\:\\:localisedDate\\(\\) expects int, \\(int\\|false\\) given\\.$#"
count: 3
path: libraries/classes/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

View File

@ -4409,6 +4409,8 @@
<code><![CDATA[$GLOBALS['tbl_is_view']]]></code>
</InvalidArrayOffset>
<MixedArgument>
<code><![CDATA[$GLOBALS['showtable']['Check_time']]]></code>
<code><![CDATA[$GLOBALS['showtable']['Create_time']]]></code>
<code><![CDATA[$GLOBALS['showtable']['Data_free']]]></code>
<code><![CDATA[$GLOBALS['showtable']['Data_length']]]></code>
<code><![CDATA[$GLOBALS['showtable']['Data_length']
@ -4418,6 +4420,7 @@
- $GLOBALS['showtable']['Data_free']]]></code>
<code><![CDATA[$GLOBALS['showtable']['Data_length'] + $GLOBALS['showtable']['Index_length']]]></code>
<code><![CDATA[$GLOBALS['showtable']['Index_length']]]></code>
<code><![CDATA[$GLOBALS['showtable']['Update_time']]]></code>
<code><![CDATA[$GLOBALS['tbl_collation']]]></code>
<code><![CDATA[$field['Collation'] ?? '']]></code>
<code><![CDATA[$field['Extra']]]></code>

View File

@ -152,21 +152,21 @@
{% if showtable['Create_time'] is defined %}
<tr>
<th class="name">{% trans 'Creation' %}</th>
<td class="value">{{ localised_date(showtable['Create_time']|date('U')) }}</td>
<td class="value">{{ showtable['Create_time'] }}</td>
</tr>
{% endif %}
{% if showtable['Update_time'] is defined %}
<tr>
<th class="name">{% trans 'Last update' %}</th>
<td class="value">{{ localised_date(showtable['Update_time']|date('U')) }}</td>
<td class="value">{{ showtable['Update_time'] }}</td>
</tr>
{% endif %}
{% if showtable['Check_time'] is defined %}
<tr>
<th class="name">{% trans 'Last check' %}</th>
<td class="value">{{ localised_date(showtable['Check_time']|date('U')) }}</td>
<td class="value">{{ showtable['Check_time'] }}</td>
</tr>
{% endif %}
</tbody>