getBaseDir('.git') ) . DIRECTORY_SEPARATOR . 'HEAD'))) { $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 (false === ($appVersion = @file_get_contents( Icinga::app()->getApplicationDir() . DIRECTORY_SEPARATOR . 'VERSION' ))) { return false; } $matches = array(); if (false === ($res = preg_match( '/(?\w+)(?:\s*\(.*?(?:(?<=[\(,])\s*tag\s*:\s*v(?P.+?)\s*(?=[\),]).*?)?\))?\s*(?P\S+)/ms', $appVersion, $matches )) || $res === 0) { return false; } foreach ($matches as $key => $value) { if (is_int($key) || $value === '') { unset($matches[$key]); } } return $matches; } }