Merge "API: Use message-per-value for apihelp-query+alllinks-param-prop"
[lhc/web/wiklou.git] / includes / api / ApiQuery.php
index 304d0f0..8959a46 100644 (file)
@@ -276,6 +276,7 @@ class ApiQuery extends ApiBase {
                }
 
                $cacheMode = $this->mPageSet->getCacheMode();
+               $stats =  $this->getContext()->getStats();
 
                // Execute all unfinished modules
                /** @var $module ApiQueryBase */
@@ -283,6 +284,11 @@ class ApiQuery extends ApiBase {
                        $params = $module->extractRequestParams();
                        $cacheMode = $this->mergeCacheMode(
                                $cacheMode, $module->getCacheMode( $params ) );
+
+                       $statsPath = 'api.modules.' . strtr( $module->getModulePath(), '+', '.' );
+                       $metric = $stats->increment( $statsPath );
+                       $metric->setSampleRate( 0.001 );
+
                        $module->execute();
                        Hooks::run( 'APIQueryAfterExecute', array( &$module ) );
                }
@@ -292,7 +298,7 @@ class ApiQuery extends ApiBase {
 
                // Write the continuation data into the result
                $this->setContinuationManager( null );
-               if ( $this->mParams['continue'] === null ) {
+               if ( $this->mParams['rawcontinue'] ) {
                        $data = $continuationManager->getRawContinuation();
                        if ( $data ) {
                                $this->getResult()->addValue( null, 'query-continue', $data,
@@ -302,15 +308,14 @@ class ApiQuery extends ApiBase {
                        $continuationManager->setContinuationIntoResult( $this->getResult() );
                }
 
+               /// @todo: Remove this after a suitable period of time. When REL1_26 is cut, if not before.
                if ( $this->mParams['continue'] === null && !$this->mParams['rawcontinue'] &&
-                       $this->getResult()->getResultData( 'query-continue' ) !== null
+                       $this->getResult()->getResultData( 'continue' ) !== null
                ) {
-                       $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.'
+                               'Formatting of continuation data has changed. ' .
+                               'To receive raw query-continue data, use the \'rawcontinue\' parameter. ' .
+                               'To silence this warning, pass an empty string for \'continue\' in the initial query.'
                        );
                }
        }
@@ -485,7 +490,7 @@ class ApiQuery extends ApiBase {
        public function setGeneratorContinue( $module, $paramName, $paramValue ) {
                wfDeprecated( __METHOD__, '1.24' );
                $this->getContinuationManager()->addGeneratorContinueParam( $module, $paramName, $paramValue );
-               return $this->getParameter( 'continue' ) !== null;
+               return !$this->getParameter( 'rawcontinue' );
        }
 
        /**
@@ -549,7 +554,9 @@ class ApiQuery extends ApiBase {
                        'export' => false,
                        'exportnowrap' => false,
                        'iwurl' => false,
-                       'continue' => null,
+                       'continue' => array(
+                               ApiBase::PARAM_HELP_MSG => 'api-help-param-continue',
+                       ),
                        'rawcontinue' => false,
                );
                if ( $flags ) {