X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FGitInfo.php;h=8095fd7308761ff182624386236d9d79927120a1;hb=4ca7f7a21c128b29c1a06093129d34150bfe6368;hp=3c600ed984057918d3a7f8c2bb07af0797e8bcbc;hpb=f23ff352ac8b883e958d3a7f506f991571d18d88;p=lhc%2Fweb%2Fwiklou.git 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;