本文整理匯總了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();
}
}