From: Max Semenik Date: Tue, 17 Oct 2017 03:29:58 +0000 (-0700) Subject: Convert GitInfo to the new shell framework X-Git-Tag: 1.31.0-rc.0~1746^2 X-Git-Url: http://git.cyclocoop.org/?a=commitdiff_plain;h=bf03f7bde354779cacacc2695c836a25fd468c0a;p=lhc%2Fweb%2Fwiklou.git Convert GitInfo to the new shell framework Change-Id: I2fdebe8748708412c59a9de4028cc2e280c8d0c8 --- diff --git a/includes/GitInfo.php b/includes/GitInfo.php index 3c600ed984..8095fd7308 100644 --- a/includes/GitInfo.php +++ b/includes/GitInfo.php @@ -23,6 +23,8 @@ * @file */ +use MediaWiki\Shell\Shell; + class GitInfo { /** @@ -221,13 +223,19 @@ class GitInfo { is_executable( $wgGitBin ) && $this->getHead() !== false ) { - $environment = [ "GIT_DIR" => $this->basedir ]; - $cmd = wfEscapeShellArg( $wgGitBin ) . - " show -s --format=format:%ct HEAD"; - $retc = false; - $commitDate = wfShellExec( $cmd, $retc, $environment ); - if ( $retc === 0 ) { - $date = (int)$commitDate; + $cmd = [ + $wgGitBin, + 'show', + '-s', + '--format=format:%ct', + 'HEAD', + ]; + $result = Shell::command( $cmd ) + ->environment( [ 'GIT_DIR' => $this->basedir ] ) + ->execute(); + + if ( $result->getExitCode() === 0 ) { + $date = (int)$result->getStdout(); } } $this->cache['headCommitDate'] = $date;