當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ParserOutput::getUsedOptions方法代碼示例

本文整理匯總了PHP中ParserOutput::getUsedOptions方法的典型用法代碼示例。如果您正苦於以下問題:PHP ParserOutput::getUsedOptions方法的具體用法?PHP ParserOutput::getUsedOptions怎麽用?PHP ParserOutput::getUsedOptions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ParserOutput的用法示例。


在下文中一共展示了ParserOutput::getUsedOptions方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: save

 /**
  * @param $parserOutput ParserOutput
  * @param $article Page
  * @param $popts ParserOptions
  */
 public function save(ParserOutput $parserOutput, Page $article, ParserOptions $popts)
 {
     wfRunHooks('BeforeParserCacheSave', [$parserOutput, $article]);
     $expire = $parserOutput->getCacheExpiry();
     if ($expire > 0) {
         $now = wfTimestampNow();
         $optionsKey = new CacheTime();
         $optionsKey->mUsedOptions = $parserOutput->getUsedOptions();
         $optionsKey->updateCacheExpiry($expire);
         $optionsKey->setCacheTime($now);
         $parserOutput->setCacheTime($now);
         $optionsKey->setContainsOldMagic($parserOutput->containsOldMagic());
         $parserOutputKey = $this->getParserOutputKey($article, $popts->optionsHash($optionsKey->mUsedOptions, $article->getTitle()));
         // Save the timestamp so that we don't have to load the revision row on view
         $parserOutput->setTimestamp($article->getTimestamp());
         // Wikia change - begin
         // @author macbre - BAC-1172
         #$info = "Saved in parser cache with key $parserOutputKey and timestamp $now";
         global $wgArticleAsJson;
         if (!$wgArticleAsJson) {
             $info = "Saved in parser cache with key {$parserOutputKey}";
             $parserOutput->mText .= "\n<!-- {$info} -->\n";
         }
         wfDebug("{$info}\n");
         // Wikia change - end
         // Save the parser output
         $this->mMemc->set($parserOutputKey, $parserOutput, $expire);
         // ...and its pointer
         $this->mMemc->set($this->getOptionsKey($article), $optionsKey, $expire);
     } else {
         wfDebug("Parser output was marked as uncacheable and has not been saved.\n");
     }
 }
開發者ID:Tjorriemorrie,項目名稱:app,代碼行數:38,代碼來源:ParserCache.php

示例2: save

 /**
  * @param ParserOutput $parserOutput
  * @param WikiPage $page
  * @param ParserOptions $popts
  * @param string $cacheTime Time when the cache was generated
  * @param int $revId Revision ID that was parsed
  */
 public function save($parserOutput, $page, $popts, $cacheTime = null, $revId = null)
 {
     $expire = $parserOutput->getCacheExpiry();
     if ($expire > 0) {
         $cacheTime = $cacheTime ?: wfTimestampNow();
         if (!$revId) {
             $revision = $page->getRevision();
             $revId = $revision ? $revision->getId() : null;
         }
         $optionsKey = new CacheTime();
         $optionsKey->mUsedOptions = $parserOutput->getUsedOptions();
         $optionsKey->updateCacheExpiry($expire);
         $optionsKey->setCacheTime($cacheTime);
         $parserOutput->setCacheTime($cacheTime);
         $optionsKey->setCacheRevisionId($revId);
         $parserOutput->setCacheRevisionId($revId);
         $parserOutputKey = $this->getParserOutputKey($page, $popts->optionsHash($optionsKey->mUsedOptions, $page->getTitle()));
         // Save the timestamp so that we don't have to load the revision row on view
         $parserOutput->setTimestamp($page->getTimestamp());
         $msg = "Saved in parser cache with key {$parserOutputKey}" . " and timestamp {$cacheTime}" . " and revision id {$revId}" . "\n";
         $parserOutput->mText .= "\n<!-- {$msg} -->\n";
         wfDebug($msg);
         // Save the parser output
         $this->mMemc->set($parserOutputKey, $parserOutput, $expire);
         // ...and its pointer
         $this->mMemc->set($this->getOptionsKey($page), $optionsKey, $expire);
         Hooks::run('ParserCacheSaveComplete', array($this, $parserOutput, $page->getTitle(), $popts, $revId));
     } else {
         wfDebug("Parser output was marked as uncacheable and has not been saved.\n");
     }
 }
開發者ID:D66Ha,項目名稱:mediawiki,代碼行數:38,代碼來源:ParserCache.php

示例3: save

 /**
  * @param ParserOutput $parserOutput
  * @param WikiPage $page
  * @param ParserOptions $popts
  * @param string $cacheTime Time when the cache was generated
  */
 public function save($parserOutput, $page, $popts, $cacheTime = null)
 {
     $expire = $parserOutput->getCacheExpiry();
     if ($expire > 0) {
         $cacheTime = $cacheTime ?: wfTimestampNow();
         $optionsKey = new CacheTime();
         $optionsKey->mUsedOptions = $parserOutput->getUsedOptions();
         $optionsKey->updateCacheExpiry($expire);
         $optionsKey->setCacheTime($cacheTime);
         $parserOutput->setCacheTime($cacheTime);
         $optionsKey->setContainsOldMagic($parserOutput->containsOldMagic());
         $parserOutputKey = $this->getParserOutputKey($page, $popts->optionsHash($optionsKey->mUsedOptions, $page->getTitle()));
         // Save the timestamp so that we don't have to load the revision row on view
         $parserOutput->setTimestamp($page->getTimestamp());
         $parserOutput->mText .= "\n<!-- Saved in parser cache with key {$parserOutputKey} and timestamp {$cacheTime}\n -->\n";
         wfDebug("Saved in parser cache with key {$parserOutputKey} and timestamp {$cacheTime}\n");
         // Save the parser output
         $this->mMemc->set($parserOutputKey, $parserOutput, $expire);
         // ...and its pointer
         $this->mMemc->set($this->getOptionsKey($page), $optionsKey, $expire);
     } else {
         wfDebug("Parser output was marked as uncacheable and has not been saved.\n");
     }
 }
開發者ID:biribogos,項目名稱:wikihow-src,代碼行數:30,代碼來源:ParserCache.php


注:本文中的ParserOutput::getUsedOptions方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。