Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4133721
Utils.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
Utils.php
View Options
<?php
namespace
MobileFrontend\Tests
;
/**
* Class with utility methods for MF tests.
*/
class
Utils
{
/**
* Used as test value for $wgMobileUrlCallback in MobileContextTest and MobileFrontendHooksTest.
*
* This is a copy of Wikimedia's mobile URL callback, but the logic of the callback
* itself is tested in the operations/mediawiki-config repo so the tests here don't
* need to cover that.
*
* @param string $domain
* @return string
*/
public
static
function
mobileUrlCallback
(
string
$domain
):
string
{
switch
(
$domain
)
{
case
'wikisource.org'
:
return
'm.wikisource.org'
;
case
'wikitech.wikimedia.org'
:
return
'wikitech.wikimedia.org'
;
case
'wikidata.beta.wmflabs.org'
:
return
'm.wikidata.beta.wmflabs.org'
;
case
'wikifunctions.beta.wmflabs.org'
:
return
'm.wikifunctions.beta.wmflabs.org'
;
}
$domainParts
=
explode
(
'.'
,
$domain
);
if
(
$domainParts
[
0
]
===
'www'
)
{
$domainParts
[
0
]
=
'm'
;
}
else
{
array_splice
(
$domainParts
,
1
,
0
,
[
'm'
]
);
}
return
implode
(
'.'
,
$domainParts
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Wed, Aug 19, 12:17 (3 w, 2 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
ad/46/7f3327243a7a8dce4f2d718b8205
Default Alt Text
Utils.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment