/** * get site stats is $formatted is true, those number will be fortamtted * @param boolean $formatted * @return array the site stats */ public function getStats($formatted = true) { $key = $this->getCustomKey('getStats'); $data = $this->cache->get($key); if ($data != '') { $res = $data; } else { if ($this->mPrefix === '') { $res['followers'] = 0; $res['articles'] = 0; $res['users'] = 0; $res['pages'] = 0; $res['edits'] = 0; $res['files'] = 0; } else { $res = array(); $res['followers'] = UserSiteFollow::getFollowerCount($this->mPrefix); $arr = AllSitesInfo::getPageInfoByPrefix($this->mPrefix); $res['articles'] = $arr['totalArticles']; $res['users'] = $arr['totalUsers']; $res['pages'] = $arr['totalPages']; $res['edits'] = $arr['totalEdits']; $res['files'] = $arr['totalImages']; $this->cache->set($key, $res, 24 * 60 * 60); } } if ($formatted) { foreach ($res as $key => $value) { $res[$key] = HuijiFunctions::format_nice_number($value); } } return $res; }