139 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
143 $uploader =
$file->getUploader( File::FOR_THIS_USER, $user );
145 $local = $this->current->isLocal();
149 if ( $local && ( $this->
getAuthority()->isAllowedAny(
'delete',
'deletedhistory' ) ) ) {
150 $row .= Html::openElement(
'td' );
151 # Link to remove from history
153 $row .= $linkRenderer->makeKnownLink(
155 $this->
msg( $iscur ?
'filehist-deleteall' :
'filehist-deleteone' )->text(),
157 [
'action' =>
'delete',
'oldimage' => $iscur ? null :
$img ]
160 # Link to hide content. Don't show useless link to people who cannot hide revisions.
161 $canHide = $this->
getAuthority()->isAllowed(
'deleterevision' );
162 if ( $canHide || ( $this->
getAuthority()->isAllowed(
'deletedhistory' )
163 &&
$file->getVisibility() ) ) {
165 $row .= Html::element(
'br' );
168 if ( $iscur || !
$file->userCan( File::DELETED_RESTRICTED, $user ) ) {
173 'type' =>
'oldimage',
174 'target' => $this->title->getPrefixedText(),
175 'ids' => explode(
'!',
$img, 2 )[0],
177 $file->isDeleted( File::DELETED_RESTRICTED ),
182 $row .= Html::closeElement(
'td' );
186 $row .= Html::openElement(
'td' );
188 $row .= $this->
msg(
'filehist-current' )->escaped();
189 } elseif ( $local && $this->
getAuthority()->probablyCan(
'edit', $this->title )
190 && $this->
getAuthority()->probablyCan(
'upload', $this->title )
192 if (
$file->isDeleted( File::DELETED_FILE ) ) {
193 $row .= $this->
msg(
'filehist-revert' )->escaped();
195 $row .= $linkRenderer->makeKnownLink(
197 $this->
msg(
'filehist-revert' )->text(),
200 'action' =>
'revert',
206 $row .= Html::closeElement(
'td' );
209 $selected =
$file->getTimestamp() === $this->img->getTimestamp();
210 $row .= Html::openElement(
'td', [
211 'class' => $selected ?
'filehistory-selected' :
null,
212 'style' =>
'white-space: nowrap;'
214 if ( !
$file->userCan( File::DELETED_FILE, $user ) ) {
215 # Don't link to unviewable files
216 $row .= Html::element(
'span', [
'class' =>
'history-deleted' ],
217 $lang->userTimeAndDate( $timestamp, $user )
219 } elseif (
$file->isDeleted( File::DELETED_FILE ) ) {
220 $timeAndDate =
$lang->userTimeAndDate( $timestamp, $user );
223 # Make a link to review the image
224 $url = $linkRenderer->makeKnownLink(
229 'target' => $this->title->getPrefixedText(),
231 'token' => $user->getEditToken(
$img )
235 $url = htmlspecialchars( $timeAndDate );
237 $row .= Html::rawElement(
'span', [
'class' =>
'history-deleted' ], $url );
238 } elseif ( !
$file->exists() ) {
239 $row .= Html::element(
'span', [
'class' =>
'mw-file-missing' ],
240 $lang->userTimeAndDate( $timestamp, $user )
243 $url = $iscur ? $this->current->getUrl() : $this->current->getArchiveUrl(
$img );
244 $row .= Html::element(
'a', [
'href' => $url ],
245 $lang->userTimeAndDate( $timestamp, $user )
248 $row .= Html::closeElement(
'td' );
251 if ( $this->showThumb ) {
252 $row .= Html::rawElement(
'td', [],
258 $row .= Html::openElement(
'td' );
259 $row .= htmlspecialchars(
$file->getDimensionsString() );
260 $row .= $this->
msg(
'word-separator' )->escaped();
261 $row .= Html::element(
'span', [
'style' =>
'white-space: nowrap;' ],
262 $this->
msg(
'parentheses' )->sizeParams(
$file->getSize() )->text()
264 $row .= Html::closeElement(
'td' );
267 $row .= Html::openElement(
'td' );
269 if ( $uploader && $local ) {
271 $row .= Html::rawElement(
'span', [
'style' =>
'white-space: nowrap;' ],
274 } elseif ( $uploader ) {
275 $row .= htmlspecialchars( $uploader->getName() );
277 $row .= Html::element(
'span', [
'class' =>
'history-deleted' ],
278 $this->
msg(
'rev-deleted-user' )->text()
281 $row .= Html::closeElement(
'td' );
284 if (
$file->isDeleted( File::DELETED_COMMENT ) ) {
285 $row .= Html::rawElement(
'td', [],
286 Html::element(
'span', [
'class' =>
'history-deleted' ],
287 $this->
msg(
'rev-deleted-comment' )->text()
291 $contLang = MediaWikiServices::getInstance()->getContentLanguage();
292 $row .= Html::rawElement(
'td', [
'dir' => $contLang->getDir() ], $formattedComment );
296 $this->getHookRunner()->onImagePageFileHistoryLine( $this,
$file, $row, $rowClass );
298 return Html::rawElement(
'tr', [
'class' => $rowClass ], $row ) .
"\n";
308 if ( !
$file->allowInlineDisplay() ||
309 $file->isDeleted( File::DELETED_FILE ) ||
310 !
$file->userCan( File::DELETED_FILE, $user )
315 $thumbnail =
$file->transform(
319 'isFilePageThumb' => $iscur
329 'filehist-thumbtext',
330 $lang->userTimeAndDate( $timestamp, $user ),
331 $lang->userDate( $timestamp, $user ),
332 $lang->userTime( $timestamp, $user )
334 return $thumbnail->toHtml( [
'alt' => $alt,
'file-link' =>
true ] );