function showWikiForm($error = "") { global $wgOut, $wgLang; wfProfileIn(__METHOD__); /* no list when no user */ if (empty($this->mUsername)) { wfProfileOut(__METHOD__); return false; } $action = htmlspecialchars($this->mTitle->getLocalURL()); $oWiki = WikiFactory::getWikiByDB($this->mWiki); $oTmpl = new EasyTemplate(dirname(__FILE__) . "/templates/"); $oTmpl->set_vars(array("title" => $this->mTitle, "error" => $error, "action" => $action, "username" => $this->mUsername, "wiki" => $this->mWiki)); $wgOut->addHTML($oTmpl->render("wiki-form")); wfProfileOut(__METHOD__); }
<?php /* * written to retroactively award founders with BADGE_CREATOR * * @author tor */ include '/usr/wikia/source/trunk/maintenance/commandLine.inc'; if (class_exists(AchAwardingService)) { $wiki = WikiFactory::getWikiByDB($wgDBname); if (empty($wiki)) { exit; } $founderId = $wiki->city_founding_user; if (empty($founderId)) { exit; } $founder = User::newFromId($founderId); $founder->load(); // get achievement to chek if it's there already $achService = new AchAwardingService(); $achService->awardCustomNotInTrackBadge($founder, BADGE_CREATOR); }
/** * @desc Return city_id for a given file * This is needed as File here is returned from wfFindFile * that can fallback to some other wikis * * @param File $file * @return int|null|string */ private function getFileCityId(File $file) { global $wgCityId; $repo = $file->getRepo(); /** * Only fetch city_id if the file is coming from * WikiaForeignDBViaLBRepo */ if ($repo instanceof WikiaForeignDBViaLBRepo) { $dbName = $repo->getDBName(); $wiki = WikiFactory::getWikiByDB($dbName); if (!empty($wiki)) { return $wiki->city_id; } } return $wgCityId; }
private function nameToTitle($dbName) { $wikiData = WikiFactory::getWikiByDB($dbName); if (empty($wikiData)) { return ''; } else { return $wikiData->city_title; } }
/** * Hook: get wiki link for GlobalUsage * @param string $wikiName * @return bool true */ public static function onGlobalUsageImagePageWikiLink(&$wikiName) { $wiki = WikiFactory::getWikiByDB($wikiName); if ($wiki) { $wikiName = '[' . $wiki->city_url . ' ' . $wiki->city_title . ']'; } return true; }