From: Brad Jorsch Date: Sat, 13 Sep 2014 18:02:37 +0000 (-0400) Subject: API: Warn when neither rawcontinue nor continue are given to action=query X-Git-Tag: 1.31.0-rc.0~13523^2 X-Git-Url: http://git.cyclocoop.org/%22.%24info%5B?a=commitdiff_plain;h=af11268d05d98d27d99cfee9264d649a62c2c816;p=lhc%2Fweb%2Fwiklou.git API: Warn when neither rawcontinue nor continue are given to action=query The default behavior for continuation for action=query will be changing. Warn clients that they will need to update. Change-Id: I52d048040e898a0c9630e2aed071b339ec12de42 --- diff --git a/includes/api/ApiQuery.php b/includes/api/ApiQuery.php index aa0612fced..cf63a7dbaa 100644 --- a/includes/api/ApiQuery.php +++ b/includes/api/ApiQuery.php @@ -247,6 +247,16 @@ class ApiQuery extends ApiBase { public function execute() { $this->mParams = $this->extractRequestParams(); + if ( $this->mParams['continue'] === null && !$this->mParams['rawcontinue'] ) { + $this->logFeatureUsage( 'action=query&!rawcontinue&!continue' ); + $this->setWarning( + 'Formatting of continuation data will be changing soon. ' . + 'To continue using the current formatting, use the \'rawcontinue\' parameter. ' . + 'To begin using the new format, pass an empty string for \'continue\' ' . + 'in the initial query.' + ); + } + // Instantiate requested modules $allModules = array(); $this->instantiateModules( $allModules, 'prop' ); diff --git a/tests/phpunit/includes/api/query/ApiQueryContinueTestBase.php b/tests/phpunit/includes/api/query/ApiQueryContinueTestBase.php index bce626853a..a5f26849f5 100644 --- a/tests/phpunit/includes/api/query/ApiQueryContinueTestBase.php +++ b/tests/phpunit/includes/api/query/ApiQueryContinueTestBase.php @@ -62,6 +62,8 @@ abstract class ApiQueryContinueTestBase extends ApiQueryTestBase { } if ( $useContinue && !isset( $params['continue'] ) ) { $params['continue'] = ''; + } else { + $params['rawcontinue'] = '1'; } $count = 0; $result = array(); diff --git a/tests/phpunit/includes/api/query/ApiQueryTestBase.php b/tests/phpunit/includes/api/query/ApiQueryTestBase.php index 56c15b2387..1220bb4891 100644 --- a/tests/phpunit/includes/api/query/ApiQueryTestBase.php +++ b/tests/phpunit/includes/api/query/ApiQueryTestBase.php @@ -95,6 +95,9 @@ STR; if ( !array_key_exists( 'action', $req ) ) { $req['action'] = 'query'; } + if ( !array_key_exists( 'continue', $req ) ) { + $req['rawcontinue'] = '1'; + } foreach ( $req as &$val ) { if ( is_array( $val ) ) { $val = implode( '|', array_unique( $val ) );