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


PHP LBFactory::getLBFactoryClass方法代碼示例

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


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

示例1: testGetLBFactoryClass

 /**
  * @dataProvider getLBFactoryClassProvider
  */
 public function testGetLBFactoryClass($expected, $deprecated)
 {
     $mockDB = $this->getMockBuilder('DatabaseMysql')->disableOriginalConstructor()->getMock();
     $config = array('class' => $deprecated, 'connection' => $mockDB, 'sectionsByDB' => array(), 'sectionLoads' => array(), 'serverTemplate' => array());
     $this->hideDeprecated('$wgLBFactoryConf must be updated. See RELEASE-NOTES for details');
     $result = LBFactory::getLBFactoryClass($config);
     $this->assertEquals($expected, $result);
 }
開發者ID:biribogos,項目名稱:wikihow-src,代碼行數:11,代碼來源:LBFactoryTest.php

示例2: function

 *
 * @note As of version 1.27, MediaWiki is only beginning to use dependency injection.
 * The services defined here do not yet fully represent all services used by core,
 * much of the code still relies on global state for this accessing services.
 *
 * @since 1.27
 *
 * @see docs/injection.txt for an overview of using dependency injection in the
 *      MediaWiki code base.
 */
use MediaWiki\Interwiki\ClassicInterwikiLookup;
use MediaWiki\Linker\LinkRendererFactory;
use MediaWiki\MediaWikiServices;
return ['DBLoadBalancerFactory' => function (MediaWikiServices $services) {
    $config = $services->getMainConfig()->get('LBFactoryConf');
    $class = LBFactory::getLBFactoryClass($config);
    if (!isset($config['readOnlyReason'])) {
        // TODO: replace the global wfConfiguredReadOnlyReason() with a service.
        $config['readOnlyReason'] = wfConfiguredReadOnlyReason();
    }
    return new $class($config);
}, 'DBLoadBalancer' => function (MediaWikiServices $services) {
    // just return the default LB from the DBLoadBalancerFactory service
    return $services->getDBLoadBalancerFactory()->getMainLB();
}, 'SiteStore' => function (MediaWikiServices $services) {
    $rawSiteStore = new DBSiteStore($services->getDBLoadBalancer());
    // TODO: replace wfGetCache with a CacheFactory service.
    // TODO: replace wfIsHHVM with a capabilities service.
    $cache = wfGetCache(wfIsHHVM() ? CACHE_ACCEL : CACHE_ANYTHING);
    return new CachingSiteStore($rawSiteStore, $cache);
}, 'SiteLookup' => function (MediaWikiServices $services) {
開發者ID:claudinec,項目名稱:galan-wiki,代碼行數:31,代碼來源:ServiceWiring.php


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