MediaWiki
REL1_39
ChangeTagsLogItem.php
Go to the documentation of this file.
1
<?php
22
use
MediaWiki\MediaWikiServices
;
23
use
MediaWiki\Revision\RevisionRecord
;
24
31
class
ChangeTagsLogItem
extends
RevisionItemBase
{
32
public
function
getIdField
() {
33
return
'log_id'
;
34
}
35
36
public
function
getTimestampField
() {
37
return
'log_timestamp'
;
38
}
39
40
public
function
getAuthorIdField
() {
41
return
'log_user'
;
42
}
43
44
public
function
getAuthorNameField
() {
45
return
'log_user_text'
;
46
}
47
48
public
function
getAuthorActorField
() {
49
return
'log_actor'
;
50
}
51
52
public
function
canView
() {
53
return
LogEventsList::userCan(
54
$this->row, RevisionRecord::SUPPRESSED_ALL, $this->list->getAuthority()
55
);
56
}
57
58
public
function
canViewContent
() {
59
return
true
;
// none
60
}
61
65
public
function
getTags
() {
66
return
$this->row->ts_tags;
67
}
68
73
public
function
getHTML
() {
74
$date = htmlspecialchars( $this->list->getLanguage()->userTimeAndDate(
75
$this->row->log_timestamp, $this->list->getUser() ) );
76
$title
= Title::makeTitle( $this->row->log_namespace, $this->row->log_title );
77
$formatter = LogFormatter::newFromRow( $this->row );
78
$formatter->setContext( $this->list->getContext() );
79
$formatter->setAudience( LogFormatter::FOR_THIS_USER );
80
81
// Log link for this page
82
$loglink = MediaWikiServices::getInstance()->getLinkRenderer()->makeLink(
83
SpecialPage::getTitleFor
(
'Log'
),
84
$this->list->msg(
'log'
)->text(),
85
[],
86
[
'page'
=>
$title
->getPrefixedText() ]
87
);
88
$loglink = $this->list->msg(
'parentheses'
)->rawParams( $loglink )->escaped();
89
// User links and action text
90
$action = $formatter->getActionText();
91
92
$comment = $this->list->getLanguage()->getDirMark() .
93
$formatter->getComment();
94
95
if
( LogEventsList::isDeleted( $this->row,
LogPage::DELETED_COMMENT
) ) {
96
$comment =
'<span class="history-deleted">'
. $comment .
'</span>'
;
97
}
98
99
$content
=
"$loglink $date $action $comment"
;
100
$attribs = [];
101
$tags = $this->
getTags
();
102
if
( $tags ) {
103
list( $tagSummary, $classes ) =
ChangeTags::formatSummaryRow
(
104
$tags,
105
'edittags'
,
106
$this->list->getContext()
107
);
108
$content
.=
" $tagSummary"
;
109
$attribs[
'class'
] = implode(
' '
, $classes );
110
}
111
return
Xml::tags(
'li'
, $attribs,
$content
);
112
}
113
}
ChangeTagsLogItem
Item class for a logging table row with its associated change tags.
Definition
ChangeTagsLogItem.php:31
ChangeTagsLogItem\getHTML
getHTML()
Definition
ChangeTagsLogItem.php:73
ChangeTagsLogItem\getAuthorNameField
getAuthorNameField()
Get the DB field name storing user names.
Definition
ChangeTagsLogItem.php:44
ChangeTagsLogItem\getIdField
getIdField()
Get the DB field name associated with the ID list.
Definition
ChangeTagsLogItem.php:32
ChangeTagsLogItem\canViewContent
canViewContent()
Returns true if the current user can view the item text/file.
Definition
ChangeTagsLogItem.php:58
ChangeTagsLogItem\getAuthorIdField
getAuthorIdField()
Get the DB field name storing user ids.
Definition
ChangeTagsLogItem.php:40
ChangeTagsLogItem\getAuthorActorField
getAuthorActorField()
Get the DB field name storing actor ids.
Definition
ChangeTagsLogItem.php:48
ChangeTagsLogItem\getTimestampField
getTimestampField()
Get the DB field name storing timestamps.
Definition
ChangeTagsLogItem.php:36
ChangeTagsLogItem\canView
canView()
Returns true if the current user can view the item.
Definition
ChangeTagsLogItem.php:52
ChangeTagsLogItem\getTags
getTags()
Definition
ChangeTagsLogItem.php:65
ChangeTags\formatSummaryRow
static formatSummaryRow( $tags, $page, MessageLocalizer $localizer=null)
Creates HTML for the given tags.
Definition
ChangeTags.php:193
LogPage\DELETED_COMMENT
const DELETED_COMMENT
Definition
LogPage.php:41
MediaWiki\MediaWikiServices
Service locator for MediaWiki core services.
Definition
MediaWikiServices.php:212
MediaWiki\Revision\RevisionRecord
Page revision base class.
Definition
RevisionRecord.php:47
RevisionItemBase
Abstract base class for revision items.
Definition
RevisionItemBase.php:29
SpecialPage\getTitleFor
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
Definition
SpecialPage.php:132
$content
$content
Definition
router.php:76
$title
$title
Definition
testCompression.php:38
includes
changetags
ChangeTagsLogItem.php
Generated on Tue Sep 10 2024 06:22:33 for MediaWiki by
1.10.0