63 $this->img->canRender();
86 return Xml::element(
'h2', [
'id' =>
'filehistory' ], $this->
msg(
'filehist' )->text() )
88 .
"<div id=\"mw-imagepage-section-filehistory\">\n"
89 . $this->
msg(
'filehist-help' )->parseAsBlock()
91 . Xml::openElement(
'table', [
'class' =>
'wikitable filehistory' ] ) .
"\n"
93 . ( $this->current->isLocal()
94 && ( MediaWikiServices::getInstance()
95 ->getPermissionManager()
96 ->userHasAnyRight( $this->
getUser(),
'delete',
'deletedhistory' ) ) ?
'<th></th>' :
'' )
97 .
'<th>' . $this->
msg(
'filehist-datetime' )->escaped() .
'</th>'
98 . ( $this->showThumb ?
'<th>' . $this->
msg(
'filehist-thumb' )->escaped() .
'</th>' :
'' )
99 .
'<th>' . $this->
msg(
'filehist-dimensions' )->escaped() .
'</th>'
100 .
'<th>' . $this->
msg(
'filehist-user' )->escaped() .
'</th>'
101 .
'<th>' . $this->
msg(
'filehist-comment' )->escaped() .
'</th>'
110 return "</table>\n$navLinks\n</div>\n";
121 $pm = MediaWikiServices::getInstance()->getPermissionManager();
125 $userId =
$file->getUser(
'id' );
126 $userText =
$file->getUser(
'text' );
129 $local = $this->current->isLocal();
130 $row = $selected =
'';
133 if ( $local && ( $pm->userHasAnyRight( $user,
'delete',
'deletedhistory' ) ) ) {
135 # Link to remove from history
136 if ( $pm->userHasRight( $user,
'delete' ) ) {
137 $q = [
'action' =>
'delete' ];
139 $q[
'oldimage'] =
$img;
143 $this->
msg( $iscur ?
'filehist-deleteall' :
'filehist-deleteone' )->escaped(),
147 # Link to hide content. Don't show useless link to people who cannot hide revisions.
148 $canHide = $pm->userHasRight( $user,
'deleterevision' );
149 if ( $canHide || ( $pm->userHasRight( $user,
'deletedhistory' )
150 &&
$file->getVisibility() ) ) {
151 if ( $pm->userHasRight( $user,
'delete' ) ) {
158 list( $ts, ) = explode(
'!',
$img, 2 );
160 'type' =>
'oldimage',
161 'target' => $this->title->getPrefixedText(),
175 $row .= $this->
msg(
'filehist-current' )->escaped();
176 } elseif ( $local && $pm->quickUserCan(
'edit', $user, $this->title )
177 && $pm->quickUserCan(
'upload', $user, $this->title )
180 $row .= $this->
msg(
'filehist-revert' )->escaped();
184 $this->
msg(
'filehist-revert' )->escaped(),
187 'action' =>
'revert',
196 if (
$file->getTimestamp() === $this->img->getTimestamp() ) {
197 $selected =
"class='filehistory-selected'";
199 $row .=
"<td $selected style='white-space: nowrap;'>";
201 # Don't link to unviewable files
202 $row .= Html::element(
'span', [
'class' =>
'history-deleted' ],
203 $lang->userTimeAndDate( $timestamp, $user )
206 $timeAndDate = htmlspecialchars(
$lang->userTimeAndDate( $timestamp, $user ) );
209 $revdel = SpecialPage::getTitleFor(
'Revisiondelete' );
210 # Make a link to review the image
216 'target' => $this->title->getPrefixedText(),
218 'token' => $user->getEditToken(
$img )
224 $row .=
'<span class="history-deleted">' . $url .
'</span>';
225 } elseif ( !
$file->exists() ) {
226 $row .= Html::element(
'span', [
'class' =>
'mw-file-missing' ],
227 $lang->userTimeAndDate( $timestamp, $user )
230 $url = $iscur ? $this->current->getUrl() : $this->current->getArchiveUrl(
$img );
231 $row .= Xml::element(
234 $lang->userTimeAndDate( $timestamp, $user )
240 if ( $this->showThumb ) {
246 $row .= htmlspecialchars(
$file->getDimensionsString() );
247 $row .= $this->
msg(
'word-separator' )->escaped();
248 $row .=
'<span style="white-space: nowrap;">';
249 $row .= $this->
msg(
'parentheses' )->sizeParams(
$file->getSize() )->escaped();
257 $row .=
'<span class="history-deleted">'
258 . $this->
msg(
'rev-deleted-user' )->escaped() .
'</span>';
262 $row .=
'<span style="white-space: nowrap;">';
266 $row .= htmlspecialchars( $userText );
273 $row .=
'<td><span class="history-deleted">' .
274 $this->
msg(
'rev-deleted-comment' )->escaped() .
'</span></td>';
276 $contLang = MediaWikiServices::getInstance()->getContentLanguage();
277 $row .= Html::rawElement(
279 [
'dir' => $contLang->getDir() ],
285 Hooks::run(
'ImagePageFileHistoryLine', [ $this,
$file, &$row, &$rowClass ] );
286 $classAttr = $rowClass ?
" class='$rowClass'" :
'';
288 return "<tr{$classAttr}>{$row}</tr>\n";
307 $thumbnail =
$file->transform( $params );
309 'alt' => $this->
msg(
'filehist-thumbtext',
310 $lang->userTimeAndDate( $timestamp, $user ),
311 $lang->userDate( $timestamp, $user ),
312 $lang->userTime( $timestamp, $user ) )->text(),
317 return $this->
msg(
'filehist-nothumb' )->escaped();
320 return $thumbnail->toHtml( $options );
322 return $this->
msg(
'filehist-nothumb' )->escaped();
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
getContext()
Gets the context this Article is executed in.
getTitle()
Get the title object of the article.
getPage()
Get the WikiPage object of this instance.
The simplest way of implementing IContextSource is to hold a RequestContext as a member variable and ...
msg( $key,... $params)
Get a Message object with context set Parameters are the same as wfMessage()
setContext(IContextSource $context)
Implements some public methods and some protected utility functions which are required by multiple ch...
getName()
Return the name of this file.
Builds the image revision log shown on image pages.
endImageHistoryList( $navLinks='')
beginImageHistoryList( $navLinks='')
preventClickjacking( $enable=true)
imageHistoryLine( $iscur, $file)
static userLink( $userId, $userName, $altUserName=false)
Make user link (or user contributions for unregistered users)
static linkKnown( $target, $html=null, $customAttribs=[], $query=[], $options=[ 'known'])
Identical to link(), except $options defaults to 'known'.
static revDeleteLinkDisabled( $delete=true)
Creates a dead (show/hide) link for deleting revisions/log entries.
static userToolLinks( $userId, $userText, $redContribsWhenNoEdits=false, $flags=0, $edits=null, $useParentheses=true)
Generate standard user tool links (talk, contributions, block link, etc.)
static revDeleteLink( $query=[], $restricted=false, $delete=true)
Creates a (show/hide) link for deleting revisions/log entries.
static formatComment( $comment, $title=null, $local=false, $wikiId=null)
This function is called by all recent changes variants, by the page history, and by the user contribu...
Represents a title within MediaWiki.
getConfig()
Get the site configuration.
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
Item class for a filearchive table row.
if(!isset( $args[0])) $lang