当前位置: 首页>>代码示例>>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;未经允许,请勿转载。