112 $timestamp =
wfTimestamp( TS::MW, $file->getTimestamp() );
114 $img = $iscur ? $file->
getName() : $file->getArchiveName();
117 $local = $this->current->isLocal();
121 if ( $local && ( $this->
getAuthority()->isAllowedAny(
'delete',
'deletedhistory' ) ) ) {
122 $row .= Html::openElement(
'td' );
123 # Link to hide content. Don't show useless link to people who cannot hide revisions.
124 if ( !$iscur && $this->
getAuthority()->isAllowed(
'deleterevision' ) ) {
127 $row .= Html::check(
'deleterevisions',
false, [
'disabled' =>
'disabled' ] );
129 $row .= Html::check(
'ids[' . explode(
'!',
$img, 2 )[0] .
']',
false );
135 # Link to remove from history
137 if ( $file->exists() ) {
138 $row .= $linkRenderer->makeKnownLink(
140 $this->
msg( $iscur ?
'filehist-deleteall' :
'filehist-deleteone' )->text(),
142 [
'action' =>
'delete',
'oldimage' => $iscur ? null :
$img ]
146 $row .= $this->
msg(
'filehist-missing' )->escaped();
150 $row .= Html::closeElement(
'td' );
154 $row .= Html::openElement(
'td' );
156 $row .= $this->
msg(
'filehist-current' )->escaped();
157 } elseif ( $local && $this->
getAuthority()->probablyCan(
'edit', $this->title )
158 && $this->
getAuthority()->probablyCan(
'upload', $this->title )
161 $row .= $this->
msg(
'filehist-revert' )->escaped();
162 } elseif ( !$file->exists() ) {
164 $row .= $this->
msg(
'filehist-missing' )->escaped();
166 $row .= $linkRenderer->makeKnownLink(
168 $this->
msg(
'filehist-revert' )->text(),
171 'action' =>
'revert',
177 $row .= Html::closeElement(
'td' );
180 $selected = $file->getTimestamp() === $this->img->getTimestamp();
181 $row .= Html::openElement(
'td', [
182 'class' => $selected ?
'filehistory-selected' :
null,
183 'style' =>
'white-space: nowrap;'
186 # Don't link to unviewable files
187 $row .=
Html::element(
'span', [
'class' =>
'history-deleted' ],
188 $lang->userTimeAndDate( $timestamp, $user )
191 $timeAndDate = $lang->userTimeAndDate( $timestamp, $user );
194 # Make a link to review the image
195 $url = $linkRenderer->makeKnownLink(
200 'target' => $this->title->getPrefixedText(),
202 'token' => $user->getEditToken(
$img )
206 $url = htmlspecialchars( $timeAndDate );
208 $row .= Html::rawElement(
'span', [
'class' =>
'history-deleted' ],
$url );
209 } elseif ( !$file->exists() ) {
210 $row .=
Html::element(
'span', [
'class' =>
'mw-file-missing' ],
211 $lang->userTimeAndDate( $timestamp, $user )
214 $url = $iscur ? $this->current->getUrl() : $this->current->getArchiveUrl(
$img );
216 $lang->userTimeAndDate( $timestamp, $user )
219 $row .= Html::closeElement(
'td' );
222 if ( $this->showThumb ) {
223 $row .= Html::rawElement(
'td', [],
224 $this->
getThumbForLine( $file, $iscur ) ?? $this->
msg(
'filehist-nothumb' )->escaped()
229 $row .= Html::openElement(
'td' );
230 $row .= htmlspecialchars( $file->getDimensionsString() );
231 $row .= $this->
msg(
'word-separator' )->escaped();
232 $row .=
Html::element(
'span', [
'style' =>
'white-space: nowrap;' ],
233 $this->
msg(
'parentheses' )->sizeParams( $file->getSize() )->text()
235 $row .= Html::closeElement(
'td' );
238 $row .= Html::openElement(
'td' );
241 $row .= Linker::userLink( $uploader->getId(), $uploader->getName() );
243 $row .= Html::rawElement(
'span', [
'style' =>
'white-space: nowrap;' ],
244 Linker::userToolLinks( $uploader->getId(), $uploader->getName() )
248 $row .=
Html::element(
'span', [
'class' =>
'history-deleted' ],
249 $this->
msg(
'rev-deleted-user' )->text()
252 $row .= Html::closeElement(
'td' );
256 $row .= Html::rawElement(
'td', [],
258 $this->
msg(
'rev-deleted-comment' )->text()
263 $row .= Html::rawElement(
'td', [
'dir' => $contLang->getDir() ], $formattedComment );
267 $this->getHookRunner()->onImagePageFileHistoryLine( $this, $file, $row, $rowClass );
269 return Html::rawElement(
'tr', [
'class' => $rowClass ], $row ) .
"\n";
279 if ( !$file->allowInlineDisplay() ||
286 $thumbnail = $file->transform(
290 'isFilePageThumb' => $iscur
298 $timestamp =
wfTimestamp( TS::MW, $file->getTimestamp() );
300 'filehist-thumbtext',
301 $lang->userTimeAndDate( $timestamp, $user ),
302 $lang->userDate( $timestamp, $user ),
303 $lang->userTime( $timestamp, $user )
305 return $thumbnail->toHtml( [
'alt' => $alt,
'file-link' =>
true,
'loading' =>
'lazy' ] );