dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Revert "Work around Firefox 57 attribute parsing regression""
[lhc/web/wiklou.git]
/
includes
/
GitInfo.php
diff --git
a/includes/GitInfo.php
b/includes/GitInfo.php
index
8095fd7
..
6270b27
100644
(file)
--- a/
includes/GitInfo.php
+++ b/
includes/GitInfo.php
@@
-37,6
+37,11
@@
class GitInfo {
*/
protected $basedir;
*/
protected $basedir;
+ /**
+ * Location of the repository
+ */
+ protected $repoDir;
+
/**
* Path to JSON cache file for pre-computed git information.
*/
/**
* Path to JSON cache file for pre-computed git information.
*/
@@
-58,6
+63,7
@@
class GitInfo {
* @see precomputeValues
*/
public function __construct( $repoDir, $usePrecomputed = true ) {
* @see precomputeValues
*/
public function __construct( $repoDir, $usePrecomputed = true ) {
+ $this->repoDir = $repoDir;
$this->cacheFile = self::getCacheFilePath( $repoDir );
wfDebugLog( 'gitinfo',
"Computed cacheFile={$this->cacheFile} for {$repoDir}"
$this->cacheFile = self::getCacheFilePath( $repoDir );
wfDebugLog( 'gitinfo',
"Computed cacheFile={$this->cacheFile} for {$repoDir}"
@@
-230,8
+236,11
@@
class GitInfo {
'--format=format:%ct',
'HEAD',
];
'--format=format:%ct',
'HEAD',
];
+ $gitDir = realpath( $this->basedir );
$result = Shell::command( $cmd )
$result = Shell::command( $cmd )
- ->environment( [ 'GIT_DIR' => $this->basedir ] )
+ ->environment( [ 'GIT_DIR' => $gitDir ] )
+ ->restrict( Shell::RESTRICT_DEFAULT | Shell::NO_NETWORK )
+ ->whitelistPaths( [ $gitDir, $this->repoDir ] )
->execute();
if ( $result->getExitCode() === 0 ) {
->execute();
if ( $result->getExitCode() === 0 ) {
@@
-297,9
+306,9
@@
class GitInfo {
$config = "{$this->basedir}/config";
$url = false;
if ( is_readable( $config ) ) {
$config = "{$this->basedir}/config";
$url = false;
if ( is_readable( $config ) ) {
-
MediaWiki
\suppressWarnings();
+
Wikimedia
\suppressWarnings();
$configArray = parse_ini_file( $config, true );
$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.
$remote = false;
// Use the "origin" remote repo if available or any other repo if not.