From: Patrick Westerhoff Date: Sat, 25 Oct 2014 01:51:28 +0000 (+0200) Subject: API: Make `usernames` a local variable X-Git-Tag: 1.31.0-rc.0~13336^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/pie.php?a=commitdiff_plain;h=d099d3e3cda436774841d60c193b4eff03b37ef0;p=lhc%2Fweb%2Fwiklou.git API: Make `usernames` a local variable Instead of having a single-purpose instance variable, keep the array local. This also allows reusing `prepareUsername` for other parameters. Change-Id: Iea7c3c1f24a371a665ebdbeeb3e827262246f1b3 --- diff --git a/includes/api/ApiQueryBlocks.php b/includes/api/ApiQueryBlocks.php index 5c44173c04..b7779a7317 100644 --- a/includes/api/ApiQueryBlocks.php +++ b/includes/api/ApiQueryBlocks.php @@ -31,11 +31,6 @@ */ class ApiQueryBlocks extends ApiQueryBase { - /** - * @var array - */ - protected $usernames; - public function __construct( ApiQuery $query, $moduleName ) { parent::__construct( $query, $moduleName, 'bk' ); } @@ -102,10 +97,11 @@ class ApiQueryBlocks extends ApiQueryBase { $this->addWhereFld( 'ipb_id', $params['ids'] ); } if ( isset( $params['users'] ) ) { + $usernames = array(); foreach ( (array)$params['users'] as $u ) { - $this->prepareUsername( $u ); + $usernames[] = $this->prepareUsername( $u ); } - $this->addWhereFld( 'ipb_address', $this->usernames ); + $this->addWhereFld( 'ipb_address', $usernames ); $this->addWhereFld( 'ipb_auto', 0 ); } if ( isset( $params['ip'] ) ) { @@ -264,7 +260,7 @@ class ApiQueryBlocks extends ApiQueryBase { if ( $name === false ) { $this->dieUsage( "User name {$user} is not valid", 'param_user' ); } - $this->usernames[] = $name; + return $name; } public function getAllowedParams() {