• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wfGetParserCacheStorage函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中wfGetParserCacheStorage函数的典型用法代码示例。如果您正苦于以下问题:PHP wfGetParserCacheStorage函数的具体用法?PHP wfGetParserCacheStorage怎么用?PHP wfGetParserCacheStorage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: setUp

 function setUp()
 {
     global $wgParser, $wgParserConf, $IP, $messageMemc, $wgMemc, $wgDeferredUpdateList, $wgUser, $wgLang, $wgOut, $wgRequest, $wgStyleDirectory, $wgEnableParserCache, $wgNamespaceAliases, $wgNamespaceProtection, $wgLocalFileRepo, $parserMemc, $wgThumbnailScriptPath, $wgScriptPath, $wgArticlePath, $wgStyleSheetPath, $wgScript, $wgStylePath;
     $wgScript = '/index.php';
     $wgScriptPath = '/';
     $wgArticlePath = '/wiki/$1';
     $wgStyleSheetPath = '/skins';
     $wgStylePath = '/skins';
     $wgThumbnailScriptPath = false;
     $wgLocalFileRepo = array('class' => 'LocalRepo', 'name' => 'local', 'directory' => wfTempDir() . '/test-repo', 'url' => 'http://example.com/images', 'deletedDir' => wfTempDir() . '/test-repo/delete', 'hashLevels' => 2, 'transformVia404' => false);
     $wgNamespaceProtection[NS_MEDIAWIKI] = 'editinterface';
     $wgNamespaceAliases['Image'] = NS_FILE;
     $wgNamespaceAliases['Image_talk'] = NS_FILE_TALK;
     $wgEnableParserCache = false;
     $wgDeferredUpdateList = array();
     $wgMemc = wfGetMainCache();
     $messageMemc = wfGetMessageCacheStorage();
     $parserMemc = wfGetParserCacheStorage();
     // $wgContLang = new StubContLang;
     $wgUser = new User();
     $context = new RequestContext();
     $wgLang = $context->getLang();
     $wgOut = $context->getOutput();
     $wgParser = new StubObject('wgParser', $wgParserConf['class'], array($wgParserConf));
     $wgRequest = new WebRequest();
     if ($wgStyleDirectory === false) {
         $wgStyleDirectory = "{$IP}/skins";
     }
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:29,代码来源:UploadFromUrlTestSuite.php


示例2: setUp

 function setUp()
 {
     global $wgContLang, $wgNamespaceProtection, $wgNamespaceAliases;
     global $wgHooks, $IP;
     $wgContLang = Language::factory('en');
     //Setup CLI arguments
     if ($this->getCliArg('regex=')) {
         $this->regex = $this->getCliArg('regex=');
     } else {
         # Matches anything
         $this->regex = '';
     }
     $this->keepUploads = $this->getCliArg('keep-uploads');
     $tmpGlobals = array();
     $tmpGlobals['wgScript'] = '/index.php';
     $tmpGlobals['wgScriptPath'] = '/';
     $tmpGlobals['wgArticlePath'] = '/wiki/$1';
     $tmpGlobals['wgStyleSheetPath'] = '/skins';
     $tmpGlobals['wgStylePath'] = '/skins';
     $tmpGlobals['wgThumbnailScriptPath'] = false;
     $tmpGlobals['wgLocalFileRepo'] = array('class' => 'LocalRepo', 'name' => 'local', 'url' => 'http://example.com/images', 'hashLevels' => 2, 'transformVia404' => false, 'backend' => 'local-backend');
     $tmpGlobals['wgForeignFileRepos'] = array();
     $tmpGlobals['wgEnableParserCache'] = false;
     $tmpGlobals['wgHooks'] = $wgHooks;
     $tmpGlobals['wgDeferredUpdateList'] = array();
     $tmpGlobals['wgMemc'] = wfGetMainCache();
     $tmpGlobals['messageMemc'] = wfGetMessageCacheStorage();
     $tmpGlobals['parserMemc'] = wfGetParserCacheStorage();
     // $tmpGlobals['wgContLang'] = new StubContLang;
     $tmpGlobals['wgUser'] = new User();
     $context = new RequestContext();
     $tmpGlobals['wgLang'] = $context->getLanguage();
     $tmpGlobals['wgOut'] = $context->getOutput();
     $tmpGlobals['wgParser'] = new StubObject('wgParser', $GLOBALS['wgParserConf']['class'], array($GLOBALS['wgParserConf']));
     $tmpGlobals['wgRequest'] = $context->getRequest();
     if ($GLOBALS['wgStyleDirectory'] === false) {
         $tmpGlobals['wgStyleDirectory'] = "{$IP}/skins";
     }
     foreach ($tmpGlobals as $var => $val) {
         if (array_key_exists($var, $GLOBALS)) {
             $this->savedInitialGlobals[$var] = $GLOBALS[$var];
         }
         $GLOBALS[$var] = $val;
     }
     $this->savedWeirdGlobals['mw_namespace_protection'] = $wgNamespaceProtection[NS_MEDIAWIKI];
     $this->savedWeirdGlobals['image_alias'] = $wgNamespaceAliases['Image'];
     $this->savedWeirdGlobals['image_talk_alias'] = $wgNamespaceAliases['Image_talk'];
     $wgNamespaceProtection[NS_MEDIAWIKI] = 'editinterface';
     $wgNamespaceAliases['Image'] = NS_FILE;
     $wgNamespaceAliases['Image_talk'] = NS_FILE_TALK;
 }
开发者ID:laiello,项目名称:media-wiki-law,代码行数:51,代码来源:NewParserTest.php


示例3: suite

 public static function suite()
 {
     $suite = new PHPUnit_Framework_TestSuite();
     self::$iter = new TestFileIterator(PARSER_TESTS);
     foreach (self::$iter as $i => $test) {
         $suite->addTest(new ParserUnitTest($i, $test['test']));
         self::$count++;
     }
     unset($tests);
     self::$parser = new PTShell();
     self::$iter->setParser(self::$parser);
     self::$parser->recorder->start();
     self::$parser->setupDatabase();
     self::$iter->rewind();
     /* } */
     /* function setUp() { */
     global $wgParser, $wgParserConf, $IP, $messageMemc, $wgMemc, $wgDeferredUpdateList, $wgUser, $wgLang, $wgOut, $wgRequest, $wgStyleDirectory, $wgEnableParserCache, $wgMessageCache, $wgUseDatabaseMessages, $wgMsgCacheExpiry, $parserMemc, $wgNamespaceAliases, $wgNamespaceProtection, $wgLocalFileRepo, $wgNamespacesWithSubpages, $wgThumbnailScriptPath, $wgScriptPath, $wgArticlePath, $wgStyleSheetPath, $wgScript, $wgStylePath;
     $wgScript = '/index.php';
     $wgScriptPath = '/';
     $wgArticlePath = '/wiki/$1';
     $wgStyleSheetPath = '/skins';
     $wgStylePath = '/skins';
     $wgThumbnailScriptPath = false;
     $wgLocalFileRepo = array('class' => 'LocalRepo', 'name' => 'local', 'directory' => '', 'url' => 'http://example.com/images', 'hashLevels' => 2, 'transformVia404' => false);
     $wgNamespaceProtection[NS_MEDIAWIKI] = 'editinterface';
     $wgNamespaceAliases['Image'] = NS_FILE;
     $wgNamespaceAliases['Image_talk'] = NS_FILE_TALK;
     $wgEnableParserCache = false;
     $wgDeferredUpdateList = array();
     $wgMemc =& wfGetMainCache();
     $messageMemc =& wfGetMessageCacheStorage();
     $parserMemc =& wfGetParserCacheStorage();
     $wgContLang = new StubContLang();
     $wgUser = new StubUser();
     $wgLang = new StubUserLang();
     $wgOut = new StubObject('wgOut', 'OutputPage');
     $wgParser = new StubObject('wgParser', $wgParserConf['class'], array($wgParserConf));
     $wgRequest = new WebRequest();
     $wgMessageCache = new StubObject('wgMessageCache', 'MessageCache', array($messageMemc, $wgUseDatabaseMessages, $wgMsgCacheExpiry, wfWikiID()));
     if ($wgStyleDirectory === false) {
         $wgStyleDirectory = "{$IP}/skins";
     }
     return $suite;
 }
开发者ID:amjadtbssm,项目名称:website,代码行数:44,代码来源:MediaWikiParserTest.php


示例4: execute

 function execute()
 {
     $inputDate = $this->getOption('expiredate');
     $inputAge = $this->getOption('age');
     if ($inputDate !== null) {
         $date = wfTimestamp(TS_MW, strtotime($inputDate));
     } elseif ($inputAge !== null) {
         global $wgParserCacheExpireTime;
         $date = wfTimestamp(TS_MW, time() + $wgParserCacheExpireTime - intval($inputAge));
     } else {
         $this->error("Must specify either --expiredate or --age", 1);
     }
     $english = Language::factory('en');
     $this->output("Deleting objects expiring before " . $english->timeanddate($date) . "\n");
     $pc = wfGetParserCacheStorage();
     $success = $pc->deleteObjectsExpiringBefore($date, array($this, 'showProgress'));
     if (!$success) {
         $this->error("\nCannot purge this kind of parser cache.", 1);
     }
     $this->showProgress(100);
     $this->output("\nDone\n");
 }
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:22,代码来源:purgeParserCache.php


示例5: setUp

 protected function setUp()
 {
     global $wgParser, $wgParserConf, $IP, $messageMemc, $wgMemc, $wgUser, $wgLang, $wgOut, $wgRequest, $wgStyleDirectory, $wgParserCacheType, $wgNamespaceAliases, $wgNamespaceProtection, $parserMemc;
     $tmpDir = $this->getNewTempDirectory();
     $tmpGlobals = [];
     $tmpGlobals['wgScript'] = '/index.php';
     $tmpGlobals['wgScriptPath'] = '/';
     $tmpGlobals['wgArticlePath'] = '/wiki/$1';
     $tmpGlobals['wgStylePath'] = '/skins';
     $tmpGlobals['wgThumbnailScriptPath'] = false;
     $tmpGlobals['wgLocalFileRepo'] = ['class' => 'LocalRepo', 'name' => 'local', 'url' => 'http://example.com/images', 'hashLevels' => 2, 'transformVia404' => false, 'backend' => new FSFileBackend(['name' => 'local-backend', 'wikiId' => wfWikiID(), 'containerPaths' => ['local-public' => "{$tmpDir}/test-repo/public", 'local-thumb' => "{$tmpDir}/test-repo/thumb", 'local-temp' => "{$tmpDir}/test-repo/temp", 'local-deleted' => "{$tmpDir}/test-repo/delete"]])];
     foreach ($tmpGlobals as $var => $val) {
         if (array_key_exists($var, $GLOBALS)) {
             $this->savedGlobals[$var] = $GLOBALS[$var];
         }
         $GLOBALS[$var] = $val;
     }
     $wgNamespaceProtection[NS_MEDIAWIKI] = 'editinterface';
     $wgNamespaceAliases['Image'] = NS_FILE;
     $wgNamespaceAliases['Image_talk'] = NS_FILE_TALK;
     $wgParserCacheType = CACHE_NONE;
     DeferredUpdates::clearPendingUpdates();
     $wgMemc = wfGetMainCache();
     $messageMemc = wfGetMessageCacheStorage();
     $parserMemc = wfGetParserCacheStorage();
     RequestContext::resetMain();
     $context = RequestContext::getMain();
     $wgUser = new User();
     $wgLang = $context->getLanguage();
     $wgOut = $context->getOutput();
     $wgParser = new StubObject('wgParser', $wgParserConf['class'], [$wgParserConf]);
     $wgRequest = $context->getRequest();
     if ($wgStyleDirectory === false) {
         $wgStyleDirectory = "{$IP}/skins";
     }
     RepoGroup::destroySingleton();
     FileBackendGroup::destroySingleton();
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:38,代码来源:UploadFromUrlTestSuite.php


示例6: execute

 function execute()
 {
     $inputDate = $this->getOption('expiredate');
     $inputAge = $this->getOption('age');
     if ($inputDate !== null) {
         $date = wfTimestamp(TS_MW, strtotime($inputDate));
     } elseif ($inputAge !== null) {
         global $wgParserCacheExpireTime;
         $date = wfTimestamp(TS_MW, time() + $wgParserCacheExpireTime - intval($inputAge));
     } else {
         echo "Must specify either --expiredate or --age\n";
         exit(1);
     }
     $english = Language::factory('en');
     echo "Deleting objects expiring before " . $english->timeanddate($date) . "\n";
     $pc = wfGetParserCacheStorage();
     $success = $pc->deleteObjectsExpiringBefore($date);
     if (!$success) {
         echo "Cannot purge this kind of parser cache.\n";
         exit(1);
     }
     echo "Done\n";
 }
开发者ID:eFFemeer,项目名称:seizamcore,代码行数:23,代码来源:purgeParserCache.php


示例7: wfDebug

    wfDebug("\n\nStart command line script {$self}\n");
} else {
    $debug = "\n\nStart request {$wgRequest->getMethod()} {$wgRequest->getRequestURL()}\n";
    if ($wgDebugPrintHttpHeaders) {
        $debug .= "HTTP HEADERS:\n";
        foreach ($wgRequest->getAllHeaders() as $name => $value) {
            $debug .= "{$name}: {$value}\n";
        }
    }
    wfDebug($debug);
}
Profiler::instance()->scopedProfileOut($ps_misc);
$ps_memcached = Profiler::instance()->scopedProfileIn($fname . '-memcached');
$wgMemc = wfGetMainCache();
$messageMemc = wfGetMessageCacheStorage();
$parserMemc = wfGetParserCacheStorage();
wfDebugLog('caches', 'cluster: ' . get_class($wgMemc) . ', WAN: ' . ($wgMainWANCache === CACHE_NONE ? 'CACHE_NONE' : $wgMainWANCache) . ', stash: ' . $wgMainStash . ', message: ' . get_class($messageMemc) . ', parser: ' . get_class($parserMemc) . ', session: ' . get_class(ObjectCache::getInstance($wgSessionCacheType)));
Profiler::instance()->scopedProfileOut($ps_memcached);
// Most of the config is out, some might want to run hooks here.
Hooks::run('SetupAfterCache');
$ps_globals = Profiler::instance()->scopedProfileIn($fname . '-globals');
/**
 * @var Language $wgContLang
 */
$wgContLang = Language::factory($wgLanguageCode);
$wgContLang->initContLang();
// Now that variant lists may be available...
$wgRequest->interpolateTitle();
if (!is_object($wgAuth)) {
    $wgAuth = new MediaWiki\Auth\AuthManagerAuthPlugin();
    Hooks::run('AuthPluginSetup', [&$wgAuth]);
开发者ID:paladox,项目名称:mediawiki,代码行数:31,代码来源:Setup.php


示例8: verifyParserCache

 /**
  * Verifies if parser caching is available
  * 
  * @return $result boolean
  */
 protected function verifyParserCache(&$cache = null)
 {
     $cache = wfGetParserCacheStorage();
     return $cache instanceof FakeMemCachedClient ? false : true;
 }
开发者ID:clrh,项目名称:mediawiki,代码行数:10,代码来源:PageServer.body.php


示例9: view

 function view($usecache = true)
 {
     global $wgUser, $wgOut;
     $fname = 'NewsFeedPage::view';
     wfDebug("{$fname}: start\n");
     $note = '';
     $ims = @$_SERVER['HTTP_IF_MODIFIED_SINCE'];
     //TODO: cache control!
     if ($ims && $usecache) {
         $lastchange = wfTimestamp(TS_UNIX, NewsRenderer::getLastChangeTime());
         wfDebug("{$fname}: checking cache-ok:  IMS {$ims} vs. changed {$lastchange} \n");
         if ($wgOut->checkLastModified($lastchange)) {
             wfDebug("{$fname}: HTTP cache ok, 304 header sent \n");
             return;
             // done, 304 header sent.
         }
     }
     //NOTE: do caching for anon users only, because of user-specific
     //      rendering of textual content
     if ($wgUser->isAnon() && $usecache) {
         $cachekey = $this->getCacheKey();
         $ocache = wfGetParserCacheStorage();
         $e = $ocache ? $ocache->get($cachekey) : null;
         $note .= ' anon;';
         $debug = $e ? "got cached" : "no cached";
         wfDebug("{$fname}: ({$debug}) \n");
     } else {
         if (!$usecache) {
             wfDebug("{$fname}: purge, ignoring cache \n");
             $note .= ' purged;';
         } else {
             wfDebug("{$fname}: logged in, ignoring cache \n");
             $note .= ' user;';
         }
         $cachekey = null;
         $ocache = null;
         $e = null;
         $note .= ' user;';
     }
     $wgOut->disable();
     if ($e) {
         if (!isset($lastchange)) {
             $lastchange = wfTimestamp(TS_UNIX, NewsRenderer::getLastChangeTime());
         }
         $last = wfTimestamp(TS_UNIX, $lastchange);
         if ($last < $e['timestamp']) {
             wfDebug("{$fname}: outputting cached copy ({$cacheKey}): {$last} < " . $e['timestamp'] . " \n");
             header('Content-Type: application/' . $this->mFeedFormat . '+xml; charset=UTF-8');
             print $e['xml'];
             print "\n<!-- cached: {$note} -->\n";
             return;
             //done
         } else {
             wfDebug("{$fname}: found stale cached copy ({$cacheKey}): {$last} <= " . $e['timestamp'] . " \n");
             $note .= " stale: {$last} >= {$e['timestamp']};";
         }
     }
     //TODO: fetch actual news data and check the newest item. re-apply cache checks.
     //      this would still save the cost of rendering if the data didn't change
     global $wgParser;
     //evil global
     $wgParser->startExternalParse($this->mTitle, new ParserOptions(), Parser::OT_HTML, true);
     //FIXME: an EXTREMELY ugly hack to force generation of absolute links.
     //       this is needed because Title::getLocalUrl check wgRequest to see
     //       if absolute urls are requested, instead of it being a parser option.
     $_REQUEST['action'] = 'render';
     $renderer = NewsRenderer::newFromArticle($this, $wgParser);
     if (!$renderer) {
         wfDebug("{$fname}: no feed found on page: " . $this->mTitle->getPrefixedText() . "\n");
         wfHttpError(404, "Not Found", "no feed found on page: " . $this->mTitle->getPrefixedText());
         //TODO: better code & text
         return;
     }
     $description = '';
     //TODO: grab from article content... but what? and how?
     $ts = time();
     //this also sends the right headers
     $xml = $renderer->renderFeed($this->mFeedFormat, $description);
     wfDebug("{$fname}: rendered feed \n");
     $e = array('xml' => $xml, 'timestamp' => $ts);
     if ($ocache) {
         wfDebug("{$fname}: caching feed ({$cachekey}) \n");
         $ocache->set($cachekey, $e, $ts + 24 * 60 * 60);
         //cache for max 24 hours; cached record is discarded when anything turns up in RC anyway.
         $note .= ' updated;';
     }
     wfDebug("{$fname}: outputting fresh feed \n");
     header('Content-Type: application/' . $this->mFeedFormat . '+xml; charset=UTF-8');
     print $xml;
     print "\n<!-- fresh: {$note} -->\n";
 }
开发者ID:andreascian,项目名称:News,代码行数:91,代码来源:NewsRenderer.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wfGetPrecompiledData函数代码示例发布时间:2022-05-23
下一篇:
PHP wfGetPad函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap