* (bug 28372) Fix bogus link to suppressed file versions in ForeignDBRepo
authorBrion Vibber <brion@users.mediawiki.org>
Wed, 6 Apr 2011 18:45:27 +0000 (18:45 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Wed, 6 Apr 2011 18:45:27 +0000 (18:45 +0000)
Based on patch by Umherirrender: https://bugzilla.wikimedia.org/attachment.cgi?id=8361&action=edit
If file is not local, we can't make a link so don't.

RELEASE-NOTES
includes/ImagePage.php

index 7105e79..bdb16cf 100644 (file)
@@ -230,6 +230,7 @@ PHP if you have not done so prior to upgrading MediaWiki.
 * (bug 28395) Set forgotten parameters types in ApiParse
 * (bug 28430) Make html and TeX output of <math> always be left-to-right.
 * (bug 28306) Fix exposure of suppressed usernames in ForeignDBRepo
+* (bug 28372) Fix bogus link to suppressed file versions in ForeignDBRepo
 
 === API changes in 1.18 ===
 * (bug 26339) Throw warning when truncating an overlarge API result
index b1304f5..c155529 100644 (file)
@@ -1045,20 +1045,24 @@ class ImageHistoryList {
                        # Don't link to unviewable files
                        $row .= '<span class="history-deleted">' . $wgLang->timeAndDate( $timestamp, true ) . '</span>';
                } elseif ( $file->isDeleted( File::DELETED_FILE ) ) {
-                       $this->preventClickjacking();
-                       $revdel = SpecialPage::getTitleFor( 'Revisiondelete' );
-                       # Make a link to review the image
-                       $url = $this->skin->link(
-                               $revdel,
-                               $wgLang->timeAndDate( $timestamp, true ),
-                               array(),
-                               array(
-                                       'target' => $this->title->getPrefixedText(),
-                                       'file' => $img,
-                                       'token' => $wgUser->editToken( $img )
-                               ),
-                               array( 'known', 'noclasses' )
-                       );
+                       if ( $local ) {
+                               $this->preventClickjacking();
+                               $revdel = SpecialPage::getTitleFor( 'Revisiondelete' );
+                               # Make a link to review the image
+                               $url = $this->skin->link(
+                                       $revdel,
+                                       $wgLang->timeAndDate( $timestamp, true ),
+                                       array(),
+                                       array(
+                                               'target' => $this->title->getPrefixedText(),
+                                               'file' => $img,
+                                               'token' => $wgUser->editToken( $img )
+                                       ),
+                                       array( 'known', 'noclasses' )
+                               );
+                       } else {
+                               $url = $wgLang->timeAndDate( $timestamp, true );
+                       }
                        $row .= '<span class="history-deleted">' . $url . '</span>';
                } else {
                        $url = $iscur ? $this->current->getUrl() : $this->current->getArchiveUrl( $img );