about: Fix documentation link and use a version dependent one

This commit is contained in:
Johannes Meyer 2022-02-25 12:26:29 +01:00
parent c7510db632
commit 3c48d693ff
2 changed files with 5 additions and 1 deletions

View File

@ -80,7 +80,8 @@ use ipl\Web\Widget\Icon;
<div class="col"> <div class="col">
<?= <?=
HtmlElement::create('a', [ HtmlElement::create('a', [
'href' => 'https://github.com/icinga/icingaweb2/issues', 'href' => 'https://icinga.com/docs/icinga-web-2/'
. (isset($version['docVersion']) ? $version['docVersion'] : 'latest'),
'target' => '_blank', 'target' => '_blank',
'title' => $this->translate('Icinga Documentation') 'title' => $this->translate('Icinga Documentation')
], [ ], [

View File

@ -18,6 +18,9 @@ class Version
public static function get() public static function get()
{ {
$version = array('appVersion' => self::VERSION); $version = array('appVersion' => self::VERSION);
preg_match('/2.(\d+)\./', self::VERSION, $matches);
$version['docVersion'] = isset($matches[1]) ? '2.' . $matches[1] : null;
if (false !== ($appVersion = @file_get_contents(Icinga::app()->getApplicationDir('VERSION')))) { if (false !== ($appVersion = @file_get_contents(Icinga::app()->getApplicationDir('VERSION')))) {
$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)) {