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>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 90acef7a9b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
5232a62639
commit
6c208a0961
|
|
@ -249,8 +249,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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue