X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fcache%2FGenderCache.php;h=2a169bb3ac9ccf3d4b575580676f3f1661678faf;hb=7e0f86a32f42c551d050d514c162ec6a180e2a2c;hp=c27ab00c0c44fc9f470543dd37b15d5b6726a2f1;hpb=3ae2e2b4ceec1a1d8d5890f097793e7c3ebb93b1;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/cache/GenderCache.php b/includes/cache/GenderCache.php index c27ab00c0c..2a169bb3ac 100644 --- a/includes/cache/GenderCache.php +++ b/includes/cache/GenderCache.php @@ -1,8 +1,30 @@ doQuery( array_keys( $users ), $caller ); } + /** + * Wrapper for doQuery that processes a title or string array. + * + * @since 1.20 + * @param $titles List: array of Title objects or strings + * @param $caller String: the calling method + */ + public function doTitlesArray( $titles, $caller = '' ) { + $users = array(); + foreach ( $titles as $title ) { + $titleObj = is_string( $title ) ? Title::newFromText( $title ) : $title; + if ( !$titleObj ) { + continue; + } + if ( !MWNamespace::hasGenderDistinction( $titleObj->getNamespace() ) ) { + continue; + } + $users[] = $titleObj->getText(); + } + + $this->doQuery( $users, $caller ); + } + /** * Preloads genders for given list of users. * @param $users List|String: usernames