public function executeGetUsers()
 {
     wfProfileIn(__METHOD__);
     $this->users = ChatEntryPoint::getChatUsersInfo();
     if (count($this->users) === 0) {
         ChatHelper::info(__METHOD__ . ': Method called - no users');
         // CONN-436: If there are no users in the chat, cache the response in varnish for CACHE_STANDARD and on the
         // browser for the default CACHE_DURATION time;
         // Note: Varnish cache will be purged when user opens the chat page
         $this->response->setCacheValidity(WikiaResponse::CACHE_STANDARD, self::CACHE_DURATION);
     } else {
         ChatHelper::info(__METHOD__ . ': Method called - found users', ['chatters' => count($this->users)]);
         // If there are users in the chat, cache both in varnish and browser for default CACHE_DURATION;
         $this->response->setCacheValidity(self::CACHE_DURATION);
     }
     wfProfileOut(__METHOD__);
 }
示例#2
0
 /**
  * Prepare a pre-rendered chat entry point for logged-in users
  */
 public static function onMakeGlobalVariablesScript(&$vars)
 {
     global $wgUser, $wgLang;
     if ($wgUser->isLoggedIn()) {
         $vars['wgWikiaChatUsers'] = ChatEntryPoint::getChatUsersInfo();
         if (empty($vars['wgWikiaChatUsers'])) {
             // we will need it to attract user to join chat
             $vars['wgWikiaChatProfileAvatarUrl'] = AvatarService::getAvatarUrl($wgUser->getName(), ChatRailController::AVATAR_SIZE);
         }
         $vars['wgWikiaChatMonts'] = $wgLang->getMonthAbbreviationsArray();
     } else {
         $vars['wgWikiaChatUsers'] = '';
     }
     $vars['wgWikiaChatWindowFeatures'] = ChatRailController::CHAT_WINDOW_FEATURES;
     return true;
 }