138 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
142 $uploader =
$file->getUploader( File::FOR_THIS_USER, $user );
144 $local = $this->current->isLocal();
148 if ( $local && ( $this->
getAuthority()->isAllowedAny(
'delete',
'deletedhistory' ) ) ) {
149 $row .= Html::openElement(
'td' );
150 # Link to remove from history
152 $row .= $linkRenderer->makeKnownLink(
154 $this->
msg( $iscur ?
'filehist-deleteall' :
'filehist-deleteone' )->text(),
156 [
'action' =>
'delete',
'oldimage' => $iscur ? null :
$img ]
159 # Link to hide content. Don't show useless link to people who cannot hide revisions.
160 $canHide = $this->
getAuthority()->isAllowed(
'deleterevision' );
161 if ( $canHide || ( $this->
getAuthority()->isAllowed(
'deletedhistory' )
162 &&
$file->getVisibility() ) ) {
164 $row .= Html::element(
'br' );
167 if ( $iscur || !
$file->userCan( File::DELETED_RESTRICTED, $user ) ) {
172 'type' =>
'oldimage',
173 'target' => $this->title->getPrefixedText(),
174 'ids' => explode(
'!',
$img, 2 )[0],
176 $file->isDeleted( File::DELETED_RESTRICTED ),
181 $row .= Html::closeElement(
'td' );
185 $row .= Html::openElement(
'td' );
187 $row .= $this->
msg(
'filehist-current' )->escaped();
188 } elseif ( $local && $this->
getAuthority()->probablyCan(
'edit', $this->title )
189 && $this->
getAuthority()->probablyCan(
'upload', $this->title )
191 if (
$file->isDeleted( File::DELETED_FILE ) ) {
192 $row .= $this->
msg(
'filehist-revert' )->escaped();
194 $row .= $linkRenderer->makeKnownLink(
196 $this->
msg(
'filehist-revert' )->text(),
199 'action' =>
'revert',
205 $row .= Html::closeElement(
'td' );
208 $selected =
$file->getTimestamp() === $this->img->getTimestamp();
209 $row .= Html::openElement(
'td', [
210 'class' => $selected ?
'filehistory-selected' :
null,
211 'style' =>
'white-space: nowrap;'
213 if ( !
$file->userCan( File::DELETED_FILE, $user ) ) {
214 # Don't link to unviewable files
215 $row .= Html::element(
'span', [
'class' =>
'history-deleted' ],
216 $lang->userTimeAndDate( $timestamp, $user )
218 } elseif (
$file->isDeleted( File::DELETED_FILE ) ) {
219 $timeAndDate =
$lang->userTimeAndDate( $timestamp, $user );
222 # Make a link to review the image
223 $url = $linkRenderer->makeKnownLink(
228 'target' => $this->title->getPrefixedText(),
230 'token' => $user->getEditToken(
$img )
234 $url = htmlspecialchars( $timeAndDate );
236 $row .= Html::rawElement(
'span', [
'class' =>
'history-deleted' ], $url );
237 } elseif ( !
$file->exists() ) {
238 $row .= Html::element(
'span', [
'class' =>
'mw-file-missing' ],
239 $lang->userTimeAndDate( $timestamp, $user )
242 $url = $iscur ? $this->current->getUrl() : $this->current->getArchiveUrl(
$img );
243 $row .= Html::element(
'a', [
'href' => $url ],
244 $lang->userTimeAndDate( $timestamp, $user )
247 $row .= Html::closeElement(
'td' );
250 if ( $this->showThumb ) {
251 $row .= Html::rawElement(
'td', [],
257 $row .= Html::openElement(
'td' );
258 $row .= htmlspecialchars(
$file->getDimensionsString() );
259 $row .= $this->
msg(
'word-separator' )->escaped();
260 $row .= Html::element(
'span', [
'style' =>
'white-space: nowrap;' ],
261 $this->
msg(
'parentheses' )->sizeParams(
$file->getSize() )->text()
263 $row .= Html::closeElement(
'td' );
266 $row .= Html::openElement(
'td' );
268 if ( $uploader && $local ) {
270 $row .= Html::rawElement(
'span', [
'style' =>
'white-space: nowrap;' ],
273 } elseif ( $uploader ) {
274 $row .= htmlspecialchars( $uploader->getName() );
276 $row .= Html::element(
'span', [
'class' =>
'history-deleted' ],
277 $this->
msg(
'rev-deleted-user' )->text()
280 $row .= Html::closeElement(
'td' );
283 if (
$file->isDeleted( File::DELETED_COMMENT ) ) {
284 $row .= Html::rawElement(
'td', [],
285 Html::element(
'span', [
'class' =>
'history-deleted' ],
286 $this->
msg(
'rev-deleted-comment' )->text()
290 $contLang = MediaWikiServices::getInstance()->getContentLanguage();
291 $row .= Html::rawElement(
'td', [
'dir' => $contLang->getDir() ], $formattedComment );
295 $this->getHookRunner()->onImagePageFileHistoryLine( $this,
$file, $row, $rowClass );
297 return Html::rawElement(
'tr', [
'class' => $rowClass ], $row ) .
"\n";
307 if ( !
$file->allowInlineDisplay() ||
308 $file->isDeleted( File::DELETED_FILE ) ||
309 !
$file->userCan( File::DELETED_FILE, $user )
314 $thumbnail =
$file->transform(
318 'isFilePageThumb' => $iscur
328 'filehist-thumbtext',
329 $lang->userTimeAndDate( $timestamp, $user ),
330 $lang->userDate( $timestamp, $user ),
331 $lang->userTime( $timestamp, $user )
333 return $thumbnail->toHtml( [
'alt' => $alt,
'file-link' =>
true ] );