当前位置: 首页>>代码示例>>PHP>>正文


PHP WikiFactory::getWikiByID方法代码示例

本文整理汇总了PHP中WikiFactory::getWikiByID方法的典型用法代码示例。如果您正苦于以下问题:PHP WikiFactory::getWikiByID方法的具体用法?PHP WikiFactory::getWikiByID怎么用?PHP WikiFactory::getWikiByID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WikiFactory的用法示例。


在下文中一共展示了WikiFactory::getWikiByID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: execute

 /**
  * execute -- main entry point to api method
  *
  * use secret hash for checking if api is called by proper engine
  *
  * @access public
  *
  * @return api result
  */
 public function execute()
 {
     global $wgTheSchwartzSecretToken, $wgCityId, $wgServer, $wgExtensionMessagesFiles;
     $params = $this->extractRequestParams();
     $status = 0;
     if (isset($params["token"]) && $params["token"] === $wgTheSchwartzSecretToken) {
         /**
          * get creator from param
          */
         $founder = User::newFromId($params["user_id"]);
         $founder->load();
         /**
          * get city_founding_user from city_list
          */
         if (!$founder) {
             $wiki = WikiFactory::getWikiByID($wgCityId);
             $founder = User::newFromId($wiki->city_founding_user);
         }
         Wikia::log(__METHOD__, "user", $founder->getName());
         if ($founder && $founder->isEmailConfirmed()) {
             if ($founder->sendMail(wfMsg("autocreatewiki-reminder-subject"), wfMsg("autocreatewiki-reminder-body", array($founder->getName(), $wgServer)), null, null, "AutoCreateWikiReminder", wfMsg("autocreatewiki-reminder-body-HTML", array($founder->getName(), $wgServer)))) {
                 $status = 1;
             }
         }
     } else {
         $this->dieUsageMsg(array("sessionfailure"));
     }
     $result = array("status" => $status);
     $this->getResult()->setIndexedTagName($result, 'status');
     $this->getResult()->addValue(null, $this->getModuleName(), $result);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:40,代码来源:WikiaApiCreatorReminderEmail.php

示例2: __construct

 public function __construct($cityId)
 {
     global $wgForeignFileRepos;
     parent::__construct();
     $this->cityId = $cityId;
     $this->skinName = RequestContext::getMain()->getSkin()->getSkinName();
     $hubWiki = WikiFactory::getWikiByID($cityId);
     $hubDbName = $hubWiki->city_dbname;
     $wgForeignFileRepos[] = ['class' => 'WikiaForeignDBViaLBRepo', 'name' => $hubDbName, 'transformVia404' => true, 'wiki' => $hubDbName, 'backend' => "wikia{$hubDbName}-backend"];
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:10,代码来源:WikiaHubsModuleService.class.php

示例3: execute

 function execute($params = null)
 {
     global $IP, $wgWikiaLocalSettingsPath;
     /*  go with each supplied wiki and delete the supplied article
     			load all configs for particular wikis before doing so
     			(from wikifactory, not by _obsolete_ maintenance scripts
     			and from LocalSettings as worked on fps)
     		 */
     $this->mTaskID = $params->task_id;
     $oUser = User::newFromId($params->task_user_id);
     if ($oUser instanceof User) {
         $oUser->load();
         $this->mUser = $oUser->getName();
     } else {
         $this->log("Invalid user - id: " . $params->task_user_id);
         return true;
     }
     $data = unserialize($params->task_arguments);
     foreach ($data['page_list'] as $imageData) {
         $retval = "";
         list($wikiId, $imageId) = $imageData;
         $dbname = WikiFactory::getWikiByID($wikiId);
         if (!$dbname) {
             continue;
         }
         $title = GlobalTitle::newFromId($imageId, $wikiId);
         if (!is_object($title)) {
             $this->log('Apparently the article does not exist anymore');
             continue;
         }
         $city_url = WikiFactory::getVarValueByName("wgServer", $wikiId);
         if (empty($city_url)) {
             continue;
         }
         $city_path = WikiFactory::getVarValueByName("wgScript", $wikiId);
         $city_lang = WikiFactory::getVarValueByName("wgLanguageCode", $wikiId);
         $reason = wfMsgExt('imagereview-reason', array('language' => $city_lang));
         $sCommand = "perl /usr/wikia/backend/bin/run_maintenance --id={$wikiId} --script=wikia/deleteOn.php ";
         $sCommand .= "-- ";
         $sCommand .= "-u " . escapeshellarg($this->mUser) . " ";
         $sCommand .= "-t " . escapeshellarg($title->getPrefixedText()) . " ";
         if ($reason) {
             $sCommand .= "-r " . escapeshellarg($reason) . " ";
         }
         $actual_title = wfShellExec($sCommand, $retval);
         if ($retval) {
             $this->addLog('Article deleting error! (' . $city_url . '). Error code returned: ' . $retval . ' Error was: ' . $actual_title);
         } else {
             $this->addLog('Removed: <a href="' . $city_url . $city_path . '?title=' . wfEscapeWikiText($actual_title) . '">' . $city_url . $city_path . '?title=' . $actual_title . '</a>');
         }
         $this->flagUser($imageId, $wikiId);
         $this->flagWiki($wikiId);
     }
     return true;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:55,代码来源:ImageReviewTask.php

示例4: appendWikidesc

 protected function appendWikidesc($property)
 {
     global $wgLanguageCode, $wgDBcluster;
     $result = $this->getResult();
     $lang_id = WikiFactory::LangCodeToId($wgLanguageCode);
     $cats = WikiFactory::getCategory($this->cityId);
     $oWiki = WikiFactory::getWikiByID($this->cityId);
     $cat_id = !empty($cats) ? $cats->cat_id : 0;
     $data = array("langid" => $lang_id, "id" => $this->cityId, "catid" => $cat_id, "pagetitle" => wfMsg('pagetitle'), "flags" => $oWiki->city_flags, "db" => $oWiki->city_dbname, "position" => isset($wgDBcluster) ? $wgDBcluster : $oWiki->city_cluster);
     $result->setIndexedTagName($data, $property);
     $result->addValue('query', $property, $data);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:12,代码来源:WikiaApiQuerySiteinfo.php

示例5: __construct

 public function __construct($wikiId)
 {
     $dbName = false;
     if (!empty($wikiId)) {
         $wikiInfo = WikiFactory::getWikiByID($wikiId);
         $dbName = $wikiInfo->city_dbname;
     }
     $this->app = F::app();
     $this->db = wfGetDB(DB_SLAVE, array(), $dbName);
     $this->wikiId = $wikiId;
     $this->api = new EntityAPIClient();
     $this->api->setLogLevel(5);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:13,代码来源:ImportantArticles.class.php

示例6: delete

 public function delete($pageList, $suppress = false)
 {
     global $IP;
     $user = \User::newFromId($this->createdBy);
     $userName = $user->getName();
     $articlesDeleted = 0;
     foreach ($pageList as $imageData) {
         list($wikiId, $imageId) = $imageData;
         if (!\WikiFactory::isPublic($wikiId)) {
             $this->notice('wiki has been disabled', ['wiki_id' => $wikiId]);
             continue;
         }
         $dbname = \WikiFactory::getWikiByID($wikiId);
         if (!$dbname) {
             $this->warning('did not find database', ['wiki_id' => $wikiId]);
             continue;
         }
         $cityUrl = \WikiFactory::getVarValueByName('wgServer', $wikiId);
         if (empty($cityUrl)) {
             $this->warning('could not determine city url', ['wiki_id' => $wikiId]);
             continue;
         }
         $cityLang = \WikiFactory::getVarValueByName('wgLanguageCode', $wikiId);
         $reason = wfMsgExt('imagereview-reason', ['language' => $cityLang]);
         $command = "SERVER_ID={$wikiId} php {$IP}/maintenance/wikia/deleteOn.php" . ' -u ' . escapeshellarg($userName) . ' --id ' . $imageId;
         if ($reason) {
             $command .= ' -r ' . escapeshellarg($reason);
         }
         if ($suppress) {
             $command .= ' -s';
         }
         $title = wfShellExec($command, $exitStatus);
         if ($exitStatus !== 0) {
             $this->error('article deletion error', ['city_url' => $cityUrl, 'exit_status' => $exitStatus, 'error' => $title]);
             continue;
         }
         $cityPath = \WikiFactory::getVarValueByName('wgScript', $wikiId);
         $escapedTitle = wfEscapeWikiText($title);
         $this->info('removed image', ['link' => "{$cityUrl}{$cityPath}?title={$escapedTitle}", 'title' => $escapedTitle]);
         ++$articlesDeleted;
     }
     $success = $articlesDeleted == count($pageList);
     if (!$success) {
         $this->sendNotification();
     }
     return $success;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:47,代码来源:ImageReviewTask.class.php

示例7: customSpecialStatistics

 /**
  * @access public
  * @static
  */
 public static function customSpecialStatistics(&$specialpage, &$text)
 {
     global $wgOut, $wgDBname, $wgLang, $wgRequest, $wgTitle, $wgUser, $wgCityId, $wgHTTPProxy;
     /**
      * read json file with dumps information
      */
     $tmpl = new EasyTemplate(dirname(__FILE__) . "/templates/");
     $index = array();
     $proxy = array();
     if (isset($wgHTTPProxy) && $wgHTTPProxy) {
         $proxy["proxy"] = $wgHTTPProxy;
     } else {
         $proxy["noProxy"] = true;
     }
     $url = self::getUrl($wgDBname, "index.json");
     $json = Http::get($url, 5, $proxy);
     if ($json) {
         wfDebug(__METHOD__ . ": getting informations about last dump from {$url} succeded\n");
         $index = (array) json_decode($json);
     } else {
         wfDebug(__METHOD__ . ": getting informations about last dump from {$url} failed\n");
     }
     /**
      * get last dump request timestamp
      */
     $wiki = WikiFactory::getWikiByID($wgCityId);
     if (strtotime(wfTimestampNow()) - strtotime($wiki->city_lastdump_timestamp) > 7 * 24 * 60 * 60) {
         $tmpl->set("available", true);
     } else {
         $tmpl->set("available", false);
     }
     $tmpl->set("title", $wgTitle);
     $tmpl->set("isAnon", $wgUser->isAnon());
     $tmpl->set("curr", array("url" => self::getUrl($wgDBname, "pages_current.xml.gz"), "timestamp" => !empty($index["pages_current.xml.gz"]->mwtimestamp) ? $wgLang->timeanddate($index["pages_current.xml.gz"]->mwtimestamp) : "unknown"));
     $tmpl->set("full", array("url" => self::getUrl($wgDBname, "pages_full.xml.gz"), "timestamp" => !empty($index["pages_full.xml.gz"]->mwtimestamp) ? $wgLang->timeanddate($index["pages_full.xml.gz"]->mwtimestamp) : "unknown"));
     $tmpl->set("index", $index);
     $text .= $tmpl->render("dod");
     if ($wgRequest->wasPosted() && !$wgUser->isAnon()) {
         self::sendMail();
         wfDebug(__METHOD__, ": request for database dump was posted\n");
         $text = Wikia::successbox(wfMsg("dump-database-request-requested")) . $text;
     }
     return true;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:48,代码来源:DumpsOnDemand.php

示例8: __construct

 /**
  * constructor
  * If email and password are empty, will use the default preferred account from '
  *
  * @access public
  */
 public function __construct($email, $pass, $wiki = null)
 {
     global $wgGoogleWebToolsAccts;
     // If email and password weren't specified, use the preferred account.
     if (empty($email) && empty($pass)) {
         if (is_array($wgGoogleWebToolsAccts)) {
             foreach ($wgGoogleWebToolsAccts as $acctEmail => $acctData) {
                 if (isset($acctData['preferred']) && $acctData['preferred'] == 1) {
                     $email = $acctEmail;
                     $pass = $acctData['pass'];
                     break;
                 }
             }
             // If no preferred email/pass was found, just grab the first one
             if (empty($email) && empty($pass) && count($wgGoogleWebToolsAccts) > 0) {
                 $keys = array_keys($wgGoogleWebToolsAccts);
                 $email = $keys[0];
                 $pass = isset($wgGoogleWebToolsAccts[$email]['pass']) ? $wgGoogleWebToolsAccts[$email]['pass'] : "";
             }
         }
     }
     $this->mEmail = $email;
     $this->mPass = $pass;
     $this->mType = 'GOOGLE';
     $this->mSource = 'WIKIA';
     $this->mService = 'sitemaps';
     if ($wiki != null) {
         if (!is_object($wiki)) {
             if (is_string($wiki)) {
                 $wiki = WikiFactory::DBtoID($wiki);
             }
             $wikiId = WikiFactory::getWikiByID($wiki);
             if (!$wikiId) {
                 throw new Exception("Could not find wiki by ID (id=" . $wiki . ").");
             }
             $wiki = $wikiId;
         }
         $this->mWiki = $wiki;
         $this->mSiteURI = $this->make_site_uri();
     }
     $this->mAuth = $this->getAuthToken();
 }
开发者ID:yusufchang,项目名称:app,代码行数:48,代码来源:GWTClient.php

示例9: getImageList

 /**
  * Get image list
  *
  * @param  integer $userId ID of the user to get the list for
  * @param  string  $from   Timestamp to get images before
  * @return array           List of images
  */
 public function getImageList($userId, $from = null)
 {
     wfProfileIn(__METHOD__);
     $imageList = [];
     $db = $this->getDatawareDB(DB_MASTER);
     $where = ['user_id' => $userId, 'state != ' . ImageReviewStatuses::STATE_DELETED . ' AND state != ' . ImageReviewStatuses::STATE_WIKI_DISABLED];
     $from = wfTimestampOrNull(TS_DB, $from);
     if (!empty($from)) {
         $where[] = 'last_edited < ' . $db->addQuotes($from);
     }
     $result = $db->select(['image_review'], ['wiki_id, page_id, state, flags, priority, last_edited'], $where, __METHOD__, ['ORDER BY' => 'last_edited desc', 'LIMIT' => self::LIMIT_IMAGES]);
     foreach ($result as $row) {
         $img = ImagesService::getImageSrc($row->wiki_id, $row->page_id);
         $wikiRow = WikiFactory::getWikiByID($row->wiki_id);
         $extension = pathinfo(strtolower($img['page']), PATHINFO_EXTENSION);
         $isThumb = true;
         if (empty($img['src'])) {
             // If we don't have a thumb by this point, we still need to display something, fall back to placeholder
             $globalTitle = GlobalTitle::newFromId($row->page_id, $row->wiki_id);
             if (is_object($globalTitle)) {
                 $img['page'] = $globalTitle->getFullUrl();
                 // @TODO this should be taken from the code instead of being hardcoded
                 $img['src'] = '//images.wikia.com/central/images/8/8c/Wikia_image_placeholder.png';
             } else {
                 // This should never happen
                 continue;
             }
         }
         if (in_array($extension, ['gif', 'svg'])) {
             $img = ImagesService::getImageOriginalUrl($row->wiki_id, $row->page_id);
             $isThumb = false;
         }
         $imageList[] = ['wikiId' => $row->wiki_id, 'pageId' => $row->page_id, 'state' => $row->state, 'src' => $img['src'], 'priority' => $row->priority, 'url' => $img['page'], 'isthumb' => $isThumb, 'flags' => $row->flags, 'wiki_url' => isset($wikiRow->city_url) ? $wikiRow->city_url : '', 'user_page' => '', 'last_edited' => $row->last_edited];
     }
     $db->freeResult($result);
     wfProfileOut(__METHOD__);
     return $imageList;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:45,代码来源:CoppaImageReviewHelper.class.php

示例10: pageList

 public function pageList($wikiId)
 {
     /* TEST */
     $important = new ImportantArticles($wikiId);
     $wikiTopics = $important->getWikiTopics();
     $importantByRedirects = $important->getImportantPhrasesByRedirects();
     $importantByTopPages = $important->getImportantPhrasesByTopPages();
     $importantByLinks = $important->getImportantPhrasesByInterlinks();
     $commonPrefix = $important->getCommonPrefix();
     $importantByDomainNames = $important->getImportantPhrasesByDomainNames();
     $merged = $important->getMostImportantTopics();
     $this->setVal('wikiTopics', $wikiTopics);
     $this->setVal('importantByTopPages', $importantByTopPages);
     $this->setVal('importantByLinks', $importantByLinks);
     $this->setVal('commonPrefix', $commonPrefix);
     $this->setVal('phrases', $important->getImportantPhrasesAsList());
     $this->setVal('importantByDomainNames', $importantByDomainNames);
     $this->setVal('importantByRedirects', $importantByRedirects);
     $this->setVal('merged', $merged);
     $wiki = WikiFactory::getWikiByID($wikiId);
     $this->setVal('domain_name', $wiki->city_url);
     $this->overrideTemplate('pageList');
 }
开发者ID:yusufchang,项目名称:app,代码行数:23,代码来源:PageClassificationController.class.php

示例11: getWikiData

 private function getWikiData($city_id)
 {
     $res = array();
     $oRow = WikiFactory::getWikiByID($city_id);
     if (is_object($oRow)) {
         $res = array("id" => $oRow->city_id, "url" => $oRow->city_url, "dbname" => $oRow->city_dbname, "title" => $oRow->city_title, "active" => $oRow->city_public);
     }
     return $res;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:9,代码来源:SpecialLookupContribs_helper.php

示例12: sendMail

 function sendMail($commandLineOptions, $jobOptions, $wikiId, $wikiData)
 {
     global $wgSitename;
     $wiki = WikiFactory::getWikiByID($wikiId);
     $magicwords = array('#WIKINAME' => $wiki->city_title);
     $flags = WikiFactory::getFlags($wikiId);
     $flag = $jobOptions['mailType'] == 'first' ? WikiFactory::FLAG_ADOPT_MAIL_FIRST : WikiFactory::FLAG_ADOPT_MAIL_SECOND;
     //this kind of e-mail already sent for this wiki
     if ($flags & $flag) {
         return;
     }
     $globalTitleUserRights = GlobalTitle::newFromText('UserRights', -1, $wikiId);
     $specialUserRightsUrl = $globalTitleUserRights->getFullURL();
     $globalTitlePreferences = GlobalTitle::newFromText('Preferences', -1, $wikiId);
     $specialPreferencesUrl = $globalTitlePreferences->getFullURL();
     //at least one admin has not edited during xx days
     foreach ($wikiData['admins'] as $adminId) {
         //print info
         if (!isset($commandLineOptions['quiet'])) {
             echo "Trying to send the e-mail to the user (id:{$adminId}) on wiki (id:{$wikiId}).\n";
         }
         $adminUser = User::newFromId($adminId);
         $defaultOption = null;
         if ($wikiId > 194785) {
             $defaultOption = 1;
         }
         $acceptMails = $adminUser->getOption("adoptionmails-{$wikiId}", $defaultOption);
         if ($acceptMails && $adminUser->isEmailConfirmed()) {
             $adminName = $adminUser->getName();
             if (!isset($commandLineOptions['quiet'])) {
                 echo "Sending the e-mail to the user (id:{$adminId}, name:{$adminName}) on wiki (id:{$wikiId}).\n";
             }
             if (!isset($commandLineOptions['dryrun'])) {
                 echo "Really Sending the e-mail to the user (id:{$adminId}, name:{$adminName}) on wiki (id:{$wikiId}).\n";
                 $adminUser->sendMail(strtr(wfMsgForContent("wikiadoption-mail-{$jobOptions['mailType']}-subject"), $magicwords), strtr(wfMsgForContent("wikiadoption-mail-{$jobOptions['mailType']}-content", $adminName, $specialUserRightsUrl, $specialPreferencesUrl), $magicwords), null, null, 'AutomaticWikiAdoption', strtr(wfMsgForContent("wikiadoption-mail-{$jobOptions['mailType']}-content-HTML", $adminName, $specialUserRightsUrl, $specialPreferencesUrl), $magicwords));
             }
         }
     }
     if (!isset($commandLineOptions['dryrun'])) {
         WikiFactory::setFlags($wikiId, $flag);
     }
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:42,代码来源:AutomaticWikiAdoptionGatherData.php

示例13: formatTitle

 protected function formatTitle($item)
 {
     switch ($item['source']) {
         case self::SOURCE_TVRAGE:
             $item['title'] = sprintf('%s, the new episode from %s', $item['episode_name'], $item['series_name']);
             break;
         case self::SOURCE_HUB:
             break;
         case self::SOURCE_GENERATOR:
             $titles = ['Read more about %s from %s', 'More info about %s from %s', 'Recommended page: %s from %s'];
             $titleNum = rand(0, count($titles) - 1);
             if (!array_key_exists('wikititle', $item) || !$item['wikititle']) {
                 $info = WikiFactory::getWikiByID($item['wikia_id']);
                 $item['wikititle'] = $info->city_title;
             }
             $item['title'] = sprintf($titles[$titleNum], $item['title'], $item['wikititle']);
             break;
     }
     return $item;
 }
开发者ID:yusufchang,项目名称:app,代码行数:20,代码来源:TvRssModel.class.php

示例14: execute

 public function execute($wikiID)
 {
     global $wgOut, $wgRequest, $wgCityId, $wgUser;
     wfProfileIn(__METHOD__);
     $this->setHeaders();
     $firstVisit = true;
     $wikiID = !empty($wikiID) ? (int) $wikiID : $wgCityId;
     if (isset($_COOKIE[$this->mCookieName])) {
         $this->mCookie = json_decode($_COOKIE[$this->mCookieName]);
         $firstVisit = false;
     } else {
         $this->mCookie = new stdClass();
         $this->mCookie->origHub = null;
         $this->mCookie->langCode = null;
         $this->mCookie->history = array();
         if (!empty($wikiID)) {
             $hub = WikiFactory::getCategory($wikiID);
             if (is_object($hub)) {
                 $this->mCookie->origHub = $hub->cat_id;
                 $this->mCookie->langCode = WikiFactory::getWikiByID($wikiID)->city_lang;
                 $this->mCookie->history[] = $wikiID;
             }
         }
     }
     $this->loadData();
     $historyCount = count($this->mCookie->history);
     // reset the history if the user visited all the possible targets
     if ($historyCount >= $this->mData['total']) {
         $this->mCookie->history = array($wikiID);
     }
     // if language other than English and list of targets exhausted fall back to english
     if (($historyCount >= $this->mData['total'] || $this->mData['total'] == 0 && (count($this->mData['recommended']) == 0 || !$firstVisit)) && $this->mCookie->langCode != 'en') {
         $this->mCookie->langCode = 'en';
         $this->loadData();
     }
     $destinationID = null;
     $from = null;
     srand(time());
     // pick a recommended wiki the first time
     if ($firstVisit && !empty($this->mData['recommended'])) {
         $destinationID = $this->mData['recommended'][array_rand($this->mData['recommended'])];
         $from = 'recommended';
     } elseif (!empty($this->mCookie->origHub) && !empty($this->mData['hubs'][$this->mCookie->origHub])) {
         $currentHub = array_diff($this->mData['hubs'][$this->mCookie->origHub], $this->mCookie->history);
         if (count($currentHub) && count($this->mCookie->history) < RandomWikiHelper::TRACK_LIMIT) {
             $destinationID = $currentHub[array_rand($currentHub)];
             $from = 'origHub';
         }
     }
     // in case no wiki has been selected in the previous block pick a wiki from a random hub
     if (empty($destinationID)) {
         $hubsCount = count($this->mData['hubs']);
         $hub = array_rand($this->mData['hubs'], $hubsCount);
         if (!is_array($hub)) {
             $hub = array($hub);
         }
         foreach ($hub as $key) {
             $tmpHub = array_diff($this->mData['hubs'][$key], $this->mCookie->history);
             if (!count($tmpHub)) {
                 continue;
             }
             $itemKey = array_rand($tmpHub);
             $destinationID = $tmpHub[$itemKey];
             $from = "hub {$itemKey}";
         }
     }
     $this->mCookie->history[] = $destinationID;
     $cookieValue = json_encode($this->mCookie);
     $wgRequest->response()->setcookie(self::COOKIE_NAME_TOKEN, $cookieValue, time() + 3600 * self::COOKIE_EXPIRY);
     $url = WikiFactory::getVarValueByName('wgServer', $destinationID);
     //FB#1033: avoid being sent to Special:WikiActivity when logged-in, see MyHomw::getInitialMainPage
     if ($wgUser->isLoggedIn()) {
         $url .= '?redirect=no';
     }
     // Redirect the user to a randomly-chosen wiki (or not if profiling requested)
     $profiling = $wgRequest->getInt('forceprofile', 0);
     if ($profiling !== 1) {
         $wgOut->redirect($url);
     }
     wfProfileOut(__METHOD__);
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:81,代码来源:SpecialRandomWiki_body.php

示例15: copyToArchive

 /**
  * copyToArchive
  *
  * copy data from WikiFactory database to Archive database
  *
  * @author Krzysztof Krzyżaniak (eloy) <eloy@wikia-inc.com>
  * @access public
  * @static
  *
  * @param integer	$city_id	source Wiki ID
  * @return bool
  */
 public static function copyToArchive($city_id)
 {
     global $wgExternalArchiveDB, $wgWikicitiesReadOnly;
     if ($wgWikicitiesReadOnly) {
         Wikia::log(__METHOD__, "", "wgWikicitiesReadOnly mode. Skipping update.");
         return false;
     }
     wfProfileIn(__METHOD__);
     /**
      * do only on inactive wikis
      */
     $wiki = WikiFactory::getWikiByID($city_id);
     if (isset($wiki->city_id)) {
         $timestamp = wfTimestampNow();
         $dbw = self::db(DB_MASTER);
         $dba = wfGetDB(DB_MASTER, [], $wgExternalArchiveDB);
         $dba->begin();
         /**
          * copy city_list to archive
          */
         $dba->insert("city_list", ["city_id" => $wiki->city_id, "city_path" => $wiki->city_path, "city_dbname" => $wiki->city_dbname, "city_sitename" => $wiki->city_sitename, "city_url" => $wiki->city_url, "city_created" => $wiki->city_created, "city_founding_user" => $wiki->city_founding_user, "city_adult" => $wiki->city_adult, "city_public" => $wiki->city_public, "city_additional" => $wiki->city_additional, "city_description" => $wiki->city_description, "city_title" => $wiki->city_title, "city_founding_email" => $wiki->city_founding_email, "city_founding_ip" => $wiki->city_founding_ip, "city_lang" => $wiki->city_lang, "city_special_config" => $wiki->city_special_config, "city_umbrella" => $wiki->city_umbrella, "city_ip" => $wiki->city_ip, "city_google_analytics" => $wiki->city_google_analytics, "city_google_search" => $wiki->city_google_search, "city_google_maps" => $wiki->city_google_maps, "city_indexed_rev" => $wiki->city_indexed_rev, "city_lastdump_timestamp" => $timestamp, "city_factory_timestamp" => $timestamp, "city_useshared" => $wiki->city_useshared, "city_flags" => $wiki->city_flags, "city_cluster" => $wiki->city_cluster], __METHOD__);
         /**
          * copy city_variables to archive
          */
         $sth = $dbw->select(["city_variables"], ["cv_city_id", "cv_variable_id", "cv_value"], ["cv_city_id" => $city_id], __METHOD__);
         while ($row = $dbw->fetchObject($sth)) {
             $dba->insert("city_variables", ["cv_city_id" => $row->cv_city_id, "cv_variable_id" => $row->cv_variable_id, "cv_value" => $row->cv_value, "cv_timestamp" => $timestamp], __METHOD__);
         }
         $dbw->freeResult($sth);
         /**
          * copy domains to archive
          */
         $sth = $dbw->select(['city_domains'], ['*'], ['city_id' => $city_id], __METHOD__);
         while ($row = $dbw->fetchObject($sth)) {
             $dba->insert("city_domains", ["city_id" => $row->city_id, "city_domain" => $row->city_domain, "city_new_id" => $row->city_id, "city_timestamp" => $timestamp], __METHOD__);
             self::clearDomainCache($row->city_id);
         }
         $dbw->freeResult($sth);
         $dba->commit();
     }
     wfProfileOut(__METHOD__);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:54,代码来源:WikiFactory.php


注:本文中的WikiFactory::getWikiByID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。