Bugzilla – Attachment 91203 Details for
Bug 23230
Make Koha::Plugins::Base::_version_compare OO
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23230: Make _version_compare OO context aware
Bug-23230-Make-versioncompare-OO-context-aware.patch (text/plain), 1.49 KB, created by
Mark Tompsett
on 2019-07-03 02:36:50 UTC
(
hide
)
Description:
Bug 23230: Make _version_compare OO context aware
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2019-07-03 02:36:50 UTC
Size:
1.49 KB
patch
obsolete
>From b619dac9cd9bbdd4c9b2112f9d13f637a84f2780 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 1 Jul 2019 11:42:51 -0300 >Subject: [PATCH] Bug 23230: Make _version_compare OO context aware > >On using _version_compare in plugins development, it would be nice if it >was able to be called as an object method. This way we don't need to >fully qualify it like this: > > Koha::Plugins::Base::_version_compare > >and we can do > > $self->_version_compare > >instead. > >This patch implements this behavior change. It is backwards compatible >so plugins using the 'old way' don't break. > >To test: >- Apply the unit tests patch >- Run: > $ kshell > k$ prove t/db_dependent/Plugins.t >=> FAIL: Tests fail >- Apply this patch >- Run: > k$ prove t/db_dependent/Plugins.t >=> SUCCESS: Tests pass! >- Sign off :-D > >Signed-off-by: Mark Tompsett <mtompset@hotmail.com> >--- > Koha/Plugins/Base.pm | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > >diff --git a/Koha/Plugins/Base.pm b/Koha/Plugins/Base.pm >index 04fd4858f7..059c6730f3 100644 >--- a/Koha/Plugins/Base.pm >+++ b/Koha/Plugins/Base.pm >@@ -265,8 +265,14 @@ if ( _version_compare( '2.6.26', '2.6.0' ) == 1 ) { > =cut > > sub _version_compare { >- my $ver1 = shift || 0; >- my $ver2 = shift || 0; >+ my @args = @_; >+ >+ if ( $args[0]->isa('Koha::Plugins::Base') ) { >+ shift @args; >+ } >+ >+ my $ver1 = shift @args || 0; >+ my $ver2 = shift @args || 0; > > my @v1 = split /[.+:~-]/, $ver1; > my @v2 = split /[.+:~-]/, $ver2; >-- >2.11.0
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 23230
:
91152
|
91153
|
91201
|
91202
|
91203
|
91204
|
91220
|
91221
|
91222