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.pm | 2 ++ Bugzilla/Config/Core.pm | 6 ------ Bugzilla/Constants.pm | 2 +- Bugzilla/Template.pm | 15 +++++++++++++++ Makefile.PL | 5 ++--- index.cgi | 2 +- template/en/default/admin/params/core.html.tmpl | 3 --- template/en/default/index.html.tmpl | 2 +- 8 files changed, 22 insertions(+), 15 deletions(-) diff --git a/Bugzilla.pm b/Bugzilla.pm index ba662feb5..b4b7a48c8 100644 --- a/Bugzilla.pm +++ b/Bugzilla.pm @@ -20,6 +20,8 @@ BEGIN { } } +our $VERSION = '20170531.2'; + use Bugzilla::Auth; use Bugzilla::Auth::Persist::Cookie; use Bugzilla::CGI; 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]); }, diff --git a/Makefile.PL b/Makefile.PL index d3ee9ae89..3bc7eac4d 100755 --- a/Makefile.PL +++ b/Makefile.PL @@ -24,8 +24,7 @@ BEGIN { lib->import($dir, File::Spec->catdir($dir, "lib"), File::Spec->catdir($dir, qw(local lib perl5))); } -use ExtUtils::MakeMaker 6.55; -use constant BUGZILLA_VERSION => $ENV{BUGZILLA_VERSION} // 42; +use ExtUtils::MakeMaker 7.24; use File::Basename; use File::Spec; @@ -382,7 +381,7 @@ $optional_features{bmo} = { WriteMakefile( NAME => 'Bugzilla', AUTHOR => q{Bugzilla Developers }, - VERSION => BUGZILLA_VERSION, + VERSION_FROM => 'Bugzilla.pm', ABSTRACT => 'Bugzilla Bug Tracking System', LICENSE => 'Mozilla_2_0', MIN_PERL_VERSION => '5.10.1', diff --git a/index.cgi b/index.cgi index 7ebc3130f..d73ccd5d9 100755 --- a/index.cgi +++ b/index.cgi @@ -45,7 +45,7 @@ if ($cgi->param('logout')) { # our weak etag is based on the bugzilla version parameter (BMO customization) and the announcehtml # if either change, the cache will be considered invalid. my @etag_parts = ( - Bugzilla->params->{bugzilla_version}, + Bugzilla->VERSION, Bugzilla->params->{announcehtml}, Bugzilla->params->{createemailregexp}, ); diff --git a/template/en/default/admin/params/core.html.tmpl b/template/en/default/admin/params/core.html.tmpl index 0f7a95139..b1578f422 100644 --- a/template/en/default/admin/params/core.html.tmpl +++ b/template/en/default/admin/params/core.html.tmpl @@ -28,9 +28,6 @@ urlbase => "The URL that is the common initial leading part of all $terms.Bugzilla " _ "URLs.", - bugzilla_version => "The visible version number of Bugzilla. This should be set to " _ - "the date when BMO was last updated, in the format yyyy.mm.dd", - sslbase => "The URL that is the common initial leading part of all HTTPS " _ "(SSL) $terms.Bugzilla URLs.", diff --git a/template/en/default/index.html.tmpl b/template/en/default/index.html.tmpl index c79be57ca..70c3d7f3e 100644 --- a/template/en/default/index.html.tmpl +++ b/template/en/default/index.html.tmpl @@ -28,7 +28,7 @@ [% PROCESS global/header.html.tmpl title = "$terms.Bugzilla Main Page" header = "Main Page" - header_addl_info = "version " _ (Bugzilla.params.bugzilla_version || constants.BUGZILLA_VERSION) + header_addl_info = "version " _ bugzilla_version style_urls = [ 'skins/standard/index.css' ] no_yui = 1 %] -- cgit v1.2.3-24-g4f1b