diff --git a/library/Icinga/Application/Version.php b/library/Icinga/Application/Version.php index 70ad6cd63..85495966b 100644 --- a/library/Icinga/Application/Version.php +++ b/library/Icinga/Application/Version.php @@ -15,14 +15,21 @@ class Version */ public static function get() { - if (false !== ($gitHead = @file_get_contents(( - $gitDir = Icinga::app()->getBaseDir('.git') - ) . DIRECTORY_SEPARATOR . 'HEAD'))) { + $gitDir = Icinga::app()->getBaseDir('.git'); + $gitHead = @file_get_contents($gitDir . DIRECTORY_SEPARATOR . 'HEAD'); + if (false !== $gitHead) { $matches = array(); - if ((1 !== @preg_match('/(?.+?)$/ms', $gitHead, $matches) || false !== ( - $gitHead = @file_get_contents($gitDir . DIRECTORY_SEPARATOR . $matches['gitCommitID']) - )) && 1 === @preg_match('/(?[0-9a-f]+)$/ms', $gitHead, $matches)) { - return $matches; + if (@preg_match('/(?[0-9a-f]+)$/ms', $gitCommitID, $matches)) { + return $matches; + } } }