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

PHP wfGetCache函数代码示例

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

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



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


示例16: setUp

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


示例17: updateCache

 public static function updateCache()
 {
     global $wgFlaggedRevsStatsAge;
     $rNamespaces = FlaggedRevs::getReviewNamespaces();
     if (empty($rNamespaces)) {
         return;
         // no SQL errors please :)
     }
     // Set key to limit duplicate updates...
     $dbCache = wfGetCache(CACHE_DB);
     $keySQL = wfMemcKey('flaggedrevs', 'statsUpdating');
     $dbCache->set($keySQL, '1', $wgFlaggedRevsStatsAge);
     // Get total, reviewed, and synced page count for each namespace
     list($ns_total, $ns_reviewed, $ns_synced) = self::getPerNamespaceTotals();
     // Getting mean pending edit time
     // @TODO: percentiles?
     $avePET = self::getMeanPendingEditTime();
     # Get wait (till review) time samples for anon edits...
     $reviewData = self::getEditReviewTimes($dbCache, 'anons');
     $dbw = wfGetDB(DB_MASTER);
     // The timestamp to identify this whole batch of data
     $encDataTimestamp = $dbw->timestamp();
     $dataSet = array();
     $dataSet[] = array('frs_stat_key' => 'reviewLag-sampleStartTimestamp', 'frs_stat_val' => $reviewData['sampleStartTS'], 'frs_timestamp' => $encDataTimestamp);
     $dataSet[] = array('frs_stat_key' => 'reviewLag-sampleEndTimestamp', 'frs_stat_val' => $reviewData['sampleEndTS'], 'frs_timestamp' => $encDataTimestamp);
     // All-namespace percentiles...
     foreach ($reviewData['percTable'] as $percentile => $seconds) {
         $dataSet[] = array('frs_stat_key' => 'reviewLag-percentile:' . (int) $percentile, 'frs_stat_val' => $seconds, 'frs_timestamp' => $encDataTimestamp);
     }
     // Sample size...
     $dataSet[] = array('frs_stat_key' => 'reviewLag-sampleSize', 'frs_stat_val' => $reviewData['sampleSize'], 'frs_timestamp' => $encDataTimestamp);
     // All-namespace ave/med review lag & ave pending lag stats...
     $dataSet[] = array('frs_stat_key' => 'reviewLag-average', 'frs_stat_val' => $reviewData['average'], 'frs_timestamp' => $encDataTimestamp);
     $dataSet[] = array('frs_stat_key' => 'reviewLag-median', 'frs_stat_val' => $reviewData['median'], 'frs_timestamp' => $encDataTimestamp);
     $dataSet[] = array('frs_stat_key' => 'pendingLag-average', 'frs_stat_val' => $avePET, 'frs_timestamp' => $encDataTimestamp);
     // Per-namespace total/reviewed/synced stats...
     foreach ($rNamespaces as $namespace) {
         $dataSet[] = array('frs_stat_key' => 'totalPages-NS:' . (int) $namespace, 'frs_stat_val' => isset($ns_total[$namespace]) ? $ns_total[$namespace] : 0, 'frs_timestamp' => $encDataTimestamp);
         $dataSet[] = array('frs_stat_key' => 'reviewedPages-NS:' . (int) $namespace, 'frs_stat_val' => isset($ns_reviewed[$namespace]) ? $ns_reviewed[$namespace] : 0, 'frs_timestamp' => $encDataTimestamp);
         $dataSet[] = array('frs_stat_key' => 'syncedPages-NS:' . (int) $namespace, 'frs_stat_val' => isset($ns_synced[$namespace]) ? $ns_synced[$namespace] : 0, 'frs_timestamp' => $encDataTimestamp);
     }
     // Save the data...
     $dbw->begin();
     $dbw->insert('flaggedrevs_statistics', $dataSet, __FUNCTION__, array('IGNORE'));
     $dbw->commit();
     // Stats are now up to date!
     $key = wfMemcKey('flaggedrevs', 'statsUpdated');
     $dbCache->set($key, '1', $wgFlaggedRevsStatsAge);
     $dbCache->delete($keySQL);
 }
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:50,代码来源:FlaggedRevsStats.php


示例18: __construct

 /**
  * @param array $params
  * @throws MWException
  */
 protected function __construct(array $params)
 {
     $this->wiki = $params['wiki'];
     $this->type = $params['type'];
     $this->claimTTL = isset($params['claimTTL']) ? $params['claimTTL'] : 0;
     $this->maxTries = isset($params['maxTries']) ? $params['maxTries'] : 3;
     if (isset($params['order']) && $params['order'] !== 'any') {
         $this->order = $params['order'];
     } else {
         $this->order = $this->optimalOrder();
     }
     if (!in_array($this->order, $this->supportedOrders())) {
         throw new MWException(__CLASS__ . " does not support '{$this->order}' order.");
     }
     $this->dupCache = wfGetCache(CACHE_ANYTHING);
     $this->aggr = isset($params['aggregator']) ? $params['aggregator'] : new JobQueueAggregatorNull(array());
 }
开发者ID:GoProjectOwner,项目名称:mediawiki,代码行数:21,代码来源:JobQueue.php


示例19: run

 function run()
 {
     // Initialization
     $title = $this->title;
     // Other stuff
     $user = $this->getUser();
     $summary = $this->getSummary();
     $base = $this->getBase();
     $doer = User::newFromName($this->getPerformer());
     PageTranslationHooks::$allowTargetEdit = true;
     $error = '';
     $wikipage = new WikiPage($title);
     $ok = $wikipage->doDeleteArticle($summary, false, 0, true, $error, $user);
     if (!$ok) {
         $params = array('target' => $base, 'error' => $ok);
         $type = $this->getFull() ? 'deletefnok' : 'deletelnok';
         $entry = new ManualLogEntry('pagetranslation', $type);
         $entry->setPerformer($doer);
         $entry->setTarget($title);
         $entry->setParameters($params);
         $logid = $entry->insert();
         $entry->publish($logid);
     }
     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));
         $type = $this->getFull() ? 'deletefok' : 'deletelok';
         $entry = new ManualLogEntry('pagetranslation', $type);
         $entry->setPerformer($doer);
         $entry->setTarget(Title::newFromText($base));
         $logid = $entry->insert();
         $entry->publish($logid);
         $tpage = TranslatablePage::newFromTitle($title);
         $tpage->getTranslationPercentages(true);
         foreach ($tpage->getTranslationPages() as $page) {
             $page->invalidateCache();
         }
         $title->invalidateCache();
     }
     return true;
 }
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:44,代码来源:TranslateDeleteJob.php


示例20: __construct

	/**
	 * @param $params array
	 */
	protected function __construct( array $params ) {
		$this->wiki = $params['wiki'];
		$this->type = $params['type'];
		$this->claimTTL = isset( $params['claimTTL'] ) ? $params['claimTTL'] : 0;
		$this->maxTries = isset( $params['maxTries'] ) ? $params['maxTries'] : 3;
		if ( isset( $params['order'] ) && $params['order'] !== 'any' ) {
			$this->order = $params['order'];
		} else {
			$this->order = $this->optimalOrder();
		}
		if ( !in_array( $this->order, $this->supportedOrders() ) ) {
			throw new MWException( __CLASS__ . " does not support '{$this->order}' order." );
		}
		$this->checkDelay = !empty( $params['checkDelay'] );
		if ( $this->checkDelay && !$this->supportsDelayedJobs() ) {
			throw new MWException( __CLASS__ . " does not support delayed jobs." );
		}
		$this->dupCache = wfGetCache( CACHE_ANYTHING );
	}
开发者ID:nahoj,项目名称:mediawiki_ynh,代码行数:22,代码来源:JobQueue.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP wfGetCaller函数代码示例发布时间:2022-05-23
下一篇:
PHP wfGetAllCallers函数代码示例发布时间: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