MediaWiki master
ChangeTagsLogItem.php
Go to the documentation of this file.
1<?php
21namespace MediaWiki\ChangeTags;
22
31
43 public function getIdField() {
44 return 'log_id';
45 }
46
48 public function getTimestampField() {
49 return 'log_timestamp';
50 }
51
53 public function getAuthorIdField() {
54 return 'log_user';
55 }
56
58 public function getAuthorNameField() {
59 return 'log_user_text';
60 }
61
63 public function getAuthorActorField() {
64 return 'log_actor';
65 }
66
68 public function canView() {
69 return LogEventsList::userCan(
70 $this->row, LogPage::DELETED_RESTRICTED, $this->list->getAuthority()
71 );
72 }
73
75 public function canViewContent() {
76 return true; // none
77 }
78
82 public function getTags() {
83 return $this->row->ts_tags;
84 }
85
90 public function getHTML() {
91 $date = htmlspecialchars( $this->list->getLanguage()->userTimeAndDate(
92 $this->row->log_timestamp, $this->list->getUser() ) );
93 $title = Title::makeTitle( $this->row->log_namespace, $this->row->log_title );
95 $formatter = $services->getLogFormatterFactory()->newFromRow( $this->row );
96 $formatter->setContext( $this->list->getContext() );
97 $formatter->setAudience( LogFormatter::FOR_THIS_USER );
98
99 // Log link for this page
100 $loglink = $services->getLinkRenderer()->makeLink(
102 $this->list->msg( 'log' )->text(),
103 [],
104 [ 'page' => $title->getPrefixedText() ]
105 );
106 $loglink = $this->list->msg( 'parentheses' )->rawParams( $loglink )->escaped();
107 // User links and action text
108 $action = $formatter->getActionText();
109
110 $dir = $this->list->getLanguage()->getDir();
111 $comment = Html::rawElement( 'bdi', [ 'dir' => $dir ], $formatter->getComment() );
112
113 $content = "$loglink $date $action $comment";
114 $attribs = [];
115 $tags = $this->getTags();
116 if ( $tags ) {
117 [ $tagSummary, $classes ] = ChangeTags::formatSummaryRow(
118 $tags,
119 'edittags',
120 $this->list->getContext()
121 );
122 $content .= " $tagSummary";
123 $attribs['class'] = $classes;
124 }
125 return Html::rawElement( 'li', $attribs, $content );
126 }
127}
128
130class_alias( ChangeTagsLogItem::class, 'ChangeTagsLogItem' );
Item class for a logging table row with its associated change tags.
getAuthorActorField()
Get the DB field name storing actor ids.Override this function. 1.31 string|false
canViewContent()
Returns true if the current user can view the item text/file.bool
getIdField()
Get the DB field name associated with the ID list.Override this function. string|null
getAuthorNameField()
Get the DB field name storing user names.Override this function. string|false
getAuthorIdField()
Get the DB field name storing user ids.Override this function. string|false
getTimestampField()
Get the DB field name storing timestamps.Override this function. string|false
canView()
Returns true if the current user can view the item.bool
static formatSummaryRow( $tags, $unused, ?MessageLocalizer $localizer=null)
Creates HTML for the given tags.
This class is a collection of static functions that serve two purposes:
Definition Html.php:57
Implements the default log formatting.
Class to simplify the use of log pages.
Definition LogPage.php:50
Service locator for MediaWiki core services.
static getInstance()
Returns the global default instance of the top level service locator.
Abstract base class for revision items.
Parent class for all special pages.
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,...
Represents a title within MediaWiki.
Definition Title.php:78