X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FServiceWiring.php;h=c2197a65a006128fb069e2aad0eb454bd74eada1;hb=2118d5cb99042be136b0517cb8ac7ab8344a97e1;hp=42b75f042b6e9868cd3848ac3beea371378b7eba;hpb=57eaa2bf04ce1b48bd89c10defe4de5b7d31f047;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/ServiceWiring.php b/includes/ServiceWiring.php index 42b75f042b..c2197a65a0 100644 --- a/includes/ServiceWiring.php +++ b/includes/ServiceWiring.php @@ -184,12 +184,44 @@ return [ ); }, + 'CryptHKDF' => function( MediaWikiServices $services ) { + $config = $services->getMainConfig(); + + $secret = $config->get( 'HKDFSecret' ) ?: $config->get( 'SecretKey' ); + if ( !$secret ) { + throw new RuntimeException( "Cannot use MWCryptHKDF without a secret." ); + } + + // In HKDF, the context can be known to the attacker, but this will + // keep simultaneous runs from producing the same output. + $context = [ microtime(), getmypid(), gethostname() ]; + + // Setup salt cache. Use APC, or fallback to the main cache if it isn't setup + $cache = $services->getLocalServerObjectCache(); + if ( $cache instanceof EmptyBagOStuff ) { + $cache = ObjectCache::getLocalClusterInstance(); + } + + return new CryptHKDF( $secret, $config->get( 'HKDFAlgorithm' ), + $cache, $context, $services->getCryptRand() + ); + }, + 'MediaHandlerFactory' => function( MediaWikiServices $services ) { return new MediaHandlerFactory( $services->getMainConfig()->get( 'MediaHandlers' ) ); }, + 'MimeAnalyzer' => function( MediaWikiServices $services ) { + return new MimeMagic( + MimeMagic::applyDefaultParameters( + [], + $services->getMainConfig() + ) + ); + }, + 'ProxyLookup' => function( MediaWikiServices $services ) { $mainConfig = $services->getMainConfig(); return new ProxyLookup( @@ -198,6 +230,11 @@ return [ ); }, + 'Parser' => function( MediaWikiServices $services ) { + $conf = $services->getMainConfig()->get( 'ParserConf' ); + return ObjectFactory::constructClassInstance( $conf['class'], [ $conf ] ); + }, + 'LinkCache' => function( MediaWikiServices $services ) { return new LinkCache( $services->getTitleFormatter(),