/** * get stats * @responseParam integer visitors * @responseParam integer edits * @responseParam integer communities * @responseParam integer totalPages */ public function getStats() { $this->wf->ProfileIn(__METHOD__); $memKey = $this->wf->SharedMemcKey('wikiahomepage', 'stats', $this->wg->contLang->getCode()); $stats = $this->wg->Memc->get($memKey); if (empty($stats)) { $stats['visitors'] = $this->helper->getStatsFromArticle('StatsVisitors'); $stats['edits'] = $this->helper->getEdits(); if (empty($stats['edits'])) { $stats['editsDefault'] = $this->helper->getStatsFromArticle('StatsEdits'); } $stats['communities'] = $this->helper->getStatsFromArticle('StatsCommunities'); $defaultTotalPages = $this->helper->getStatsFromArticle('StatsTotalPages'); $totalPages = intval(Wikia::get_content_pages()); $stats['totalPages'] = $totalPages > $defaultTotalPages ? $totalPages : $defaultTotalPages; $this->wg->Memc->set($memKey, $stats, 60 * 60 * 1); } foreach ($stats as $key => $value) { $this->{$key} = $this->wg->Lang->formatNum($value); } $this->communities = $this->communities . '+'; if (empty($stats['edits']) && in_array('editsDefault', $stats)) { $this->edits = $this->editsDefault . '+'; } $this->wf->ProfileOut(__METHOD__); }