From: Brad Jorsch Date: Thu, 30 Oct 2014 17:30:45 +0000 (-0400) Subject: API: Fix simplified continuation module skipping X-Git-Tag: 1.31.0-rc.0~13430^2 X-Git-Url: http://git.cyclocoop.org//%27%40script%40/%27?a=commitdiff_plain;h=c2e6bdfce71792b97d9eb76e4ffd9b83b1af71af;p=lhc%2Fweb%2Fwiklou.git API: Fix simplified continuation module skipping The simplified continuation includes a continuation parameter to indicate when the prop/list/meta modules are complete, so it can skip executing them. But if someone submitted a malformed value for 'continue', it might decide that the generator was complete but still try to uselessly execute the prop modules. Bug: 72764 Change-Id: I6af24e5d4f30e64782fb7dd1c2211ebdd4ec2317 --- diff --git a/includes/api/ApiQueryBase.php b/includes/api/ApiQueryBase.php index b1581f3152..998cc91c63 100644 --- a/includes/api/ApiQueryBase.php +++ b/includes/api/ApiQueryBase.php @@ -70,6 +70,10 @@ abstract class ApiQueryBase extends ApiBase { /** * Override this method to request extra fields from the pageSet * using $pageSet->requestField('fieldName') + * + * Note this only makes sense for 'prop' modules, as 'list' and 'meta' + * modules should not be using the pageset. + * * @param ApiPageSet $pageSet */ public function requestExtraData( $pageSet ) { diff --git a/includes/api/ApiResult.php b/includes/api/ApiResult.php index 946977d97f..5bc2efbc70 100644 --- a/includes/api/ApiResult.php +++ b/includes/api/ApiResult.php @@ -481,10 +481,14 @@ class ApiResult extends ApiBase { $continue = explode( '||', $continue ); $this->dieContinueUsageIf( count( $continue ) !== 2 ); $this->generatorDone = ( $continue[0] === '-' ); + $skip = explode( '|', $continue[1] ); if ( !$this->generatorDone ) { $this->generatorParams = explode( '|', $continue[0] ); + } else { + // When the generator is complete, don't run any modules that + // depend on it. + $skip += $this->continueGeneratedModules; } - $skip = explode( '|', $continue[1] ); } $this->continueAllModules = array();