X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FGitInfo.php;h=877c2d24e515f3dbd3aa947c58215e26ec78ee9a;hb=19084be0a2a11725bb319ca7137cedfc159daef1;hp=f49f9be1386ef15131720441d18e101ac32e81a1;hpb=584775e59d553b3447f615422e1b929506470f97;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/GitInfo.php b/includes/GitInfo.php index f49f9be138..877c2d24e5 100644 --- a/includes/GitInfo.php +++ b/includes/GitInfo.php @@ -44,13 +44,13 @@ class GitInfo { * @param string $dir The root directory of the repo where the .git dir can be found */ public function __construct( $dir ) { - $this->basedir = "{$dir}/.git"; + $this->basedir = $dir . DIRECTORY_SEPARATOR . '.git'; if ( is_readable( $this->basedir ) && !is_dir( $this->basedir ) ) { $GITfile = file_get_contents( $this->basedir ); if ( strlen( $GITfile ) > 8 && substr( $GITfile, 0, 8 ) === 'gitdir: ' ) { $path = rtrim( substr( $GITfile, 8 ), "\r\n" ); $isAbsolute = $path[0] === '/' || substr( $path, 1, 1 ) === ':'; - $this->basedir = $isAbsolute ? $path : "{$dir}/{$path}"; + $this->basedir = $isAbsolute ? $path : $dir . DIRECTORY_SEPARATOR . $path; } } } @@ -143,8 +143,7 @@ class GitInfo { } else { return (int)$commitDate; } - - } + } /** * Return the name of the current branch, or HEAD if not found @@ -170,13 +169,15 @@ class GitInfo { return false; } + wfSuppressWarnings(); $configArray = parse_ini_file( $config, true ); + wfRestoreWarnings(); $remote = false; // Use the "origin" remote repo if available or any other repo if not. if ( isset( $configArray['remote origin'] ) ) { $remote = $configArray['remote origin']; - } else { + } elseif ( is_array( $configArray ) ) { foreach ( $configArray as $sectionName => $sectionConf ) { if ( substr( $sectionName, 0, 6 ) == 'remote' ) { $remote = $sectionConf;