X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FServiceWiring.php;h=75ce8eca9413a89525038c74002ea23f3bf608b9;hb=f12e22bb590e86bf2214319d98289e3b323f8ec6;hp=e1244e75900eda8548141a6e72d3739c367605e9;hpb=fb44a171b20b1ca832b93c8d788070fc6b13d932;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/ServiceWiring.php b/includes/ServiceWiring.php index e1244e7590..75ce8eca94 100644 --- a/includes/ServiceWiring.php +++ b/includes/ServiceWiring.php @@ -41,6 +41,7 @@ use MediaWiki\Interwiki\ClassicInterwikiLookup; use MediaWiki\Linker\LinkRendererFactory; use MediaWiki\Logger\LoggerFactory; use MediaWiki\MediaWikiServices; +use MediaWiki\Shell\CommandFactory; return [ 'DBLoadBalancerFactory' => function ( MediaWikiServices $services ) { @@ -287,7 +288,7 @@ return [ return ObjectFactory::constructClassInstance( $conf['class'], [ $conf ] ); }, - 'ParserCache' => function( MediaWikiServices $services ) { + 'ParserCache' => function ( MediaWikiServices $services ) { $config = $services->getMainConfig(); $cache = ObjectCache::getInstance( $config->get( 'ParserCacheType' ) ); wfDebugLog( 'caches', 'parser: ' . get_class( $cache ) ); @@ -298,7 +299,7 @@ return [ ); }, - 'LinkCache' => function( MediaWikiServices $services ) { + 'LinkCache' => function ( MediaWikiServices $services ) { return new LinkCache( $services->getTitleFormatter(), $services->getMainWANObjectCache() @@ -428,6 +429,23 @@ return [ ); }, + 'ShellCommandFactory' => function ( MediaWikiServices $services ) { + $config = $services->getMainConfig(); + + $limits = [ + 'time' => $config->get( 'MaxShellTime' ), + 'walltime' => $config->get( 'MaxShellWallClockTime' ), + 'memory' => $config->get( 'MaxShellMemory' ), + 'filesize' => $config->get( 'MaxShellFileSize' ), + ]; + $cgroup = $config->get( 'ShellCgroup' ); + + $factory = new CommandFactory( $limits, $cgroup ); + $factory->setLogger( LoggerFactory::getInstance( 'exec' ) ); + + return $factory; + }, + /////////////////////////////////////////////////////////////////////////// // NOTE: When adding a service here, don't forget to add a getter function // in the MediaWikiServices class. The convenience getter should just call