Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F33754
expand-groupspec.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
expand-groupspec.php
View Options
<?php
/**
* Script that expands a message group specification (such as page-News*,page-Help*).
*
* @license GPL-2.0-or-later
* @file
*/
use
MediaWiki\Extension\Translate\MessageGroupProcessing\MessageGroups
;
// Standard boilerplate to define $IP
if
(
getenv
(
'MW_INSTALL_PATH'
)
!==
false
)
{
$IP
=
getenv
(
'MW_INSTALL_PATH'
);
}
else
{
$dir
=
__DIR__
;
$IP
=
"$dir/../../.."
;
}
require_once
"$IP/maintenance/Maintenance.php"
;
class
TranslateExpandGroupSpec
extends
Maintenance
{
public
function
__construct
()
{
parent
::
__construct
();
$this
->
addDescription
(
'Expands a message group specification.'
);
$this
->
addOption
(
'exportable'
,
'List only groups that can be exported'
,
false
,
/*required*/
false
/*has arg*/
);
$this
->
addArg
(
'specification'
,
'For example page-*,main'
,
true
/*required*/
);
$this
->
requireExtension
(
'Translate'
);
}
public
function
execute
()
{
$spec
=
$this
->
getArg
(
0
);
$patterns
=
explode
(
','
,
trim
(
$spec
)
);
$ids
=
MessageGroups
::
expandWildcards
(
$patterns
);
if
(
$this
->
getOption
(
'exportable'
)
)
{
foreach
(
$ids
as
$index
=>
$id
)
{
if
(
!
MessageGroups
::
getGroup
(
$id
)
instanceof
FileBasedMessageGroup
)
{
unset
(
$ids
[
$index
]
);
}
}
}
if
(
$ids
!==
[]
)
{
// This should not be affected by --quiet
echo
implode
(
"
\n
"
,
$ids
)
.
"
\n
"
;
}
}
}
$maintClass
=
TranslateExpandGroupSpec
::
class
;
require_once
RUN_MAINTENANCE_IF_MAIN
;
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Thu, Dec 18, 08:31 (8 h, 12 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
38/7e/a695cb17a580f6cf547c8a9c074b
Default Alt Text
expand-groupspec.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment