X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2FGitInfo.php;h=363d7b8050042e8d5f1fd596292a2219609ab1af;hb=a3fc6fc46934c546e109ec1db52f61df1bf935b7;hp=f170a025f7e0ef7447ebedfd9e0dce6532930800;hpb=b448dac08a18b4f4ec6b3a304d129ff1b6f9a20f;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/GitInfo.php b/includes/GitInfo.php index f170a025f7..363d7b8050 100644 --- a/includes/GitInfo.php +++ b/includes/GitInfo.php @@ -37,6 +37,11 @@ class GitInfo { */ protected $basedir; + /** + * Location of the repository + */ + protected $repoDir; + /** * Path to JSON cache file for pre-computed git information. */ @@ -58,6 +63,7 @@ class GitInfo { * @see precomputeValues */ public function __construct( $repoDir, $usePrecomputed = true ) { + $this->repoDir = $repoDir; $this->cacheFile = self::getCacheFilePath( $repoDir ); wfDebugLog( 'gitinfo', "Computed cacheFile={$this->cacheFile} for {$repoDir}" @@ -221,6 +227,7 @@ class GitInfo { $date = false; if ( is_file( $wgGitBin ) && is_executable( $wgGitBin ) && + !Shell::isDisabled() && $this->getHead() !== false ) { $cmd = [ @@ -230,10 +237,11 @@ class GitInfo { '--format=format:%ct', 'HEAD', ]; + $gitDir = realpath( $this->basedir ); $result = Shell::command( $cmd ) - ->environment( [ 'GIT_DIR' => $this->basedir ] ) + ->environment( [ 'GIT_DIR' => $gitDir ] ) ->restrict( Shell::RESTRICT_DEFAULT | Shell::NO_NETWORK ) - ->whitelistPaths( [ $this->basedir ] ) + ->whitelistPaths( [ $gitDir, $this->repoDir ] ) ->execute(); if ( $result->getExitCode() === 0 ) { @@ -299,9 +307,9 @@ class GitInfo { $config = "{$this->basedir}/config"; $url = false; if ( is_readable( $config ) ) { - MediaWiki\suppressWarnings(); + Wikimedia\suppressWarnings(); $configArray = parse_ini_file( $config, true ); - MediaWiki\restoreWarnings(); + Wikimedia\restoreWarnings(); $remote = false; // Use the "origin" remote repo if available or any other repo if not.