X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FSiteConfiguration.php;h=6bd179a9daa2a60e3d8235f5a61f09f0791c4feb;hb=aeb36c13a50083436445e212b4af98175f2661d6;hp=8d9256b81145a5fd2e4deecf10fefe17586f549d;hpb=5b3fd5a4a974b1c7bca43d2032986f9630a4d6c5;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/SiteConfiguration.php b/includes/SiteConfiguration.php index 8d9256b811..6bd179a9da 100644 --- a/includes/SiteConfiguration.php +++ b/includes/SiteConfiguration.php @@ -20,6 +20,8 @@ * @file */ +use MediaWiki\Shell\Shell; + /** * This is a class for holding configuration settings, particularly for * multi-wiki sites. @@ -345,7 +347,7 @@ class SiteConfiguration { * @param string $setting ID of the setting name to retrieve * @param string $wiki Wiki ID of the wiki in question. * @param string $suffix The suffix of the wiki in question. - * @param array $var Reference The variable to insert the value into. + * @param array &$var Reference The variable to insert the value into. * @param array $params List of parameters. $.'key' is replaced by $value in all returned data. * @param array $wikiTags The tags assigned to the wiki. */ @@ -546,19 +548,21 @@ class SiteConfiguration { } else { $this->cfgCache[$wiki] = []; } - $retVal = 1; - $cmd = wfShellWikiCmd( + $result = Shell::makeScriptCommand( "$IP/maintenance/getConfiguration.php", [ '--wiki', $wiki, '--settings', implode( ' ', $settings ), - '--format', 'PHP' + '--format', 'PHP', ] - ); - // ulimit5.sh breaks this call - $data = trim( wfShellExec( $cmd, $retVal, [], [ 'memory' => 0 ] ) ); - if ( $retVal != 0 || !strlen( $data ) ) { - throw new MWException( "Failed to run getConfiguration.php." ); + ) + // limit.sh breaks this call + ->limits( [ 'memory' => 0, 'filesize' => 0 ] ) + ->execute(); + + $data = trim( $result->getStdout() ); + if ( $result->getExitCode() != 0 || !strlen( $data ) ) { + throw new MWException( "Failed to run getConfiguration.php: {$result->getStdout()}" ); } $res = unserialize( $data ); if ( !is_array( $res ) ) {