X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FSiteConfiguration.php;h=8e77956e82911fd3856ef0dcc54bd2693afd99b1;hb=138298b397b308ad6e4bfc7088884d90e8ac1e37;hp=7a01a6575bbb3e91ab56fb5917e406da2e2c79f8;hpb=237d3271fd313ebe09858a5c442a91216a7b61cf;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/SiteConfiguration.php b/includes/SiteConfiguration.php index 7a01a6575b..8e77956e82 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. @@ -430,7 +432,7 @@ class SiteConfiguration { return $default; } - $ret = call_user_func_array( $this->siteParamsCallback, [ $this, $wiki ] ); + $ret = ( $this->siteParamsCallback )( $this, $wiki ); # Validate the returned value if ( !is_array( $ret ) ) { return $default; @@ -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 ) ) { @@ -602,7 +606,7 @@ class SiteConfiguration { public function loadFullData() { if ( $this->fullLoadCallback && !$this->fullLoadDone ) { - call_user_func( $this->fullLoadCallback, $this ); + ( $this->fullLoadCallback )( $this ); $this->fullLoadDone = true; } }