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


PHP wfGetCache函数代码示例

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


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

示例1: __construct

 /**
  * @params include:
  *   - objectCache : Name of an object cache registered in $wgObjectCaches.
  *                   This defaults to the one specified by $wgMainCacheType.
  *   - cacheTTL    : Seconds to cache the aggregate data before regenerating.
  * @param array $params
  */
 protected function __construct(array $params)
 {
     parent::__construct($params);
     $this->cache = isset($params['objectCache']) ? wfGetCache($params['objectCache']) : wfGetMainCache();
     $this->cacheTTL = isset($params['cacheTTL']) ? $params['cacheTTL'] : 180;
     // 3 min
 }
开发者ID:Tarendai,项目名称:spring-website,代码行数:14,代码来源:JobQueueAggregatorMemc.php

示例2: setUp

 /**
  * Prepares the environment before running a test.
  */
 protected function setUp()
 {
     global $wgMemc;
     parent::setUp();
     $this->user = User::newFromName("someReviewer");
     $wgMemc = wfGetCache(CACHE_DB);
 }
开发者ID:crippsy14,项目名称:orange-smorange,代码行数:10,代码来源:FRUserActivityTest.php

示例3: getInlineScript

 /**
  * Get contents of a javascript file for inline use.
  *
  * Roughly based MediaWiki core methods:
  * - ResourceLoader::filter()
  * - ResourceLoaderFileModule::readScriptFiles()
  *
  * @param string $name Path to file relative to /modules/inline/
  * @return string Minified script
  * @throws Exception If file doesn't exist
  */
 protected static function getInlineScript($name)
 {
     // Get file
     $filePath = __DIR__ . '/../../modules/inline/' . $name;
     if (!file_exists($filePath)) {
         throw new Exception(__METHOD__ . ": file not found: \"{$filePath}\"");
     }
     $contents = file_get_contents($filePath);
     // Try minified from cache
     $key = wfMemcKey('centralauth', 'minify-js', md5($contents));
     $cache = wfGetCache(CACHE_ANYTHING);
     $cacheEntry = $cache->get($key);
     if (is_string($cacheEntry)) {
         return $cacheEntry;
     }
     // Compute new value
     $result = '';
     try {
         $result = JavaScriptMinifier::minify($contents) . "\n/* cache key: {$key} */";
         $cache->set($key, $result);
     } catch (Exception $e) {
         MWExceptionHandler::logException($e);
         wfDebugLog('CentralAuth', __METHOD__ . ": minification failed for {$name}: {$e}");
         $result = ResourceLoader::formatException($e) . "\n" . $contents;
     }
     return $result;
 }
开发者ID:NDKilla,项目名称:mediawiki-extensions-CentralAuth,代码行数:38,代码来源:SpecialCentralAutoLogin.php

示例4: newInstance

 /**
  * @since 1.21
  * @deprecated 1.25 Construct a SiteStore instance directly instead.
  *
  * @param ORMTable|null $sitesTable
  * @param BagOStuff|null $cache
  *
  * @return SiteStore
  */
 public static function newInstance(ORMTable $sitesTable = null, BagOStuff $cache = null)
 {
     if ($cache === null) {
         $cache = wfGetCache(wfIsHHVM() ? CACHE_ACCEL : CACHE_ANYTHING);
     }
     $siteStore = new DBSiteStore();
     return new static($siteStore, $cache);
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:17,代码来源:SiteSQLStore.php

示例5: __construct

 /**
  * Constructor.
  * @param string $title
  * @param integer $revision
  * @param ObjectCache $cache: (optional) cache client.
  * @param Http $http: (optional) HTTP client.
  */
 function __construct($title, $revision, $cache = NULL, $http = NULL)
 {
     global $wgEventLoggingDBname;
     $this->title = $title;
     $this->revision = $revision;
     $this->cache = $cache ?: wfGetCache(CACHE_ANYTHING);
     $this->http = $http ?: new Http();
     $this->key = "schema:{$wgEventLoggingDBname}:{$title}:{$revision}";
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:16,代码来源:RemoteSchema.php

示例6: __construct

 function __construct($memCached, $useDB, $expiry)
 {
     if (!$memCached) {
         $memCached = wfGetCache(CACHE_NONE);
     }
     $this->mMemc = $memCached;
     $this->mDisable = !$useDB;
     $this->mExpiry = $expiry;
 }
开发者ID:GodelDesign,项目名称:Godel,代码行数:9,代码来源:MessageCache.php

示例7: setUp

 protected function setUp()
 {
     parent::setUp();
     global $wgHooks;
     $this->setMwGlobals(array('wgHooks' => $wgHooks, 'wgTranslateTranslationServices' => array()));
     $wgHooks['TranslatePostInitGroups'] = array(array($this, 'getTestGroups'));
     $mg = MessageGroups::singleton();
     $mg->setCache(wfGetCache('hash'));
     $mg->recache();
 }
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:10,代码来源:ApiQueryMessageGroupsTest.php

示例8: run

	function run() {
		global $wgUser;

		// Initialization
		$title = $this->title;
		// Other stuff
		$user    = $this->getUser();
		$summary = $this->getSummary();
		$base    = $this->getBase();

		PageTranslationHooks::$allowTargetEdit = true;
		$oldUser = $wgUser;
		$wgUser = $user;

		$error = '';
		$article = new Article( $title, 0 );
		$ok = $article->doDeleteArticle( $summary, false, 0, true, $error );
		if ( !$ok ) {
			$logger = new LogPage( 'pagetranslation' );
			$params = array(
				'user' => $this->getPerformer(),
				'target' => $base,
				'error' => base64_encode( serialize( $ok ) ), // This is getting ridiculous
			);
			$doer = User::newFromName( $this->getPerformer() );
			$msg = $this->getFull() ? 'deletefnok' : 'deletelnok';
			$logger->addEntry( $msg, $title, null, array( serialize( $params ) ), $doer );
		}

		PageTranslationHooks::$allowTargetEdit = false;

		$cache = wfGetCache( CACHE_DB );
		$pages = (array) $cache->get( wfMemcKey( 'pt-base', $base ) );
		$lastitem = array_pop( $pages );
		if ( $title->getPrefixedText() === $lastitem ) {
			$cache->delete( wfMemcKey( 'pt-base', $base ) );
			$logger = new LogPage( 'pagetranslation' );
			$params = array( 'user' => $this->getPerformer() );
			$doer = User::newFromName( $this->getPerformer() );
			$msg = $this->getFull() ? 'deletefok' : 'deletelok';
			$logger->addEntry( $msg, Title::newFromText( $base ), null, array( serialize( $params ) ), $doer );

			$tpage = TranslatablePage::newFromTitle( $title );
			$tpage->getTranslationPercentages( true );
			foreach ( $tpage->getTranslationPages() as $page ) {
				$page->invalidateCache();
			}
			$title->invalidateCache();
		}

		$wgUser = $oldUser;

		return true;
	}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:54,代码来源:DeleteJob.php

示例9: setUp

 protected function setUp()
 {
     parent::setUp();
     global $wgHooks;
     $this->setMwGlobals(array('wgHooks' => $wgHooks, 'wgGroupPermissions' => array(), 'wgTranslateMessageNamespaces' => array(NS_MEDIAWIKI)));
     $wgHooks['TranslatePostInitGroups'] = array(array($this, 'getTestGroups'));
     $mg = MessageGroups::singleton();
     $mg->setCache(wfGetCache('hash'));
     $mg->recache();
     MessageIndex::setInstance(new HashMessageIndex());
     MessageIndex::singleton()->rebuild();
 }
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:12,代码来源:ApiTranslationReviewTest.php

示例10: setUp

 public function setUp()
 {
     parent::setUp();
     global $wgHooks;
     $this->setMwGlobals(array('wgHooks' => $wgHooks, 'wgTranslateTranslationServices' => array(), 'wgTranslateDelayedMessageIndexRebuild' => false));
     $wgHooks['TranslatePostInitGroups'] = array();
     $mg = MessageGroups::singleton();
     $mg->setCache(wfGetCache('hash'));
     $mg->recache();
     MessageIndex::setInstance(new HashMessageIndex());
     MessageIndex::singleton()->rebuild();
 }
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:12,代码来源:MessageIndexRebuildJobTest.php

示例11: setUp

 protected function setUp()
 {
     parent::setUp();
     global $wgHooks;
     $this->setMwGlobals(array('wgHooks' => $wgHooks, 'wgTranslateTranslationServices' => array(), 'wgTranslateCacheDirectory' => $this->getNewTempDirectory()));
     $wgHooks['TranslatePostInitGroups'] = array();
     $mg = MessageGroups::singleton();
     $mg->setCache(wfGetCache('hash'));
     $mg->recache();
     MessageIndex::setInstance(new HashMessageIndex());
     MessageIndex::singleton()->rebuild();
 }
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:12,代码来源:SpecialPagesTest.php

示例12: checkRateLimit

 /**
  * Implement a rudimentary rate limiting system,
  * we can't use User::pingLImiter() because stewards
  * have the "noratelimit" userright
  *
  * Hardcoded to allow 1 merge per 60 seconds
  *
  * @return bool true if we should let the user proceed
  */
 private function checkRateLimit()
 {
     $cache = wfGetCache(CACHE_ANYTHING);
     $key = 'centralauth:usermerge:' . md5($this->getUser()->getName());
     $found = $cache->get($key);
     if ($found === false) {
         $cache->set($key, true, 60);
         return true;
     } else {
         return false;
     }
 }
开发者ID:NDKilla,项目名称:mediawiki-extensions-CentralAuth,代码行数:21,代码来源:SpecialGlobalUserMerge.php

示例13: setUp

 protected function setUp()
 {
     parent::setUp();
     $conf = array(__DIR__ . '/data/ParentGroups.yaml');
     global $wgHooks;
     $this->setMwGlobals(array('wgHooks' => $wgHooks, 'wgTranslateGroupFiles' => $conf, 'wgTranslateTranslationServices' => array()));
     $wgHooks['TranslatePostInitGroups'] = array('MessageGroups::getConfiguredGroups');
     $mg = MessageGroups::singleton();
     $mg->setCache(wfGetCache('hash'));
     $mg->recache();
     MessageIndex::setInstance(new HashMessageIndex());
     MessageIndex::singleton()->rebuild();
 }
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:13,代码来源:MessageGroupsTest.php

示例14: setUp

 protected function setUp()
 {
     parent::setUp();
     global $wgHooks, $wgTranslateTranslationServices, $wgTranslateTestTTMServer;
     $this->setMwGlobals(array('wgHooks' => $wgHooks, 'wgTranslateTranslationServices' => array()));
     $wgTranslateTranslationServices['TTMServer'] = $wgTranslateTestTTMServer;
     $wgHooks['TranslatePostInitGroups'] = array(array($this, 'addGroups'));
     $mg = MessageGroups::singleton();
     $mg->setCache(wfGetCache('hash'));
     $mg->recache();
     MessageIndex::setInstance(new HashMessageIndex());
     MessageIndex::singleton()->rebuild();
 }
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:13,代码来源:SolrTTMServerTest.php

示例15: __construct

 function __construct()
 {
     $this->cache = wfGetCache(CACHE_ANYTHING);
     // if (HuijiPrefix::hasPrefix($prefix)){
     // 	$this->mPrefix = $prefix;
     // } else {
     // 	$this->mPrefix = '';
     // }
     // $this->cache = wfGetCache( CACHE_ANYTHING );
     // $this->loadFromRow();
     // $siteCache = self::getSiteCache();
     // $siteCache->set($this->mPrefix, $this);
 }
开发者ID:HuijiWiki,项目名称:HuijiMiddleware,代码行数:13,代码来源:WikiSiteClass.php


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