Skip to content

Instantly share code, notes, and snippets.

@mainframe98
Last active January 31, 2018 16:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mainframe98/c449ef71bb87cdbc337dd7c55dc6defc to your computer and use it in GitHub Desktop.
Save mainframe98/c449ef71bb87cdbc337dd7c55dc6defc to your computer and use it in GitHub Desktop.
Override ConfigFactory
<?php
$services->redefineService(
'ConfigFactory',
function ( MediaWikiServices $services ) {
// Use the bootstrap config to initialize the ConfigFactory.
$bootstrapConfig = $services->getBootstrapConfig();
/** @var array $registry */
$registry = $bootstrapConfig->get( 'ConfigRegistry' );
/** @var Config\SetConfigurationFactory $setFactory */
$setFactory = $services->getService( 'SetConfigurationFactory' );
$factory = new ConfigFactory( $setFactory );
foreach ( $registry as $name => $callback ) {
$factory->register( $name, $callback );
}
return $factory;
}
);
@mainframe98
Copy link
Author

I'd need the MainWANObjectCache service on line 10. It will call the MainConfig service, which in turn will call the ConfigFactory provided by MediaWiki, which I wish to override.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment