Merge "Improved readability of MediaWikiParserTest::suite code"
[lhc/web/wiklou.git] / includes / api / ApiMain.php
index 80bca2f..99847cf 100644 (file)
@@ -83,7 +83,7 @@ class ApiMain extends ApiBase {
                'import' => 'ApiImport',
                'userrights' => 'ApiUserrights',
                'options' => 'ApiOptions',
-               'imagerotate' =>'ApiImageRotate',
+               'imagerotate' => 'ApiImageRotate',
        );
 
        /**
@@ -418,7 +418,7 @@ class ApiMain extends ApiBase {
                }
 
                // Log the request whether or not there was an error
-               $this->logRequest( microtime( true ) - $t);
+               $this->logRequest( microtime( true ) - $t );
 
                // Send cache headers after any code which might generate an error, to
                // avoid sending public cache headers for errors.
@@ -788,7 +788,7 @@ class ApiMain extends ApiBase {
 
                // Allow extensions to stop execution for arbitrary reasons.
                $message = false;
-               if( !wfRunHooks( 'ApiCheckCanExecute', array( $module, $user, &$message ) ) ) {
+               if ( !wfRunHooks( 'ApiCheckCanExecute', array( $module, $user, &$message ) ) ) {
                        $this->dieUsageMsg( $message );
                }
        }
@@ -863,7 +863,7 @@ class ApiMain extends ApiBase {
                        ' ' . $request->getMethod() .
                        ' ' . wfUrlencode( str_replace( ' ', '_', $this->getUser()->getName() ) ) .
                        ' ' . $request->getIP() .
-                       ' T=' . $milliseconds .'ms';
+                       ' T=' . $milliseconds . 'ms';
                foreach ( $this->getParamsUsed() as $name ) {
                        $value = $request->getVal( $name );
                        if ( $value === null ) {
@@ -950,7 +950,7 @@ class ApiMain extends ApiBase {
                        $unusedParams = array_diff( $allParams, $paramsUsed );
                }
 
-               if( count( $unusedParams ) ) {
+               if ( count( $unusedParams ) ) {
                        $s = count( $unusedParams ) > 1 ? 's' : '';
                        $this->setWarning( "Unrecognized parameter$s: '" . implode( $unusedParams, "', '" ) . "'" );
                }
@@ -963,7 +963,7 @@ class ApiMain extends ApiBase {
         */
        protected function printResult( $isError ) {
                global $wgDebugAPI;
-               if( $wgDebugAPI !== false ) {
+               if ( $wgDebugAPI !== false ) {
                        $this->setWarning( 'SECURITY WARNING: $wgDebugAPI is enabled' );
                }
 
@@ -1008,7 +1008,7 @@ class ApiMain extends ApiBase {
                                ApiBase::PARAM_DFLT => 'help',
                                ApiBase::PARAM_TYPE => $this->mModuleMgr->getNames( 'action' )
                        ),
-                       'maxlag'  => array(
+                       'maxlag' => array(
                                ApiBase::PARAM_TYPE => 'integer'
                        ),
                        'smaxage' => array(
@@ -1020,7 +1020,7 @@ class ApiMain extends ApiBase {
                                ApiBase::PARAM_DFLT => 0
                        ),
                        'requestid' => null,
-                       'servedby'  => false,
+                       'servedby' => false,
                        'origin' => null,
                );
        }
@@ -1048,6 +1048,7 @@ class ApiMain extends ApiBase {
                        'servedby' => 'Include the hostname that served the request in the results. Unconditionally shown on error',
                        'origin' => array(
                                'When accessing the API using a cross-domain AJAX request (CORS), set this to the originating domain.',
+                               'This must be included in any pre-flight request, and therefore must be part of the request URI (not the POST body).',
                                'This must match one of the origins in the Origin: header exactly, so it has to be set to something like http://en.wikipedia.org or https://meta.wikimedia.org .',
                                'If this parameter does not match the Origin: header, a 403 response will be returned.',
                                'If this parameter matches the Origin: header and the origin is whitelisted, an Access-Control-Allow-Origin header will be set.',