getBaseDir('.git'); $gitHead = @file_get_contents($gitDir . DIRECTORY_SEPARATOR . 'HEAD'); if (false !== $gitHead) { $matches = array(); if (@preg_match('/(?[0-9a-f]+)$/ms', $gitCommitID, $matches)) { return $matches; } } } if (false === ($appVersion = @file_get_contents(Icinga::app()->getApplicationDir('VERSION')))) { return false; } $matches = array(); if (! @preg_match('/^(?P\S+)(?: \((.+?)\))? (?P\S+)/', $appVersion, $matches)) { return false; } if (array_key_exists(1, $matches)) { $tagMatches = array(); foreach (explode(', ', $matches[1]) as $gitRef) { if (@preg_match('/^tag: v(.+)/', $gitRef, $tagMatches)) { $matches['appVersion'] = $tagMatches[1]; break; } } unset($matches[1]); } return $matches; } }