Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4058934
SpecialGoToComment.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
SpecialGoToComment.php
View Options
<?php
namespace
MediaWiki\Extension\DiscussionTools
;
use
MediaWiki\SpecialPage\RedirectSpecialPage
;
use
MediaWiki\SpecialPage\SpecialPage
;
use
MediaWiki\Title\Title
;
class
SpecialGoToComment
extends
RedirectSpecialPage
{
private
ThreadItemStore
$threadItemStore
;
public
function
__construct
(
ThreadItemStore
$threadItemStore
)
{
parent
::
__construct
(
'GoToComment'
);
$this
->
threadItemStore
=
$threadItemStore
;
}
/**
* @inheritDoc
*/
public
function
getRedirect
(
$subpage
)
{
$results
=
[];
// Search for all thread items with the given ID or name, returning results from the latest
// revision of each page they appeared on.
//
// If there is exactly one good result (see isCanonicalPermalink()), redirect to it.
// Otherwise, redirect to full search results on Special:FindComment.
if
(
$subpage
)
{
$threadItems
=
$this
->
threadItemStore
->
findNewestRevisionsById
(
$subpage
);
foreach
(
$threadItems
as
$item
)
{
if
(
$item
->
isCanonicalPermalink
()
)
{
$results
[]
=
$item
;
}
}
$threadItems
=
$this
->
threadItemStore
->
findNewestRevisionsByName
(
$subpage
);
foreach
(
$threadItems
as
$item
)
{
if
(
$item
->
isCanonicalPermalink
()
)
{
$results
[]
=
$item
;
}
}
}
if
(
count
(
$results
)
===
1
)
{
return
Title
::
castFromPageIdentity
(
$results
[
0
]->
getPage
()
)->
createFragmentTarget
(
$results
[
0
]->
getId
()
);
}
else
{
return
SpecialPage
::
getTitleFor
(
'FindComment'
,
$subpage
?:
false
);
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Aug 16 2026, 05:06 (12 w, 21 h ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
72/86/6220e3915ab7cd190ab8c8944d14
Default Alt Text
SpecialGoToComment.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment