Bugzilla – Attachment 36963 Details for
Bug 13758
KOHAVERSION should be statically set
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13758: Koha::Version introduced (counterpatch)
Bug-13758-KohaVersion-introduced-counterpatch.patch (text/plain), 4.65 KB, created by
Tomás Cohen Arazi (tcohen)
on 2015-03-17 18:17:19 UTC
(
hide
)
Description:
Bug 13758: Koha::Version introduced (counterpatch)
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2015-03-17 18:17:19 UTC
Size:
4.65 KB
patch
obsolete
>From 910e88e7425074c9b3f326725d2d88ee2b5e97e3 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@gmail.com> >Date: Tue, 17 Mar 2015 12:09:12 -0300 >Subject: [PATCH] Bug 13758: Koha::Version introduced (counterpatch) > >This patch introduces a trivial package: Koha::Version. It only contains >a constant: VERSION. It is set the current version number. > >The idea is that we stop relying on calling the kohaversion.pl script to get >the current version number. The workflow for RM/RMaints versioning their updates >should be slightly changed, but overall is the same effort. > >To test: >1 - Run > $ perl Makefile.PL > (it doesn't matter which version, just continue till the end) >=> SUCCESS: The printed version, is the correct one (3.19.00.016). > >2 - Tweak the Koha/Version.pm file, shifting the version number > - Launch the opac interface >=> SUCCESS: The OPAC shows the maintenance page > - Launch the intranet: >=> SUCCESS: You are offered the update > >Those are the most important use cases, because the rest just uses C4::Context->KOHAVERSION() >to access the version number, which is proven to work by the use cases. > >Sponsored-by: Universidad Nacional de Cordoba >--- > C4/Context.pm | 16 +++++----------- > Koha/Version.pm | 47 +++++++++++++++++++++++++++++++++++++++++++++++ > Makefile.PL | 4 ++-- > kohaversion.pl | 11 +++++------ > 4 files changed, 59 insertions(+), 19 deletions(-) > create mode 100644 Koha/Version.pm > >diff --git a/C4/Context.pm b/C4/Context.pm >index cc93af4..8d3d9a2 100644 >--- a/C4/Context.pm >+++ b/C4/Context.pm >@@ -16,8 +16,8 @@ package C4::Context; > # with Koha; if not, write to the Free Software Foundation, Inc., > # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. > >-use strict; >-use warnings; >+use Modern::Perl; >+ > use vars qw($VERSION $AUTOLOAD $context @context_stack $servers $memcached $ismemcached); > BEGIN { > if ($ENV{'HTTP_USER_AGENT'}) { >@@ -107,6 +107,7 @@ use POSIX (); > use DateTime::TimeZone; > use Module::Load::Conditional qw(can_load); > use Carp; >+use Koha::Version; > > =head1 NAME > >@@ -211,16 +212,9 @@ returns the kohaversion stored in kohaversion.pl file > =cut > > sub KOHAVERSION { >- my $cgidir = C4::Context->intranetdir; > >- # Apparently the GIT code does not run out of a CGI-BIN subdirectory >- # but distribution code does? (Stan, 1jan08) >- if(-d $cgidir . "/cgi-bin"){ >- my $cgidir .= "/cgi-bin"; >- } >- >- do $cgidir."/kohaversion.pl" || die "NO $cgidir/kohaversion.pl"; >- return kohaversion(); >+ return Koha::Version::VERSION; >+ > } > > =head2 final_linear_version >diff --git a/Koha/Version.pm b/Koha/Version.pm >new file mode 100644 >index 0000000..4c6b7c3 >--- /dev/null >+++ b/Koha/Version.pm >@@ -0,0 +1,47 @@ >+package Koha::Version; >+ >+# Copyright 2015 Theke Solutions >+# >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+ >+=head1 NAME >+ >+Koha::Version - A simple package providing the current Koha version >+ >+=head1 SYNOPSIS >+ >+ use Koha::Version; >+ >+ my $version = Koha::Version::VERSION; >+ >+=cut >+ >+use constant VERSION => '3.19.00.016'; >+ >+1; >+ >+=head1 SEE ALSO >+ >+C4::Context >+kohaversion.pl >+ >+=head1 AUTHOR >+ >+Tomas Cohen Arazi <tomascohen@gmail.com> >+ >+=cut >\ No newline at end of file >diff --git a/Makefile.PL b/Makefile.PL >index 3af2486..587ff0a 100644 >--- a/Makefile.PL >+++ b/Makefile.PL >@@ -1133,8 +1133,8 @@ database to be used by Koha); > # add version number > my $version = "no_version_found"; > eval { >- require 'kohaversion.pl'; >- $version = kohaversion(); >+ require Koha::Version; >+ $version = Koha::Version::VERSION; > }; > $config{'KOHA_INSTALLED_VERSION'} = $version; > >diff --git a/kohaversion.pl b/kohaversion.pl >index a2769f5..265cb41 100644 >--- a/kohaversion.pl >+++ b/kohaversion.pl >@@ -14,14 +14,13 @@ the kohaversion is divided in 4 parts : > > =cut > >-use strict; >+use Modern::Perl; >+use Koha::Version; > > sub kohaversion { >- our $VERSION = '3.19.00.016'; >- # version needs to be set this way >- # so that it can be picked up by Makefile.PL >- # during install >- return $VERSION; >+ >+ return Koha::Version::VERSION; >+ > } > > 1; >-- >2.3.3
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 13758
:
36951
|
36962
|
36963
|
36988
|
38661
|
38662
|
38663
|
38738
|
38739
|
38952
|
38958
|
38971