Merge "Move up devunt's name to Developers"
[lhc/web/wiklou.git] / includes / cache / GenderCache.php
index 19695df..a34d235 100644 (file)
@@ -21,6 +21,7 @@
  * @author Niklas Laxström
  * @ingroup Cache
  */
+use MediaWiki\MediaWikiServices;
 
 /**
  * Caches user genders when needed to use correct namespace aliases.
@@ -34,18 +35,11 @@ class GenderCache {
        protected $missLimit = 1000;
 
        /**
+        * @deprecated in 1.28 see MediaWikiServices::getInstance()->getGenderCache()
         * @return GenderCache
         */
        public static function singleton() {
-               static $that = null;
-               if ( $that === null ) {
-                       $that = new self();
-               }
-
-               return $that;
-       }
-
-       protected function __construct() {
+               return MediaWikiServices::getInstance()->getGenderCache();
        }
 
        /**
@@ -163,7 +157,7 @@ class GenderCache {
                        return;
                }
 
-               $dbr = wfGetDB( DB_SLAVE );
+               $dbr = wfGetDB( DB_REPLICA );
                $table = [ 'user', 'user_properties' ];
                $fields = [ 'user_name', 'up_value' ];
                $conds = [ 'user_name' => $usersToCheck ];