Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5940732
OnWikiList.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
OnWikiList.php
View Options
<?php
namespace
MediaWiki\Extension\Notifications
;
use
MediaWiki\Content\TextContent
;
use
MediaWiki\MediaWikiServices
;
use
MediaWiki\Title\Title
;
/**
* Implements ContainmentList interface for sourcing a list of items from a wiki
* page. Uses the page's latest revision ID as cache key.
*/
class
OnWikiList
implements
ContainmentList
{
/**
* @var Title|null A title object representing the page to source the list from,
* or null if the page does not exist.
*/
protected
$title
;
/**
* @param int $titleNs An NS_* constant representing the mediawiki namespace of the page
* @param string $titleString String portion of the wiki page title
*/
public
function
__construct
(
$titleNs
,
$titleString
)
{
$title
=
Title
::
newFromText
(
$titleString
,
$titleNs
);
if
(
$title
!==
null
&&
$title
->
getArticleID
()
)
{
$this
->
title
=
$title
;
}
}
/**
* @inheritDoc
*/
public
function
getValues
()
{
if
(
!
$this
->
title
)
{
return
[];
}
$article
=
MediaWikiServices
::
getInstance
()->
getWikiPageFactory
()->
newFromTitle
(
$this
->
title
);
if
(
!
$article
->
exists
()
)
{
return
[];
}
$content
=
$article
->
getContent
();
$text
=
(
$content
instanceof
TextContent
)
?
$content
->
getText
()
:
null
;
if
(
$text
===
null
)
{
return
[];
}
return
array_filter
(
array_map
(
'trim'
,
explode
(
"
\n
"
,
$text
)
)
);
}
/**
* @inheritDoc
*/
public
function
getCacheKey
()
{
if
(
!
$this
->
title
)
{
return
''
;
}
return
(
string
)
$this
->
title
->
getLatestRevID
();
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Oct 2 2026, 17:05 (6 w, 4 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
01/c9/ecb308b851f333ab3031f08944ed
Default Alt Text
OnWikiList.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment