X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiBase.php;h=9b3d11664df93b243c913ae9134b6e8cd9f6fc70;hb=044d888c41427967cd6f14303d300ceefa54d0c5;hp=53c0a0b0bd4bb0ab10da45f5856581928ca061af;hpb=747bdd543d301e0816aa811806c6cc6b17ec1038;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiBase.php b/includes/api/ApiBase.php index 53c0a0b0bd..9b3d11664d 100644 --- a/includes/api/ApiBase.php +++ b/includes/api/ApiBase.php @@ -1805,13 +1805,16 @@ abstract class ApiBase extends ContextSource { $status = Status::newGood(); foreach ( $errors as $error ) { - if ( is_array( $error ) && isset( self::$blockMsgMap[$error[0]] ) && $user->getBlock() ) { + if ( !is_array( $error ) ) { + $error = [ $error ]; + } + if ( is_string( $error[0] ) && isset( self::$blockMsgMap[$error[0]] ) && $user->getBlock() ) { list( $msg, $code ) = self::$blockMsgMap[$error[0]]; $status->fatal( ApiMessage::create( $msg, $code, [ 'blockinfo' => ApiQueryUserInfo::getBlockInfo( $user->getBlock() ) ] ) ); } else { - $status->fatal( ...(array)$error ); + $status->fatal( ...$error ); } } return $status; @@ -2222,6 +2225,15 @@ abstract class ApiBase extends ContextSource { * @param string $feature Feature being used. */ public function logFeatureUsage( $feature ) { + static $loggedFeatures = []; + + // Only log each feature once per request. We can get multiple calls from calls to + // extractRequestParams() with different values for 'parseLimit', for example. + if ( isset( $loggedFeatures[$feature] ) ) { + return; + } + $loggedFeatures[$feature] = true; + $request = $this->getRequest(); $ctx = [ 'feature' => $feature,