From 587c58ba7d0b09630689d22e763f2028941ecc90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaakko=20Kera=CC=88nen?= Date: Mon, 23 May 2016 15:33:14 +0300 Subject: [PATCH] Homepage: Modified version number output Always include major and minor numbers, always omit zeroes in the rest. --- web/classes/version.class.php | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/web/classes/version.class.php b/web/classes/version.class.php index 3bbabcac79..7e76a4af7e 100644 --- a/web/classes/version.class.php +++ b/web/classes/version.class.php @@ -106,13 +106,14 @@ public static function ucompare($a, $b) public function asText($sep = '.', $omitTrailingZeros = false) { $sep = (string)$sep; - $omitTrailingZeros = (bool)$omitTrailingZeros; + /*$omitTrailingZeros = (bool)$omitTrailingZeros; if($omitTrailingZeros === false) { return "{$this->major}$sep{$this->minor}$sep{$this->patch}$sep{$this->revision}"; - } + }*/ + /* $text = ''; if($this->revision > 0) { @@ -132,8 +133,20 @@ public function asText($sep = '.', $omitTrailingZeros = false) } if(!empty($text)) $text = $sep . $text; - $text = $this->major . $text; + $text = $this->major . $text;*/ + // Mandatory parts. + $text = "{$this->major}" . $sep . "{$this->minor}"; + + // Optional parts. + if($this->patch > 0 || $this->revision > 0) + { + $text .= $sep . "{$this->patch}"; + } + if($this->revision > 0) + { + $text .= $sep . "{$this->revision}"; + } return $text; }