125 $timestamp =
wfTimestamp( TS_MW, $file->getTimestamp() );
127 $img = $iscur ? $file->
getName() : $file->getArchiveName();
130 $local = $this->current->isLocal();
134 if ( $local && ( $this->
getAuthority()->isAllowedAny(
'delete',
'deletedhistory' ) ) ) {
135 $row .= Html::openElement(
'td' );
136 # Link to hide content. Don't show useless link to people who cannot hide revisions.
137 if ( !$iscur && $this->
getAuthority()->isAllowed(
'deleterevision' ) ) {
140 $row .= Html::check(
'deleterevisions',
false, [
'disabled' =>
'disabled' ] );
142 $row .= Html::check(
'ids[' . explode(
'!',
$img, 2 )[0] .
']',
false );
148 # Link to remove from history
150 if ( $file->exists() ) {
151 $row .= $linkRenderer->makeKnownLink(
153 $this->
msg( $iscur ?
'filehist-deleteall' :
'filehist-deleteone' )->text(),
155 [
'action' =>
'delete',
'oldimage' => $iscur ? null :
$img ]
159 $row .= $this->
msg(
'filehist-missing' )->escaped();
163 $row .= Html::closeElement(
'td' );
167 $row .= Html::openElement(
'td' );
169 $row .= $this->
msg(
'filehist-current' )->escaped();
170 } elseif ( $local && $this->
getAuthority()->probablyCan(
'edit', $this->title )
171 && $this->
getAuthority()->probablyCan(
'upload', $this->title )
174 $row .= $this->
msg(
'filehist-revert' )->escaped();
175 } elseif ( !$file->exists() ) {
177 $row .= $this->
msg(
'filehist-missing' )->escaped();
179 $row .= $linkRenderer->makeKnownLink(
181 $this->
msg(
'filehist-revert' )->text(),
184 'action' =>
'revert',
190 $row .= Html::closeElement(
'td' );
193 $selected = $file->getTimestamp() === $this->img->getTimestamp();
194 $row .= Html::openElement(
'td', [
195 'class' => $selected ?
'filehistory-selected' :
null,
196 'style' =>
'white-space: nowrap;'
199 # Don't link to unviewable files
200 $row .=
Html::element(
'span', [
'class' =>
'history-deleted' ],
201 $lang->userTimeAndDate( $timestamp, $user )
204 $timeAndDate = $lang->userTimeAndDate( $timestamp, $user );
207 # Make a link to review the image
208 $url = $linkRenderer->makeKnownLink(
213 'target' => $this->title->getPrefixedText(),
215 'token' => $user->getEditToken(
$img )
219 $url = htmlspecialchars( $timeAndDate );
221 $row .= Html::rawElement(
'span', [
'class' =>
'history-deleted' ],
$url );
222 } elseif ( !$file->exists() ) {
223 $row .=
Html::element(
'span', [
'class' =>
'mw-file-missing' ],
224 $lang->userTimeAndDate( $timestamp, $user )
227 $url = $iscur ? $this->current->getUrl() : $this->current->getArchiveUrl(
$img );
229 $lang->userTimeAndDate( $timestamp, $user )
232 $row .= Html::closeElement(
'td' );
235 if ( $this->showThumb ) {
236 $row .= Html::rawElement(
'td', [],
237 $this->
getThumbForLine( $file, $iscur ) ?? $this->
msg(
'filehist-nothumb' )->escaped()
242 $row .= Html::openElement(
'td' );
243 $row .= htmlspecialchars( $file->getDimensionsString() );
244 $row .= $this->
msg(
'word-separator' )->escaped();
245 $row .=
Html::element(
'span', [
'style' =>
'white-space: nowrap;' ],
246 $this->
msg(
'parentheses' )->sizeParams( $file->getSize() )->text()
248 $row .= Html::closeElement(
'td' );
251 $row .= Html::openElement(
'td' );
254 $row .= Linker::userLink( $uploader->getId(), $uploader->getName() );
256 $row .= Html::rawElement(
'span', [
'style' =>
'white-space: nowrap;' ],
257 Linker::userToolLinks( $uploader->getId(), $uploader->getName() )
261 $row .=
Html::element(
'span', [
'class' =>
'history-deleted' ],
262 $this->
msg(
'rev-deleted-user' )->text()
265 $row .= Html::closeElement(
'td' );
269 $row .= Html::rawElement(
'td', [],
271 $this->
msg(
'rev-deleted-comment' )->text()
276 $row .= Html::rawElement(
'td', [
'dir' => $contLang->getDir() ], $formattedComment );
280 $this->getHookRunner()->onImagePageFileHistoryLine( $this, $file, $row, $rowClass );
282 return Html::rawElement(
'tr', [
'class' => $rowClass ], $row ) .
"\n";
292 if ( !$file->allowInlineDisplay() ||
299 $thumbnail = $file->transform(
303 'isFilePageThumb' => $iscur
311 $timestamp =
wfTimestamp( TS_MW, $file->getTimestamp() );
313 'filehist-thumbtext',
314 $lang->userTimeAndDate( $timestamp, $user ),
315 $lang->userDate( $timestamp, $user ),
316 $lang->userTime( $timestamp, $user )
318 return $thumbnail->toHtml( [
'alt' => $alt,
'file-link' =>
true,
'loading' =>
'lazy' ] );