API: Always request page_is_redirect from ApiQueryInfo
authorBrad Jorsch <bjorsch@wikimedia.org>
Mon, 17 Nov 2014 16:18:09 +0000 (11:18 -0500)
committerUmherirrender <umherirrender_de.wp@web.de>
Mon, 17 Nov 2014 18:35:29 +0000 (18:35 +0000)
The ApiPageSet doesn't know for sure whether it will be resolving
redirects until it is executed, as the revids parameter may override
that (and it can't easily check before being executed because it might
never actually be executed). So ApiQueryInfo needs to just
unconditionally request page_is_redirect and only consider later whether
to try using it.

Bug: 73464
Change-Id: I2297158188dae5476c5b9b5755ea26cf5b8ae487

includes/api/ApiQueryInfo.php

index 5e61ed1..263ab0d 100644 (file)
@@ -58,10 +58,10 @@ class ApiQueryInfo extends ApiQueryBase {
         */
        public function requestExtraData( $pageSet ) {
                $pageSet->requestField( 'page_restrictions' );
-               // when resolving redirects, no page will have this field
-               if ( !$pageSet->isResolvingRedirects() ) {
-                       $pageSet->requestField( 'page_is_redirect' );
-               }
+               // If the pageset is resolving redirects we won't get page_is_redirect.
+               // But we can't know for sure until the pageset is executed (revids may
+               // turn it off), so request it unconditionally.
+               $pageSet->requestField( 'page_is_redirect' );
                $pageSet->requestField( 'page_is_new' );
                $config = $this->getConfig();
                $pageSet->requestField( 'page_touched' );