From 970190150a40d4bd574a1a84ac640ec44318869e Mon Sep 17 00:00:00 2001 From: Dylan William Hardison Date: Wed, 31 May 2017 17:48:17 -0400 Subject: Bug 1365734 - Handle BMO version number in Makefile.PL / MYMETA.json --- Bugzilla/Config/Core.pm | 6 ------ Bugzilla/Constants.pm | 2 +- Bugzilla/Template.pm | 15 +++++++++++++++ 3 files changed, 16 insertions(+), 7 deletions(-) (limited to 'Bugzilla') diff --git a/Bugzilla/Config/Core.pm b/Bugzilla/Config/Core.pm index 0e95741a9..654e569ba 100644 --- a/Bugzilla/Config/Core.pm +++ b/Bugzilla/Config/Core.pm @@ -23,12 +23,6 @@ use constant get_param_list => ( checker => \&check_urlbase }, - { - name => 'bugzilla_version', - type => 't', - default => '', - }, - { name => 'ssl_redirect', type => 'b', diff --git a/Bugzilla/Constants.pm b/Bugzilla/Constants.pm index 852c9c362..7d5f6fa2e 100644 --- a/Bugzilla/Constants.pm +++ b/Bugzilla/Constants.pm @@ -208,7 +208,7 @@ use Memoize; sub BUGZILLA_VERSION { my $bugzilla_version = '4.2'; eval { require Bugzilla } || return $bugzilla_version; - return Bugzilla->params->{bugzilla_version} || $bugzilla_version; + eval { Bugzilla->VERSION } || $bugzilla_version; } # A base link to the current REST Documentation. We place it here diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm index 75711e1ef..5bef599d4 100644 --- a/Bugzilla/Template.pm +++ b/Bugzilla/Template.pm @@ -983,6 +983,21 @@ sub create { # Function for retrieving global parameters. 'Param' => sub { return Bugzilla->params->{$_[0]}; }, + 'bugzilla_version' => sub { + my $version = Bugzilla->VERSION; + if (my @ver = $version =~ /^(\d{4})(\d{2})(\d{2})\.(\d+)$/s) { + if ($ver[3] eq '1') { + return join('.', @ver[0,1,2]); + } + else { + return join('.', @ver); + } + } + else { + return $version; + } + }, + json_encode => sub { return encode_json($_[0]); }, -- cgit v1.2.3-24-g4f1b