コード例 #1
0
 protected static function getBlockFromCache(User $user, $isCurrentUser)
 {
     global $wgMemc;
     wfProfilein(__METHOD__);
     $cacheKey = self::getCacheKey($user);
     $cachedState = $wgMemc->get($cacheKey);
     if (!empty($cachedState) && $cachedState['timestamp'] > (int) Phalanx::getLastUpdate()) {
         if (!$cachedState['return'] && $isCurrentUser) {
             self::setUserData($user, $cachedState['block'], '', $user->isAnon());
         }
         //added to make User::isBlockedGlobally() work for this instance of User class
         $user->mBlockedGlobally = !$cachedState['return'];
         wfProfileOut(__METHOD__);
         return $cachedState['return'];
     }
     wfProfileOut(__METHOD__);
     return null;
 }