From 8880967034c0789320ce3e5c3f862d797e6acad3 Mon Sep 17 00:00:00 2001 From: Derk-Jan Hartman Date: Wed, 9 Jun 2010 21:09:13 +0000 Subject: [PATCH] Bug 23851. Repair diff views for FILE pages that are redirects. Diffs for FILE redirects will force diffonly == true because otherwise full images are included into the rendering by DiffEngine. --- RELEASE-NOTES | 1 + includes/ImagePage.php | 17 ++++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index ebcbd866b3..73ce0bde86 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -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 === diff --git a/includes/ImagePage.php b/includes/ImagePage.php index 93d9967e90..07bc7d29d9 100644 --- a/includes/ImagePage.php +++ b/includes/ImagePage.php @@ -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() ) { -- 2.20.1