MediaWiki master
ChangeTagsLogItem.php
Go to the documentation of this file.
1<?php
8
17
29 public function getIdField() {
30 return 'log_id';
31 }
32
34 public function getTimestampField() {
35 return 'log_timestamp';
36 }
37
39 public function getAuthorIdField() {
40 return 'log_user';
41 }
42
44 public function getAuthorNameField() {
45 return 'log_user_text';
46 }
47
49 public function getAuthorActorField() {
50 return 'log_actor';
51 }
52
54 public function canView() {
55 return LogEventsList::userCan(
56 $this->row, LogPage::DELETED_RESTRICTED, $this->list->getAuthority()
57 );
58 }
59
61 public function canViewContent() {
62 return true; // none
63 }
64
68 public function getTags() {
69 return $this->row->ts_tags;
70 }
71
76 public function getHTML() {
77 $date = htmlspecialchars( $this->list->getLanguage()->userTimeAndDate(
78 $this->row->log_timestamp, $this->list->getUser() ) );
79 $title = Title::makeTitle( $this->row->log_namespace, $this->row->log_title );
81 $formatter = $services->getLogFormatterFactory()->newFromRow( $this->row );
82 $formatter->setContext( $this->list->getContext() );
83 $formatter->setAudience( LogFormatter::FOR_THIS_USER );
84
85 // Log link for this page
86 $loglink = $services->getLinkRenderer()->makeLink(
88 $this->list->msg( 'log' )->text(),
89 [],
90 [ 'page' => $title->getPrefixedText() ]
91 );
92 $loglink = $this->list->msg( 'parentheses' )->rawParams( $loglink )->escaped();
93 // User links and action text
94 $action = $formatter->getActionText();
95
96 $dir = $this->list->getLanguage()->getDir();
97 $comment = Html::rawElement( 'bdi', [ 'dir' => $dir ], $formatter->getComment() );
98
99 $content = "$loglink $date $action $comment";
100 $attribs = [];
101 $tags = $this->getTags();
102 if ( $tags ) {
103 [ $tagSummary, $classes ] = ChangeTags::formatSummaryRow(
104 $tags,
105 'edittags',
106 $this->list->getContext()
107 );
108 $content .= " $tagSummary";
109 $attribs['class'] = $classes;
110 }
111 return Html::rawElement( 'li', $attribs, $content );
112 }
113}
114
116class_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.
makeTitle( $linkId)
Convert a link ID to a Title.to override Title
This class is a collection of static functions that serve two purposes:
Definition Html.php:43
Implements the default log formatting.
Class to simplify the use of log pages.
Definition LogPage.php:35
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:70