X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiMain.php;h=9f88cd6d7f4b5c572ada1e3b5c978c7abd8846fa;hb=503cd2f4ae5f75eb110d67abcb5d3065cdc14a82;hp=91b8cc834b3c71481030e8dac27b3c55b75cc017;hpb=ec81140f9b8edcd25410bc5e5835c634843d36dc;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index 91b8cc834b..9f88cd6d7f 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -51,6 +51,7 @@ class ApiMain extends ApiBase { private static $Modules = array( 'login' => 'ApiLogin', 'logout' => 'ApiLogout', + 'createaccount' => 'ApiCreateAccount', 'query' => 'ApiQuery', 'expandtemplates' => 'ApiExpandTemplates', 'parse' => 'ApiParse', @@ -131,7 +132,7 @@ class ApiMain extends ApiBase { private $mPrinter; private $mModules, $mModuleNames, $mFormats, $mFormatNames; - private $mResult, $mAction, $mShowVersions, $mEnableWrite; + private $mResult, $mAction, $mEnableWrite; private $mInternalMode, $mSquidMaxage, $mModule; private $mCacheMode = 'private'; @@ -187,7 +188,6 @@ class ApiMain extends ApiBase { $this->mFormatNames = array_keys( $this->mFormats ); $this->mResult = new ApiResult( $this ); - $this->mShowVersions = false; $this->mEnableWrite = $enableWrite; $this->mSquidMaxage = - 1; // flag for executeActionWithErrorHandling() @@ -375,7 +375,7 @@ class ApiMain extends ApiBase { wfRunHooks( 'ApiMain::onException', array( $this, $e ) ); // Log it - if ( !( $e instanceof UsageException ) ) { + if ( $e instanceof MWException && !( $e instanceof UsageException ) ) { global $wgLogExceptionBacktrace; if ( $wgLogExceptionBacktrace ) { wfDebugLog( 'exception', $e->getLogMessage() . "\n" . $e->getTraceAsString() . "\n" ); @@ -680,7 +680,6 @@ class ApiMain extends ApiBase { $params = $this->extractRequestParams(); - $this->mShowVersions = $params['version']; $this->mAction = $params['action']; if ( !is_string( $this->mAction ) ) { @@ -875,7 +874,7 @@ class ApiMain extends ApiBase { if ( !$table ) { $chars = ';@$!*(),/:'; for ( $i = 0; $i < strlen( $chars ); $i++ ) { - $table[ rawurlencode( $chars[$i] ) ] = $chars[$i]; + $table[rawurlencode( $chars[$i] )] = $chars[$i]; } } return strtr( rawurlencode( $s ), $table ); @@ -967,7 +966,6 @@ class ApiMain extends ApiBase { ApiBase::PARAM_DFLT => 'help', ApiBase::PARAM_TYPE => $this->mModuleNames ), - 'version' => false, 'maxlag' => array( ApiBase::PARAM_TYPE => 'integer' ), @@ -994,12 +992,11 @@ class ApiMain extends ApiBase { return array( 'format' => 'The format of the output', 'action' => 'What action you would like to perform. See below for module help', - 'version' => 'When showing help, include version for each module', 'maxlag' => array( 'Maximum lag can be used when MediaWiki is installed on a database replicated cluster.', 'To save actions causing any more site replication lag, this parameter can make the client', 'wait until the replication lag is less than the specified value.', - 'In case of a replag error, a HTTP 503 error is returned, with the message like', + 'In case of a replag error, error code "maxlag" is returned, with the message like', '"Waiting for $host: $lag seconds lagged\n".', 'See https://www.mediawiki.org/wiki/Manual:Maxlag_parameter for more information', ), @@ -1110,8 +1107,7 @@ class ApiMain extends ApiBase { $this->setHelp(); // Get help text from cache if present $key = wfMemcKey( 'apihelp', $this->getModuleName(), - SpecialVersion::getVersion( 'nodb' ) . - $this->getShowVersions() ); + SpecialVersion::getVersion( 'nodb' ) ); if ( $wgAPICacheHelpTimeout > 0 ) { $cached = $wgMemc->get( $key ); if ( $cached ) { @@ -1139,6 +1135,7 @@ class ApiMain extends ApiBase { foreach ( array_keys( $this->mModules ) as $moduleName ) { $module = new $this->mModules[$moduleName] ( $this, $moduleName ); $msg .= self::makeHelpMsgHeader( $module, 'action' ); + $msg2 = $module->makeHelpMsg(); if ( $msg2 !== false ) { $msg .= $msg2; @@ -1149,9 +1146,8 @@ class ApiMain extends ApiBase { $msg .= "\n$astriks Permissions $astriks\n\n"; foreach ( self::$mRights as $right => $rightMsg ) { $groups = User::getGroupsWithPermission( $right ); - $msg .= "* " . $right . " *\n " . wfMsgReplaceArgs( $rightMsg[ 'msg' ], $rightMsg[ 'params' ] ) . + $msg .= "* " . $right . " *\n " . wfMsgReplaceArgs( $rightMsg['msg'], $rightMsg['params'] ) . "\nGranted to:\n " . str_replace( '*', 'all', implode( ', ', $groups ) ) . "\n\n"; - } $msg .= "\n$astriks Formats $astriks\n\n"; @@ -1201,25 +1197,11 @@ class ApiMain extends ApiBase { /** * Check whether the user wants us to show version information in the API help * @return bool + * @deprecated since 1.21, always returns false */ public function getShowVersions() { - return $this->mShowVersions; - } - - /** - * Returns the version information of this file, plus it includes - * the versions for all files that are not callable proper API modules - * - * @return array - */ - public function getVersion() { - $vers = array(); - $vers[] = 'MediaWiki: ' . SpecialVersion::getVersion() . "\n https://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/"; - $vers[] = __CLASS__ . ': $Id$'; - $vers[] = ApiBase::getBaseVersion(); - $vers[] = ApiFormatBase::getBaseVersion(); - $vers[] = ApiQueryBase::getBaseVersion(); - return $vers; + wfDeprecated( __METHOD__, '1.21' ); + return false; } /**