MediaWiki 1.44.0
ChangeTagsLogItem.php
Go to the documentation of this file.
1<?php
21namespace MediaWiki\ChangeTags;
22
31
42 public function getIdField() {
43 return 'log_id';
44 }
45
46 public function getTimestampField() {
47 return 'log_timestamp';
48 }
49
50 public function getAuthorIdField() {
51 return 'log_user';
52 }
53
54 public function getAuthorNameField() {
55 return 'log_user_text';
56 }
57
58 public function getAuthorActorField() {
59 return 'log_actor';
60 }
61
62 public function canView() {
63 return LogEventsList::userCan(
64 $this->row, LogPage::DELETED_RESTRICTED, $this->list->getAuthority()
65 );
66 }
67
68 public function canViewContent() {
69 return true; // none
70 }
71
75 public function getTags() {
76 return $this->row->ts_tags;
77 }
78
83 public function getHTML() {
84 $date = htmlspecialchars( $this->list->getLanguage()->userTimeAndDate(
85 $this->row->log_timestamp, $this->list->getUser() ) );
86 $title = Title::makeTitle( $this->row->log_namespace, $this->row->log_title );
88 $formatter = $services->getLogFormatterFactory()->newFromRow( $this->row );
89 $formatter->setContext( $this->list->getContext() );
90 $formatter->setAudience( LogFormatter::FOR_THIS_USER );
91
92 // Log link for this page
93 $loglink = $services->getLinkRenderer()->makeLink(
95 $this->list->msg( 'log' )->text(),
96 [],
97 [ 'page' => $title->getPrefixedText() ]
98 );
99 $loglink = $this->list->msg( 'parentheses' )->rawParams( $loglink )->escaped();
100 // User links and action text
101 $action = $formatter->getActionText();
102
103 $dir = $this->list->getLanguage()->getDir();
104 $comment = Html::rawElement( 'bdi', [ 'dir' => $dir ], $formatter->getComment() );
105
106 $content = "$loglink $date $action $comment";
107 $attribs = [];
108 $tags = $this->getTags();
109 if ( $tags ) {
110 [ $tagSummary, $classes ] = ChangeTags::formatSummaryRow(
111 $tags,
112 'edittags',
113 $this->list->getContext()
114 );
115 $content .= " $tagSummary";
116 $attribs['class'] = $classes;
117 }
118 return Html::rawElement( 'li', $attribs, $content );
119 }
120}
121
123class_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.
canViewContent()
Returns true if the current user can view the item text/file.
getIdField()
Get the DB field name associated with the ID list.
getAuthorNameField()
Get the DB field name storing user names.
getAuthorIdField()
Get the DB field name storing user ids.
getTimestampField()
Get the DB field name storing timestamps.
canView()
Returns true if the current user can view the item.
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