Merge "Added explicit DB flags for Revision loading calls."
[lhc/web/wiklou.git] / includes / cache / GenderCache.php
index 6a9ecd2..2a169bb 100644 (file)
@@ -111,6 +111,29 @@ class GenderCache {
                $this->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