Add isCurrentWikiId()/isCurrentWikiDomain()/getCurrentWikiDomain() to WikiMap
[lhc/web/wiklou.git] / includes / user / User.php
index ada5dc9..8cbedb9 100644 (file)
@@ -492,7 +492,7 @@ class User implements IDBAccessObject, UserIdentity {
         * @param int $userId
         */
        public static function purge( $wikiId, $userId ) {
-               $cache = ObjectCache::getMainWANInstance();
+               $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
                $key = $cache->makeGlobalKey( 'user', 'id', $wikiId, $userId );
                $cache->delete( $key );
        }
@@ -503,7 +503,10 @@ class User implements IDBAccessObject, UserIdentity {
         * @return string
         */
        protected function getCacheKey( WANObjectCache $cache ) {
-               return $cache->makeGlobalKey( 'user', 'id', wfWikiID(), $this->mId );
+               $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
+               $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
+
+               return $cache->makeGlobalKey( 'user', 'id', $lbFactory->getLocalDomainID(), $this->mId );
        }
 
        /**
@@ -2635,7 +2638,7 @@ class User implements IDBAccessObject, UserIdentity {
                        // and it is always for the same wiki, but we double-check here in
                        // case that changes some time in the future.
                        if ( count( $newMessageLinks ) === 1
-                               && $newMessageLinks[0]['wiki'] === wfWikiID()
+                               && WikiMap::isCurrentWikiId( $newMessageLinks[0]['wiki'] )
                                && $newMessageLinks[0]['rev']
                        ) {
                                /** @var Revision $newMessageRevision */
@@ -5123,16 +5126,13 @@ class User implements IDBAccessObject, UserIdentity {
 
        /**
         * Get a list of implicit groups
+        * TODO: Should we deprecate this? It's trivial, but we don't want to encourage use of globals.
+        *
         * @return array Array of Strings Array of internal group names
         */
        public static function getImplicitGroups() {
                global $wgImplicitGroups;
-
-               $groups = $wgImplicitGroups;
-               # Deprecated, use $wgImplicitGroups instead
-               Hooks::run( 'UserGetImplicitGroups', [ &$groups ], '1.25' );
-
-               return $groups;
+               return $wgImplicitGroups;
        }
 
        /**