Bugzilla – Attachment 91221 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.56 KB, created by
Kyle M Hall (khall)
on 2019-07-03 11:17:25 UTC
(
hide
)
Description:
Bug 23230: Make _version_compare OO context aware
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2019-07-03 11:17:25 UTC
Size:
1.56 KB
patch
obsolete
>From 1c5b253de1508466f83bc86470a713fe9811582c 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> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.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.20.1 (Apple Git-117)
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