private function getUpdateCountsInternal(WallNotifications $wn) { wfProfileIn(__METHOD__); $app = F::app(); $all = $wn->getCounts($this->wg->User->getId()); $sum = 0; foreach ($all as $k => $wiki) { $sum += $wiki['unread']; $wikiSitename = $wiki['sitename']; if (mb_strlen($wikiSitename) > self::WALL_WIKI_NAME_MAX_LEN) { $all[$k]['sitename'] = $app->wg->Lang->truncate($wikiSitename, self::WALL_WIKI_NAME_MAX_LEN - 3); } } //solution for problem with cross wiki notification and no wikia domain. $notificationKey = uniqid(); $this->app->runFunction('wfSharedMemcKey', 'notificationkey', $notificationKey); $app->wg->Memc->set($notificationKey, $this->wg->User->getId()); $this->response->setVal('html', $this->app->renderView('WallNotifications', 'Update', array('notificationCounts' => $all, 'count' => $sum, 'notificationKey' => $notificationKey))); $this->response->setVal('count', $sum); $this->response->setVal('reminder', $this->app->wf->MsgExt('wall-notifications-reminder', array('parsemag'), $sum)); $this->response->setVal('status', true); wfProfileOut(__METHOD__); }
private function getUpdateCountsInternal(WallNotifications $wn) { global $wgUser, $wgLang, $wgMemc; wfProfileIn(__METHOD__); $all = $wn->getCounts($wgUser->getId()); $sum = 0; foreach ($all as $k => $wiki) { $sum += $wiki['unread']; $wikiSitename = $wiki['sitename']; if (mb_strlen($wikiSitename) > self::WALL_WIKI_NAME_MAX_LEN) { $all[$k]['sitename'] = $wgLang->truncate($wikiSitename, self::WALL_WIKI_NAME_MAX_LEN - 3); } } // solution for problem with cross wiki notification and no wikia domain. $notificationKey = uniqid(); $wgMemc->set($notificationKey, $wgUser->getId()); $this->response->setVal('html', $this->app->renderView($this->controllerName, 'Update', ['notificationCounts' => $all, 'count' => $sum, 'notificationKey' => $notificationKey])); $this->response->setVal('count', $sum); $this->response->setVal('reminder', wfMessage('wall-notifications-reminder', $sum)->text()); $this->response->setVal('status', true); $this->response->setCachePolicy(WikiaResponse::CACHE_PRIVATE); $this->response->setCacheValidity(WikiaResponse::CACHE_DISABLED); wfProfileOut(__METHOD__); }