Bug 23851. Repair diff views for FILE pages that are redirects.
authorDerk-Jan Hartman <hartman@users.mediawiki.org>
Wed, 9 Jun 2010 21:09:13 +0000 (21:09 +0000)
committerDerk-Jan Hartman <hartman@users.mediawiki.org>
Wed, 9 Jun 2010 21:09:13 +0000 (21:09 +0000)
Diffs for FILE redirects will force diffonly == true because otherwise full images
are included into the rendering by DiffEngine.

RELEASE-NOTES
includes/ImagePage.php

index ebcbd86..73ce0bd 100644 (file)
@@ -213,6 +213,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 23834) Invalid "thumbwidth" and "thumbheight" in "imageinfo" query when
   thumbnailing larger than original image
 * (bug 23835) Need "thumbmime" result in "imageinfo" query
+* (bug 23851) Repair diff for file redirect pages
 
 === Languages updated in 1.17 ===
 
index 93d9967..07bc7d2 100644 (file)
@@ -61,12 +61,21 @@ class ImagePage extends Article {
 
        public function view() {
                global $wgOut, $wgShowEXIF, $wgRequest, $wgUser;
+
+               $diff = $wgRequest->getVal( 'diff' );
+               $diffOnly = $wgRequest->getBool( 'diffonly', $wgUser->getOption( 'diffonly' ) );
+
+               if ( $this->mTitle->getNamespace() != NS_FILE || ( isset( $diff ) && $diffOnly ) ) {
+                       return Article::view();
+               }
+                       
                $this->loadFile();
 
                if ( $this->mTitle->getNamespace() == NS_FILE && $this->img->getRedirected() ) {
-                       if ( $this->mTitle->getDBkey() == $this->img->getName() ) {
+                       if ( $this->mTitle->getDBkey() == $this->img->getName() || isset( $diff ) ) {
                                // mTitle is the same as the redirect target so ask Article
                                // to perform the redirect for us.
+                               $wgRequest->setVal( 'diffonly', 'true' );
                                return Article::view();
                        } else {
                                // mTitle is not the same as the redirect target so it is 
@@ -79,12 +88,6 @@ class ImagePage extends Article {
                        }
                }
 
-               $diff = $wgRequest->getVal( 'diff' );
-               $diffOnly = $wgRequest->getBool( 'diffonly', $wgUser->getOption( 'diffonly' ) );
-
-               if ( $this->mTitle->getNamespace() != NS_FILE || ( isset( $diff ) && $diffOnly ) )
-                       return Article::view();
-                       
                $this->showRedirectedFromHeader();
 
                if ( $wgShowEXIF && $this->displayImg->exists() ) {