API: Warn when neither rawcontinue nor continue are given to action=query
authorBrad Jorsch <bjorsch@wikimedia.org>
Sat, 13 Sep 2014 18:02:37 +0000 (14:02 -0400)
committerAaron Schulz <aschulz@wikimedia.org>
Tue, 21 Oct 2014 19:16:05 +0000 (19:16 +0000)
The default behavior for continuation for action=query will be changing.
Warn clients that they will need to update.

Change-Id: I52d048040e898a0c9630e2aed071b339ec12de42

includes/api/ApiQuery.php
tests/phpunit/includes/api/query/ApiQueryContinueTestBase.php
tests/phpunit/includes/api/query/ApiQueryTestBase.php

index aa0612f..cf63a7d 100644 (file)
@@ -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' );
index bce6268..a5f2684 100644 (file)
@@ -62,6 +62,8 @@ abstract class ApiQueryContinueTestBase extends ApiQueryTestBase {
                }
                if ( $useContinue && !isset( $params['continue'] ) ) {
                        $params['continue'] = '';
+               } else {
+                       $params['rawcontinue'] = '1';
                }
                $count = 0;
                $result = array();
index 56c15b2..1220bb4 100644 (file)
@@ -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 ) );