121 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
122 $timestamp =
wfTimestamp( TS_MW, $file->getTimestamp() );
124 $img = $iscur ? $file->
getName() : $file->getArchiveName();
125 $uploader = $file->getUploader( File::FOR_THIS_USER, $user );
127 $local = $this->current->isLocal();
131 if ( $local && ( $this->
getAuthority()->isAllowedAny(
'delete',
'deletedhistory' ) ) ) {
132 $row .= Html::openElement(
'td' );
133 # Link to hide content. Don't show useless link to people who cannot hide revisions.
134 if ( !$iscur && $this->
getAuthority()->isAllowed(
'deleterevision' ) ) {
136 if ( !$file->userCan( File::DELETED_RESTRICTED, $user ) || !$file->exists() ) {
137 $row .= Html::check(
'deleterevisions',
false, [
'disabled' =>
'disabled' ] );
139 $row .= Html::check(
'ids[' . explode(
'!', $img, 2 )[0] .
']',
false );
145 # Link to remove from history
147 if ( $file->exists() ) {
148 $row .= $linkRenderer->makeKnownLink(
150 $this->
msg( $iscur ?
'filehist-deleteall' :
'filehist-deleteone' )->text(),
152 [
'action' =>
'delete',
'oldimage' => $iscur ? null : $img ]
156 $row .= $this->
msg(
'filehist-missing' )->escaped();
160 $row .= Html::closeElement(
'td' );
164 $row .= Html::openElement(
'td' );
166 $row .= $this->
msg(
'filehist-current' )->escaped();
167 } elseif ( $local && $this->
getAuthority()->probablyCan(
'edit', $this->title )
168 && $this->
getAuthority()->probablyCan(
'upload', $this->title )
170 if ( $file->isDeleted( File::DELETED_FILE ) ) {
171 $row .= $this->
msg(
'filehist-revert' )->escaped();
172 } elseif ( !$file->exists() ) {
174 $row .= $this->
msg(
'filehist-missing' )->escaped();
176 $row .= $linkRenderer->makeKnownLink(
178 $this->
msg(
'filehist-revert' )->text(),
181 'action' =>
'revert',
187 $row .= Html::closeElement(
'td' );
190 $selected = $file->getTimestamp() === $this->img->getTimestamp();
191 $row .= Html::openElement(
'td', [
192 'class' => $selected ?
'filehistory-selected' :
null,
193 'style' =>
'white-space: nowrap;'
195 if ( !$file->userCan( File::DELETED_FILE, $user ) ) {
196 # Don't link to unviewable files
197 $row .= Html::element(
'span', [
'class' =>
'history-deleted' ],
198 $lang->userTimeAndDate( $timestamp, $user )
200 } elseif ( $file->isDeleted( File::DELETED_FILE ) ) {
201 $timeAndDate = $lang->userTimeAndDate( $timestamp, $user );
204 # Make a link to review the image
205 $url = $linkRenderer->makeKnownLink(
206 SpecialPage::getTitleFor(
'Revisiondelete' ),
210 'target' => $this->title->getPrefixedText(),
212 'token' => $user->getEditToken( $img )
216 $url = htmlspecialchars( $timeAndDate );
218 $row .= Html::rawElement(
'span', [
'class' =>
'history-deleted' ],
$url );
219 } elseif ( !$file->exists() ) {
220 $row .= Html::element(
'span', [
'class' =>
'mw-file-missing' ],
221 $lang->userTimeAndDate( $timestamp, $user )
224 $url = $iscur ? $this->current->getUrl() : $this->current->getArchiveUrl( $img );
225 $row .= Html::element(
'a', [
'href' =>
$url ],
226 $lang->userTimeAndDate( $timestamp, $user )
229 $row .= Html::closeElement(
'td' );
232 if ( $this->showThumb ) {
233 $row .= Html::rawElement(
'td', [],
234 $this->
getThumbForLine( $file, $iscur ) ?? $this->
msg(
'filehist-nothumb' )->escaped()
239 $row .= Html::openElement(
'td' );
240 $row .= htmlspecialchars( $file->getDimensionsString() );
241 $row .= $this->
msg(
'word-separator' )->escaped();
242 $row .= Html::element(
'span', [
'style' =>
'white-space: nowrap;' ],
243 $this->
msg(
'parentheses' )->sizeParams( $file->getSize() )->text()
245 $row .= Html::closeElement(
'td' );
248 $row .= Html::openElement(
'td' );
251 $row .= Linker::userLink( $uploader->getId(), $uploader->getName() );
253 $row .= Html::rawElement(
'span', [
'style' =>
'white-space: nowrap;' ],
254 Linker::userToolLinks( $uploader->getId(), $uploader->getName() )
258 $row .= Html::element(
'span', [
'class' =>
'history-deleted' ],
259 $this->
msg(
'rev-deleted-user' )->text()
262 $row .= Html::closeElement(
'td' );
265 if ( $file->isDeleted( File::DELETED_COMMENT ) ) {
266 $row .= Html::rawElement(
'td', [],
267 Html::element(
'span', [
'class' =>
'history-deleted' ],
268 $this->
msg(
'rev-deleted-comment' )->text()
272 $contLang = MediaWikiServices::getInstance()->getContentLanguage();
273 $row .= Html::rawElement(
'td', [
'dir' => $contLang->getDir() ], $formattedComment );
277 $this->getHookRunner()->onImagePageFileHistoryLine( $this, $file, $row, $rowClass );
279 return Html::rawElement(
'tr', [
'class' => $rowClass ], $row ) .
"\n";
289 if ( !$file->allowInlineDisplay() ||
290 $file->isDeleted( File::DELETED_FILE ) ||
291 !$file->userCan( File::DELETED_FILE, $user )
296 $thumbnail = $file->transform(
300 'isFilePageThumb' => $iscur
308 $timestamp =
wfTimestamp( TS_MW, $file->getTimestamp() );
310 'filehist-thumbtext',
311 $lang->userTimeAndDate( $timestamp, $user ),
312 $lang->userDate( $timestamp, $user ),
313 $lang->userTime( $timestamp, $user )
315 return $thumbnail->toHtml( [
'alt' => $alt,
'file-link' =>
true,
'loading' =>
'lazy' ] );