本文整理汇总了PHP中MediaWiki\MediaWikiServices::importWiring方法的典型用法代码示例。如果您正苦于以下问题:PHP MediaWikiServices::importWiring方法的具体用法?PHP MediaWikiServices::importWiring怎么用?PHP MediaWikiServices::importWiring使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MediaWiki\MediaWikiServices
的用法示例。
在下文中一共展示了MediaWikiServices::importWiring方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
}