X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2FServiceWiring.php;h=ab51eabd478983de080353a34141a549ffc1992f;hp=689a98e482a33699aff4d6a3bc4fbd15d597eeac;hb=f724e1dfba13c74b82d1f12442b08e8798bea82b;hpb=5ccb1a42c7752778db2381d180dbee0ed9b7e779 diff --git a/includes/ServiceWiring.php b/includes/ServiceWiring.php index 689a98e482..ab51eabd47 100644 --- a/includes/ServiceWiring.php +++ b/includes/ServiceWiring.php @@ -27,6 +27,13 @@ * For every service that MediaWiki core requires, an instantiator must be defined in * this file. * + * Note that, ideally, all information used to instantiate service objects should come + * from configuration. Information derived from the current request is acceptable, but + * only where there is no feasible alternative. It is preferred that such information + * (like the client IP, the acting user's identity, requested title, etc) be passed to + * the service object's methods as parameters. This makes the flow of information more + * obvious, and makes it easier to understand the behavior of services. + * * @note As of version 1.27, MediaWiki is only beginning to use dependency injection. * The services defined here do not yet fully represent all services used by core, * much of the code still relies on global state for this accessing services. @@ -111,7 +118,8 @@ return [ new ServiceOptions( BlockManager::$constructorOptions, $services->getMainConfig() ), - $services->getPermissionManager() + $services->getPermissionManager(), + LoggerFactory::getInstance( 'BlockManager' ) ); }, @@ -266,6 +274,8 @@ return [ if ( defined( 'MW_NO_SESSION' ) ) { return $services->getLinkRendererFactory()->create(); } else { + // Normally information from the current request would not be passed in here; + // this is an exception. (See also the class documentation.) return $services->getLinkRendererFactory()->createForUser( RequestContext::getMain()->getUser() ); @@ -632,7 +642,7 @@ return [ $services->getCommentStore(), $services->getActorMigration(), $config->get( 'MultiContentRevisionSchemaMigrationStage' ), - LoggerFactory::getProvider(), + LoggerFactory::getInstance( 'RevisionStore' ), $config->get( 'ContentHandlerUseDB' ) ); @@ -783,7 +793,8 @@ return [ $services->getDBLoadBalancer(), $services->getCommentStore(), $services->getActorMigration(), - $services->getWatchedItemStore() + $services->getWatchedItemStore(), + $services->getPermissionManager() ); },