111 $timestamp =
wfTimestamp( TS_MW, $file->getTimestamp() );
113 $img = $iscur ? $file->
getName() : $file->getArchiveName();
116 $local = $this->current->isLocal();
120 if ( $local && ( $this->
getAuthority()->isAllowedAny(
'delete',
'deletedhistory' ) ) ) {
121 $row .= Html::openElement(
'td' );
122 # Link to hide content. Don't show useless link to people who cannot hide revisions.
123 if ( !$iscur && $this->
getAuthority()->isAllowed(
'deleterevision' ) ) {
126 $row .= Html::check(
'deleterevisions',
false, [
'disabled' =>
'disabled' ] );
128 $row .= Html::check(
'ids[' . explode(
'!',
$img, 2 )[0] .
']',
false );
134 # Link to remove from history
136 if ( $file->exists() ) {
137 $row .= $linkRenderer->makeKnownLink(
139 $this->
msg( $iscur ?
'filehist-deleteall' :
'filehist-deleteone' )->text(),
141 [
'action' =>
'delete',
'oldimage' => $iscur ? null :
$img ]
145 $row .= $this->
msg(
'filehist-missing' )->escaped();
149 $row .= Html::closeElement(
'td' );
153 $row .= Html::openElement(
'td' );
155 $row .= $this->
msg(
'filehist-current' )->escaped();
156 } elseif ( $local && $this->
getAuthority()->probablyCan(
'edit', $this->title )
157 && $this->
getAuthority()->probablyCan(
'upload', $this->title )
160 $row .= $this->
msg(
'filehist-revert' )->escaped();
161 } elseif ( !$file->exists() ) {
163 $row .= $this->
msg(
'filehist-missing' )->escaped();
165 $row .= $linkRenderer->makeKnownLink(
167 $this->
msg(
'filehist-revert' )->text(),
170 'action' =>
'revert',
176 $row .= Html::closeElement(
'td' );
179 $selected = $file->getTimestamp() === $this->img->getTimestamp();
180 $row .= Html::openElement(
'td', [
181 'class' => $selected ?
'filehistory-selected' :
null,
182 'style' =>
'white-space: nowrap;'
185 # Don't link to unviewable files
186 $row .=
Html::element(
'span', [
'class' =>
'history-deleted' ],
187 $lang->userTimeAndDate( $timestamp, $user )
190 $timeAndDate = $lang->userTimeAndDate( $timestamp, $user );
193 # Make a link to review the image
194 $url = $linkRenderer->makeKnownLink(
199 'target' => $this->title->getPrefixedText(),
201 'token' => $user->getEditToken(
$img )
205 $url = htmlspecialchars( $timeAndDate );
207 $row .= Html::rawElement(
'span', [
'class' =>
'history-deleted' ],
$url );
208 } elseif ( !$file->exists() ) {
209 $row .=
Html::element(
'span', [
'class' =>
'mw-file-missing' ],
210 $lang->userTimeAndDate( $timestamp, $user )
213 $url = $iscur ? $this->current->getUrl() : $this->current->getArchiveUrl(
$img );
215 $lang->userTimeAndDate( $timestamp, $user )
218 $row .= Html::closeElement(
'td' );
221 if ( $this->showThumb ) {
222 $row .= Html::rawElement(
'td', [],
223 $this->
getThumbForLine( $file, $iscur ) ?? $this->
msg(
'filehist-nothumb' )->escaped()
228 $row .= Html::openElement(
'td' );
229 $row .= htmlspecialchars( $file->getDimensionsString() );
230 $row .= $this->
msg(
'word-separator' )->escaped();
231 $row .=
Html::element(
'span', [
'style' =>
'white-space: nowrap;' ],
232 $this->
msg(
'parentheses' )->sizeParams( $file->getSize() )->text()
234 $row .= Html::closeElement(
'td' );
237 $row .= Html::openElement(
'td' );
240 $row .= Linker::userLink( $uploader->getId(), $uploader->getName() );
242 $row .= Html::rawElement(
'span', [
'style' =>
'white-space: nowrap;' ],
243 Linker::userToolLinks( $uploader->getId(), $uploader->getName() )
247 $row .=
Html::element(
'span', [
'class' =>
'history-deleted' ],
248 $this->
msg(
'rev-deleted-user' )->text()
251 $row .= Html::closeElement(
'td' );
255 $row .= Html::rawElement(
'td', [],
257 $this->
msg(
'rev-deleted-comment' )->text()
262 $row .= Html::rawElement(
'td', [
'dir' => $contLang->getDir() ], $formattedComment );
266 $this->getHookRunner()->onImagePageFileHistoryLine( $this, $file, $row, $rowClass );
268 return Html::rawElement(
'tr', [
'class' => $rowClass ], $row ) .
"\n";
278 if ( !$file->allowInlineDisplay() ||
285 $thumbnail = $file->transform(
289 'isFilePageThumb' => $iscur
297 $timestamp =
wfTimestamp( TS_MW, $file->getTimestamp() );
299 'filehist-thumbtext',
300 $lang->userTimeAndDate( $timestamp, $user ),
301 $lang->userDate( $timestamp, $user ),
302 $lang->userTime( $timestamp, $user )
304 return $thumbnail->toHtml( [
'alt' => $alt,
'file-link' =>
true,
'loading' =>
'lazy' ] );