mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-27 07:44:04 +02:00
parent
feb27b8a02
commit
e2d6089ff3
@ -2,26 +2,18 @@
|
|||||||
<h1>Icinga Web 2</h1>
|
<h1>Icinga Web 2</h1>
|
||||||
<?php
|
<?php
|
||||||
$versionInfo = array();
|
$versionInfo = array();
|
||||||
if ($version !== false) {
|
foreach (array(
|
||||||
foreach (array(
|
'appVersion' => $this->translate('Version: %s'),
|
||||||
'appVersion' => $this->translate('Version: %s'),
|
'gitCommitID' => $this->translate('Git commit ID: %s'),
|
||||||
'gitCommitID' => $this->translate('Git commit ID: %s'),
|
'gitCommitDate' => $this->translate('Git commit date: %s')
|
||||||
'gitCommitDate' => $this->translate('Git commit date: %s')
|
) as $key => $label) {
|
||||||
) as $key => $label) {
|
if (array_key_exists($key, $version) && null !== ($value = $version[$key])) {
|
||||||
if (array_key_exists($key, $version) && null !== ($value = $version[$key])) {
|
$versionInfo[] = sprintf($label, htmlspecialchars($value));
|
||||||
$versionInfo[] = sprintf($label, htmlspecialchars($value));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
echo (
|
|
||||||
0 === count($versionInfo)
|
|
||||||
? '<p class="message-error">' . $this->translate(
|
|
||||||
'Can\'t determine Icinga Web 2\'s version'
|
|
||||||
)
|
|
||||||
: '<p>' . nl2br(implode("\n", $versionInfo), false)
|
|
||||||
) . '</p>';
|
|
||||||
?>
|
?>
|
||||||
|
<p><?= implode('<br>', $versionInfo) ?></p>
|
||||||
<p>Copyright © 2013-2015 <a href="https://www.icinga.org"><?=
|
<p>Copyright © 2013-2015 <a href="https://www.icinga.org"><?=
|
||||||
$this->translate('The Icinga Project')
|
$this->translate('The Icinga Project')
|
||||||
?></a><br>License: GNU GPL v2 or later</p>
|
?></a><br>License: GNU GPL v2 or later</p>
|
||||||
|
@ -13,15 +13,16 @@ class Version
|
|||||||
/**
|
/**
|
||||||
* Get the version of this instance of Icinga Web 2
|
* Get the version of this instance of Icinga Web 2
|
||||||
*
|
*
|
||||||
* @return array|false array on success, false otherwise
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function get()
|
public static function get()
|
||||||
{
|
{
|
||||||
|
$version = array('appVersion' => self::VERSION);
|
||||||
|
|
||||||
if (false !== ($appVersion = @file_get_contents(Icinga::app()->getApplicationDir('GITCOMMIT')))) {
|
if (false !== ($appVersion = @file_get_contents(Icinga::app()->getApplicationDir('GITCOMMIT')))) {
|
||||||
$matches = array();
|
$matches = array();
|
||||||
if (@preg_match('/^(?P<gitCommitID>\w+) (?P<gitCommitDate>\S+)/', $appVersion, $matches)) {
|
if (@preg_match('/^(?P<gitCommitID>\w+) (?P<gitCommitDate>\S+)/', $appVersion, $matches)) {
|
||||||
$matches['appVersion'] = self::VERSION;
|
return array_merge($version, $matches);
|
||||||
return $matches;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,12 +39,11 @@ class Version
|
|||||||
if (false !== $gitCommitID) {
|
if (false !== $gitCommitID) {
|
||||||
$matches = array();
|
$matches = array();
|
||||||
if (@preg_match('/(?<!.)(?P<gitCommitID>[0-9a-f]+)$/ms', $gitCommitID, $matches)) {
|
if (@preg_match('/(?<!.)(?P<gitCommitID>[0-9a-f]+)$/ms', $gitCommitID, $matches)) {
|
||||||
$matches['appVersion'] = self::VERSION;
|
return array_merge($version, $matches);
|
||||||
return $matches;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return $version;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user