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


PHP MediaWikiServices::getBootstrapConfig方法代码示例

本文整理汇总了PHP中MediaWiki\MediaWikiServices::getBootstrapConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP MediaWikiServices::getBootstrapConfig方法的具体用法?PHP MediaWikiServices::getBootstrapConfig怎么用?PHP MediaWikiServices::getBootstrapConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MediaWiki\MediaWikiServices的用法示例。


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

示例1: resetGlobalInstance

 /**
  * Creates a new instance of MediaWikiServices and sets it as the global default
  * instance. getInstance() will return a different MediaWikiServices object
  * after every call to resetGlobalInstance().
  *
  * @since 1.28
  *
  * @warning This should not be used during normal operation. It is intended for use
  * when the configuration has changed significantly since bootstrap time, e.g.
  * during the installation process or during testing.
  *
  * @warning Calling resetGlobalInstance() may leave the application in an inconsistent
  * state. Calling this is only safe under the ASSUMPTION that NO REFERENCE to
  * any of the services managed by MediaWikiServices exist. If any service objects
  * managed by the old MediaWikiServices instance remain in use, they may INTERFERE
  * with the operation of the services managed by the new MediaWikiServices.
  * Operating with a mix of services created by the old and the new
  * MediaWikiServices instance may lead to INCONSISTENCIES and even DATA LOSS!
  * Any class implementing LAZY LOADING is especially prone to this problem,
  * since instances would typically retain a reference to a storage layer service.
  *
  * @see forceGlobalInstance()
  * @see resetGlobalInstance()
  * @see resetBetweenTest()
  *
  * @param Config|null $bootstrapConfig The Config object to be registered as the
  *        'BootstrapConfig' service. This has to contain at least the information
  *        needed to set up the 'ConfigFactory' service. If not given, the bootstrap
  *        config of the old instance of MediaWikiServices will be re-used. If there
  *        was no previous instance, a new GlobalVarConfig object will be used to
  *        bootstrap the services.
  *
  * @param string $quick Set this to "quick" to allow expensive resources to be re-used.
  * See SalvageableService for details.
  *
  * @throws MWException If called after MW_SERVICE_BOOTSTRAP_COMPLETE has been defined in
  *         Setup.php (unless MW_PHPUNIT_TEST or MEDIAWIKI_INSTALL or RUN_MAINTENANCE_IF_MAIN
  *          is defined).
  */
 public static function resetGlobalInstance(Config $bootstrapConfig = null, $quick = '')
 {
     if (self::$instance === null) {
         // no global instance yet, nothing to reset
         return;
     }
     self::failIfResetNotAllowed(__METHOD__);
     if ($bootstrapConfig === null) {
         $bootstrapConfig = self::$instance->getBootstrapConfig();
     }
     $oldInstance = self::$instance;
     self::$instance = self::newInstance($bootstrapConfig, 'load');
     self::$instance->importWiring($oldInstance, ['BootstrapConfig']);
     if ($quick === 'quick') {
         self::$instance->salvage($oldInstance);
     } else {
         $oldInstance->destroy();
     }
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:58,代码来源:MediaWikiServices.php

示例2: installTestServices

 /**
  * @param ConfigFactory $oldConfigFactory
  * @param MediaWikiServices $newServices
  *
  * @throws MWException
  */
 private static function installTestServices(ConfigFactory $oldConfigFactory, MediaWikiServices $newServices)
 {
     // Use bootstrap config for all configuration.
     // This allows config overrides via global variables to take effect.
     $bootstrapConfig = $newServices->getBootstrapConfig();
     $newServices->resetServiceForTesting('ConfigFactory');
     $newServices->redefineService('ConfigFactory', self::makeTestConfigFactoryInstantiator($oldConfigFactory, ['main' => $bootstrapConfig]));
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:14,代码来源:MediaWikiTestCase.php


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