diff --git a/application/views/scripts/about/index.phtml b/application/views/scripts/about/index.phtml
index 71ae71bc0..d6d766e93 100644
--- a/application/views/scripts/about/index.phtml
+++ b/application/views/scripts/about/index.phtml
@@ -2,26 +2,18 @@
Icinga Web 2
$this->translate('Version: %s'),
- 'gitCommitID' => $this->translate('Git commit ID: %s'),
- 'gitCommitDate' => $this->translate('Git commit date: %s')
- ) as $key => $label) {
- if (array_key_exists($key, $version) && null !== ($value = $version[$key])) {
- $versionInfo[] = sprintf($label, htmlspecialchars($value));
- }
+ foreach (array(
+ 'appVersion' => $this->translate('Version: %s'),
+ 'gitCommitID' => $this->translate('Git commit ID: %s'),
+ 'gitCommitDate' => $this->translate('Git commit date: %s')
+ ) as $key => $label) {
+ if (array_key_exists($key, $version) && null !== ($value = $version[$key])) {
+ $versionInfo[] = sprintf($label, htmlspecialchars($value));
}
}
- echo (
- 0 === count($versionInfo)
- ? '' . $this->translate(
- 'Can\'t determine Icinga Web 2\'s version'
- )
- : '
' . nl2br(implode("\n", $versionInfo), false)
- ) . '
';
?>
+ = implode('
', $versionInfo) ?>
Copyright © 2013-2015 =
$this->translate('The Icinga Project')
?>
License: GNU GPL v2 or later
diff --git a/library/Icinga/Application/Version.php b/library/Icinga/Application/Version.php
index 7d8f54fbf..22b05f1cc 100644
--- a/library/Icinga/Application/Version.php
+++ b/library/Icinga/Application/Version.php
@@ -13,15 +13,16 @@ class Version
/**
* Get the version of this instance of Icinga Web 2
*
- * @return array|false array on success, false otherwise
+ * @return array
*/
public static function get()
{
+ $version = array('appVersion' => self::VERSION);
+
if (false !== ($appVersion = @file_get_contents(Icinga::app()->getApplicationDir('GITCOMMIT')))) {
$matches = array();
if (@preg_match('/^(?P\w+) (?P\S+)/', $appVersion, $matches)) {
- $matches['appVersion'] = self::VERSION;
- return $matches;
+ return array_merge($version, $matches);
}
}
@@ -38,12 +39,11 @@ class Version
if (false !== $gitCommitID) {
$matches = array();
if (@preg_match('/(?[0-9a-f]+)$/ms', $gitCommitID, $matches)) {
- $matches['appVersion'] = self::VERSION;
- return $matches;
+ return array_merge($version, $matches);
}
}
}
- return false;
+ return $version;
}
}