X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fcache%2FGenderCache.php;h=19695dfaf2638d4001b2536b8e92ea9faa593e06;hb=e3bd13db0c285f312e31bb1b7271af4628cca80c;hp=63e7bfd7466c2704629b37e9819fb83f6788e147;hpb=a717ca3de5f4f1ba164c429c8479d2a853f412a3;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/cache/GenderCache.php b/includes/cache/GenderCache.php index 63e7bfd746..19695dfaf2 100644 --- a/includes/cache/GenderCache.php +++ b/includes/cache/GenderCache.php @@ -28,7 +28,7 @@ * @since 1.18 */ class GenderCache { - protected $cache = array(); + protected $cache = []; protected $default; protected $misses = 0; protected $missLimit = 1000; @@ -101,7 +101,7 @@ class GenderCache { * @param string $caller */ public function doLinkBatch( $data, $caller = '' ) { - $users = array(); + $users = []; foreach ( $data as $ns => $pagenames ) { if ( !MWNamespace::hasGenderDistinction( $ns ) ) { continue; @@ -122,7 +122,7 @@ class GenderCache { * @param string $caller The calling method */ public function doTitlesArray( $titles, $caller = '' ) { - $users = array(); + $users = []; foreach ( $titles as $title ) { $titleObj = is_string( $title ) ? Title::newFromText( $title ) : $title; if ( !$titleObj ) { @@ -145,7 +145,7 @@ class GenderCache { public function doQuery( $users, $caller = '' ) { $default = $this->getDefault(); - $usersToCheck = array(); + $usersToCheck = []; foreach ( (array)$users as $value ) { $name = self::normalizeUsername( $value ); // Skip users whose gender setting we already know @@ -164,17 +164,17 @@ class GenderCache { } $dbr = wfGetDB( DB_SLAVE ); - $table = array( 'user', 'user_properties' ); - $fields = array( 'user_name', 'up_value' ); - $conds = array( 'user_name' => $usersToCheck ); - $joins = array( 'user_properties' => - array( 'LEFT JOIN', array( 'user_id = up_user', 'up_property' => 'gender' ) ) ); + $table = [ 'user', 'user_properties' ]; + $fields = [ 'user_name', 'up_value' ]; + $conds = [ 'user_name' => $usersToCheck ]; + $joins = [ 'user_properties' => + [ 'LEFT JOIN', [ 'user_id = up_user', 'up_property' => 'gender' ] ] ]; $comment = __METHOD__; if ( strval( $caller ) !== '' ) { $comment .= "/$caller"; } - $res = $dbr->select( $table, $fields, $conds, $comment, array(), $joins ); + $res = $dbr->select( $table, $fields, $conds, $comment, [], $joins ); foreach ( $res as $row ) { $this->cache[$row->user_name] = $row->up_value ? $row->up_value : $default;