Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4017891
date-formats.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
date-formats.php
View Options
<?php
/**
* Test various language time and date functions
*
* @license GPL-2.0-or-later
* @file
* @ingroup MaintenanceLanguage
*/
use
MediaWiki\Maintenance\Maintenance
;
// @codeCoverageIgnoreStart
require_once
__DIR__
.
'/../Maintenance.php'
;
// @codeCoverageIgnoreEnd
/**
* Maintenance script that tests various language time and date functions.
*
* @ingroup MaintenanceLanguage
*/
class
DateFormats
extends
Maintenance
{
/** @var string */
private
$ts
=
'20010115123456'
;
public
function
__construct
()
{
parent
::
__construct
();
$this
->
addDescription
(
'Test various language time and date functions'
);
}
public
function
execute
()
{
global
$IP
;
foreach
(
glob
(
"$IP/languages/messages/Messages*.php"
)
as
$filename
)
{
$base
=
basename
(
$filename
);
$m
=
[];
if
(
!
preg_match
(
'/Messages(.*)
\.
php$/'
,
$base
,
$m
)
)
{
continue
;
}
$code
=
str_replace
(
'_'
,
'-'
,
strtolower
(
$m
[
1
]
)
);
$this
->
output
(
"$code "
);
$lang
=
$this
->
getServiceContainer
()->
getLanguageFactory
()->
getLanguage
(
$code
);
$prefs
=
$lang
->
getDatePreferences
();
if
(
!
$prefs
)
{
$prefs
=
[
'default'
];
}
$this
->
output
(
"date: "
);
foreach
(
$prefs
as
$index
=>
$pref
)
{
if
(
$index
>
0
)
{
$this
->
output
(
' | '
);
}
$this
->
output
(
$lang
->
date
(
$this
->
ts
,
false
,
$pref
)
);
}
$this
->
output
(
"
\n
$code time: "
);
foreach
(
$prefs
as
$index
=>
$pref
)
{
if
(
$index
>
0
)
{
$this
->
output
(
' | '
);
}
$this
->
output
(
$lang
->
time
(
$this
->
ts
,
false
,
$pref
)
);
}
$this
->
output
(
"
\n
$code both: "
);
foreach
(
$prefs
as
$index
=>
$pref
)
{
if
(
$index
>
0
)
{
$this
->
output
(
' | '
);
}
$this
->
output
(
$lang
->
timeanddate
(
$this
->
ts
,
false
,
$pref
)
);
}
$this
->
output
(
"
\n\n
"
);
}
}
}
// @codeCoverageIgnoreStart
$maintClass
=
DateFormats
::
class
;
require_once
RUN_MAINTENANCE_IF_MAIN
;
// @codeCoverageIgnoreEnd
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Aug 14 2026, 15:40 (14 w, 1 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
99/63/939cbc1b6161b4e9c161919918a1
Default Alt Text
date-formats.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment