/** * Creates a new MediaWikiServices instance and initializes it according to the * given $bootstrapConfig. In particular, all wiring files defined in the * ServiceWiringFiles setting are loaded, and the MediaWikiServices hook is called. * * @param Config|null $bootstrapConfig The Config object to be registered as the * 'BootstrapConfig' service. * * @param string $loadWiring set this to 'load' to load the wiring files specified * in the 'ServiceWiringFiles' setting in $bootstrapConfig. * * @return MediaWikiServices * @throws MWException * @throws \FatalError */ private static function newInstance(Config $bootstrapConfig, $loadWiring = '') { $instance = new self($bootstrapConfig); // Load the default wiring from the specified files. if ($loadWiring === 'load') { $wiringFiles = $bootstrapConfig->get('ServiceWiringFiles'); $instance->loadWiringFiles($wiringFiles); } // Provide a traditional hook point to allow extensions to configure services. Hooks::run('MediaWikiServices', [$instance]); return $instance; }