133 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
137 $uploader =
$file->getUploader( File::FOR_THIS_USER, $user );
139 $local = $this->current->isLocal();
143 if ( $local && ( $this->
getAuthority()->isAllowedAny(
'delete',
'deletedhistory' ) ) ) {
144 $row .= Html::openElement(
'td' );
145 # Link to hide content. Don't show useless link to people who cannot hide revisions.
146 if ( !$iscur && $this->
getAuthority()->isAllowed(
'deleterevision' ) ) {
148 if ( !
$file->userCan( File::DELETED_RESTRICTED, $user ) || !
$file->exists() ) {
149 $row .= Html::check(
'deleterevisions',
false, [
'disabled' =>
'disabled' ] );
151 $row .= Html::check(
'ids[' . explode(
'!',
$img, 2 )[0] .
']',
false );
157 # Link to remove from history
159 if (
$file->exists() ) {
160 $row .= $linkRenderer->makeKnownLink(
162 $this->
msg( $iscur ?
'filehist-deleteall' :
'filehist-deleteone' )->text(),
164 [
'action' =>
'delete',
'oldimage' => $iscur ? null :
$img ]
168 $row .= $this->
msg(
'filehist-missing' )->escaped();
172 $row .= Html::closeElement(
'td' );
176 $row .= Html::openElement(
'td' );
178 $row .= $this->
msg(
'filehist-current' )->escaped();
179 } elseif ( $local && $this->
getAuthority()->probablyCan(
'edit', $this->title )
180 && $this->
getAuthority()->probablyCan(
'upload', $this->title )
182 if (
$file->isDeleted( File::DELETED_FILE ) ) {
183 $row .= $this->
msg(
'filehist-revert' )->escaped();
184 } elseif ( !
$file->exists() ) {
186 $row .= $this->
msg(
'filehist-missing' )->escaped();
188 $row .= $linkRenderer->makeKnownLink(
190 $this->
msg(
'filehist-revert' )->text(),
193 'action' =>
'revert',
199 $row .= Html::closeElement(
'td' );
202 $selected =
$file->getTimestamp() === $this->img->getTimestamp();
203 $row .= Html::openElement(
'td', [
204 'class' => $selected ?
'filehistory-selected' :
null,
205 'style' =>
'white-space: nowrap;'
207 if ( !
$file->userCan( File::DELETED_FILE, $user ) ) {
208 # Don't link to unviewable files
209 $row .= Html::element(
'span', [
'class' =>
'history-deleted' ],
210 $lang->userTimeAndDate( $timestamp, $user )
212 } elseif (
$file->isDeleted( File::DELETED_FILE ) ) {
213 $timeAndDate =
$lang->userTimeAndDate( $timestamp, $user );
216 # Make a link to review the image
217 $url = $linkRenderer->makeKnownLink(
222 'target' => $this->title->getPrefixedText(),
224 'token' => $user->getEditToken(
$img )
228 $url = htmlspecialchars( $timeAndDate );
230 $row .= Html::rawElement(
'span', [
'class' =>
'history-deleted' ], $url );
231 } elseif ( !
$file->exists() ) {
232 $row .= Html::element(
'span', [
'class' =>
'mw-file-missing' ],
233 $lang->userTimeAndDate( $timestamp, $user )
236 $url = $iscur ? $this->current->getUrl() : $this->current->getArchiveUrl(
$img );
237 $row .= Html::element(
'a', [
'href' => $url ],
238 $lang->userTimeAndDate( $timestamp, $user )
241 $row .= Html::closeElement(
'td' );
244 if ( $this->showThumb ) {
245 $row .= Html::rawElement(
'td', [],
251 $row .= Html::openElement(
'td' );
252 $row .= htmlspecialchars(
$file->getDimensionsString() );
253 $row .= $this->
msg(
'word-separator' )->escaped();
254 $row .= Html::element(
'span', [
'style' =>
'white-space: nowrap;' ],
255 $this->
msg(
'parentheses' )->sizeParams(
$file->getSize() )->text()
257 $row .= Html::closeElement(
'td' );
260 $row .= Html::openElement(
'td' );
262 if ( $uploader && $local ) {
263 $row .= Linker::userLink( $uploader->getId(), $uploader->getName() );
264 $row .= Html::rawElement(
'span', [
'style' =>
'white-space: nowrap;' ],
265 Linker::userToolLinks( $uploader->getId(), $uploader->getName() )
267 } elseif ( $uploader ) {
268 $row .= htmlspecialchars( $uploader->getName() );
270 $row .= Html::element(
'span', [
'class' =>
'history-deleted' ],
271 $this->
msg(
'rev-deleted-user' )->text()
274 $row .= Html::closeElement(
'td' );
277 if (
$file->isDeleted( File::DELETED_COMMENT ) ) {
278 $row .= Html::rawElement(
'td', [],
279 Html::element(
'span', [
'class' =>
'history-deleted' ],
280 $this->
msg(
'rev-deleted-comment' )->text()
284 $contLang = MediaWikiServices::getInstance()->getContentLanguage();
285 $row .= Html::rawElement(
'td', [
'dir' => $contLang->getDir() ], $formattedComment );
289 $this->getHookRunner()->onImagePageFileHistoryLine( $this,
$file, $row, $rowClass );
291 return Html::rawElement(
'tr', [
'class' => $rowClass ], $row ) .
"\n";
301 if ( !
$file->allowInlineDisplay() ||
302 $file->isDeleted( File::DELETED_FILE ) ||
303 !
$file->userCan( File::DELETED_FILE, $user )
308 $thumbnail =
$file->transform(
313 'isFilePageThumb' => $iscur
323 'filehist-thumbtext',
324 $lang->userTimeAndDate( $timestamp, $user ),
325 $lang->userDate( $timestamp, $user ),
326 $lang->userTime( $timestamp, $user )
328 return $thumbnail->toHtml( [
'alt' => $alt,
'file-link' =>
true ] );