Added new success message when CLI Installer completes its work succesfuly.
[lhc/web/wiklou.git] / includes / GitInfo.php
index 3c600ed..f170a02 100644 (file)
@@ -23,6 +23,8 @@
  * @file
  */
 
+use MediaWiki\Shell\Shell;
+
 class GitInfo {
 
        /**
@@ -221,13 +223,21 @@ 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 ] )
+                                       ->restrict( Shell::RESTRICT_DEFAULT | Shell::NO_NETWORK )
+                                       ->whitelistPaths( [ $this->basedir ] )
+                                       ->execute();
+
+                               if ( $result->getExitCode() === 0 ) {
+                                       $date = (int)$result->getStdout();
                                }
                        }
                        $this->cache['headCommitDate'] = $date;