(bug 36751) InstantCommons doesn't follow redirects
authorbtongminh <bryan.tongminh@gmail.com>
Sat, 22 Dec 2012 15:36:16 +0000 (16:36 +0100)
committerbtongminh <bryan.tongminh@gmail.com>
Sat, 22 Dec 2012 15:36:16 +0000 (16:36 +0100)
This fixes r56837: now redirects are only skipped if the redirects query
parameter is not set. This was presumably the intent of that commit, see
https://www.mediawiki.org/wiki/Special:Code/MediaWiki/56837#code-comments

Change-Id: I27485bba9fe196211baeeb84238e4a397c620a1d

RELEASE-NOTES-1.21
includes/api/ApiQueryImageInfo.php

index 46d69d0..608d7bb 100644 (file)
@@ -132,6 +132,7 @@ production.
 * (bug 27202) Add timestamp sort to list=allimages.
 * (bug 43137) Don't return the sha1 of revisions through the API if the content is
   revision-deleted
+* ApiQueryImageInfo now also returns imageinfo for redirects.
 
 === Languages updated in 1.21 ===
 
index 1933c78..2be3393 100644 (file)
@@ -79,14 +79,15 @@ class ApiQueryImageInfo extends ApiQueryBase {
                        } else {
                                $images = RepoGroup::singleton()->findFiles( $titles );
                        }
+                       $resolveRedirects = $this->getPageSet()->isResolvingRedirects();
                        foreach ( $images as $img ) {
                                // Skip redirects
-                               if ( $img->getOriginalTitle()->isRedirect() ) {
+                               if ( $img->getOriginalTitle()->isRedirect() && !$resolveRedirects ) {
                                        continue;
                                }
 
                                $start = $skip ? $fromTimestamp : $params['start'];
-                               $pageId = $pageIds[NS_FILE][ $img->getOriginalTitle()->getDBkey() ];
+                               $pageId = $pageIds[NS_FILE][ $img->getTitle()->getDBkey() ];
 
                                $fit = $result->addValue(
                                        array( 'query', 'pages', intval( $pageId ) ),