X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/pie.php?a=blobdiff_plain;f=includes%2Fapi%2FApiMain.php;h=ae3f3f2458fabea074b8e2e2c3dd7c28dfc4a1ef;hb=6244b8c23a7c15be3d9de2130d290a2437bb6587;hp=565e829f7976444407fa8c662ddf2bd0eea7aa6a;hpb=c64cbee7fcc4a4c46b82185038b11f29f4b40f50;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiMain.php b/includes/api/ApiMain.php index 565e829f79..ae3f3f2458 100644 --- a/includes/api/ApiMain.php +++ b/includes/api/ApiMain.php @@ -1103,18 +1103,7 @@ class ApiMain extends ApiBase { $this->dieUsageMsg( [ 'missingparam', 'token' ] ); } - if ( !$this->getConfig()->get( 'DebugAPI' ) && - array_key_exists( - $module->encodeParamName( 'token' ), - $this->getRequest()->getQueryValues() - ) - ) { - $this->dieUsage( - "The '{$module->encodeParamName( 'token' )}' parameter was " . - 'found in the query string, but must be in the POST body', - 'mustposttoken' - ); - } + $module->requirePostedParameters( [ 'token' ] ); if ( !$module->validateToken( $moduleParams['token'], $moduleParams ) ) { $this->dieUsageMsg( 'sessionfailure' ); @@ -1310,7 +1299,7 @@ class ApiMain extends ApiBase { } if ( $module->isWriteMode() - && in_array( 'bot', $this->getUser()->getGroups() ) + && $this->getUser()->isBot() && wfGetLB()->getServerCount() > 1 ) { $this->checkBotReadOnly(); @@ -1333,9 +1322,9 @@ class ApiMain extends ApiBase { } } - // If a majority of slaves are too lagged then disallow writes - $slaveCount = wfGetLB()->getServerCount() - 1; - if ( $numLagged >= ceil( $slaveCount / 2 ) ) { + // If a majority of replica DBs are too lagged then disallow writes + $replicaCount = wfGetLB()->getServerCount() - 1; + if ( $numLagged >= ceil( $replicaCount / 2 ) ) { $laggedServers = implode( ', ', $laggedServers ); wfDebugLog( 'api-readonly',