/** * @desc get central wiki URL for given language. * If wiki in given language doesn't exist GlobalTitle method is throwing an exception and this method returns false * * @param String $lang - language code * @return bool|GlobalTitle */ public function getCentralWikiUrlForLangIfExists($lang) { try { return GlobalTitle::newMainPage($this->wikiCorporateModel->getCorporateWikiIdByLang($lang)); } catch (Exception $ex) { return false; } }
private function clearCache($langCode) { $this->wg->Memc->delete($this->getCollectionsListCacheKey($langCode)); $this->wg->Memc->delete($this->getCollectionsListVisualizationCacheKey($langCode)); $visualization = new CityVisualization(); $corporateModel = new WikiaCorporateModel(); foreach ($this->getList($langCode) as $collection) { $this->wg->Memc->delete($visualization->getCollectionCacheKey($collection['id'])); $title = GlobalTitle::newMainPage($corporateModel->getCorporateWikiIdByLang($langCode)); $title->purgeSquid(); Wikia::log(__METHOD__, '', 'Purged memcached for collection #' . $collection['id']); } }
/** * Get hub url * * @param int $wikiId * * @return String */ public function getHubUrl($wikiId) { $title = GlobalTitle::newMainPage($wikiId); return $title->getFullURL(); }