本文整理匯總了PHP中MediaWiki\MediaWikiServices::loadWiringFiles方法的典型用法代碼示例。如果您正苦於以下問題:PHP MediaWikiServices::loadWiringFiles方法的具體用法?PHP MediaWikiServices::loadWiringFiles怎麽用?PHP MediaWikiServices::loadWiringFiles使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MediaWiki\MediaWikiServices
的用法示例。
在下文中一共展示了MediaWikiServices::loadWiringFiles方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: newMediaWikiServices
/**
* @return MediaWikiServices
*/
private function newMediaWikiServices(Config $config = null)
{
if ($config === null) {
$config = $this->newTestConfig();
}
$instance = new MediaWikiServices($config);
// Load the default wiring from the specified files.
$wiringFiles = $config->get('ServiceWiringFiles');
$instance->loadWiringFiles($wiringFiles);
return $instance;
}
示例2: overrideMwServices
/**
* Stashes the global instance of MediaWikiServices, and installs a new one,
* allowing test cases to override settings and services.
* The previous instance of MediaWikiServices will be restored on tearDown.
*
* @since 1.27
*
* @param Config $configOverrides Configuration overrides for the new MediaWikiServices instance.
* @param callable[] $services An associative array of services to re-define. Keys are service
* names, values are callables.
*
* @return MediaWikiServices
* @throws MWException
*/
protected function overrideMwServices(Config $configOverrides = null, array $services = [])
{
if (!$configOverrides) {
$configOverrides = new HashConfig();
}
$oldInstance = MediaWikiServices::getInstance();
$oldConfigFactory = $oldInstance->getConfigFactory();
$testConfig = self::makeTestConfig(null, $configOverrides);
$newInstance = new MediaWikiServices($testConfig);
// Load the default wiring from the specified files.
// NOTE: this logic mirrors the logic in MediaWikiServices::newInstance.
$wiringFiles = $testConfig->get('ServiceWiringFiles');
$newInstance->loadWiringFiles($wiringFiles);
// Provide a traditional hook point to allow extensions to configure services.
Hooks::run('MediaWikiServices', [$newInstance]);
foreach ($services as $name => $callback) {
$newInstance->redefineService($name, $callback);
}
self::installTestServices($oldConfigFactory, $newInstance);
MediaWikiServices::forceGlobalInstance($newInstance);
return $newInstance;
}