MediaWiki REL1_33
RevisionItemBase.php
Go to the documentation of this file.
1<?php
24
28abstract class RevisionItemBase {
30 protected $list;
31
33 protected $row;
34
39 public function __construct( $list, $row ) {
40 $this->list = $list;
41 $this->row = $row;
42 }
43
49 public function getIdField() {
50 return null;
51 }
52
58 public function getTimestampField() {
59 return false;
60 }
61
67 public function getAuthorIdField() {
68 return false;
69 }
70
76 public function getAuthorNameField() {
77 return false;
78 }
79
86 public function getAuthorActorField() {
87 return false;
88 }
89
94 public function getId() {
95 $field = $this->getIdField();
96 return $this->row->$field;
97 }
98
103 public function formatDate() {
104 return $this->list->getLanguage()->userDate( $this->getTimestamp(),
105 $this->list->getUser() );
106 }
107
112 public function formatTime() {
113 return $this->list->getLanguage()->userTime( $this->getTimestamp(),
114 $this->list->getUser() );
115 }
116
121 public function getTimestamp() {
122 $field = $this->getTimestampField();
123 return wfTimestamp( TS_MW, $this->row->$field );
124 }
125
130 public function getAuthorId() {
131 $field = $this->getAuthorIdField();
132 return intval( $this->row->$field );
133 }
134
139 public function getAuthorName() {
140 $field = $this->getAuthorNameField();
141 return strval( $this->row->$field );
142 }
143
149 public function getAuthorActor() {
150 $field = $this->getAuthorActorField();
151 return strval( $this->row->$field );
152 }
153
157 abstract public function canView();
158
162 abstract public function canViewContent();
163
168 abstract public function getHTML();
169
174 protected function getLinkRenderer() {
175 return MediaWikiServices::getInstance()->getLinkRenderer();
176 }
177}
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
MediaWikiServices is the service locator for the application scope of MediaWiki.
Abstract base class for revision items.
$row
The database result row.
formatTime()
Get the time, formatted in user's language.
getAuthorIdField()
Get the DB field name storing user ids.
getTimestampField()
Get the DB field name storing timestamps.
canViewContent()
Returns true if the current user can view the item text/file.
getAuthorActorField()
Get the DB field name storing actor ids.
getAuthorActor()
Get the author actor ID.
getAuthorNameField()
Get the DB field name storing user names.
getHTML()
Get the HTML of the list item.
canView()
Returns true if the current user can view the item.
getAuthorId()
Get the author user ID.
getIdField()
Get the DB field name associated with the ID list.
getAuthorName()
Get the author user name.
getTimestamp()
Get the timestamp in MW 14-char form.
RevisionListBase $list
The parent.
formatDate()
Get the date, formatted in user's language.
getId()
Get the ID, as it would appear in the ids URL parameter.
__construct( $list, $row)
getLinkRenderer()
Returns an instance of LinkRenderer.
List for revision table items for a single page.
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
Definition deferred.txt:11