View | Details | Raw Unified | Return to bug 34088
Collapse All | Expand All

(-)a/Koha/Installer.pm (+40 lines)
Line 0 Link Here
1
package Koha::Installer;
2
3
use Modern::Perl;
4
5
require Koha;
6
require Koha::Database;
7
8
sub import {
9
    my $dbh = Koha::Database::dbh();
10
    my $sql = "SELECT value FROM systempreferences WHERE variable = 'Version'";
11
    my $sth = $dbh->prepare($sql);
12
    $sth->execute();
13
    my $row = $sth->fetchrow_arrayref();
14
    my $db_version = $row->[0];
15
    my $koha_version = Koha->version;
16
    my $code_version = TransformToNum($koha_version);
17
    if ($db_version == $code_version){
18
        exit;
19
    }
20
}
21
22
=head2 TransformToNum
23
24
Transform the Koha version from a 4 parts string
25
to a number, with just 1 .
26
27
=cut
28
29
sub TransformToNum {
30
    my $version = shift;
31
    # remove the 3 last . to have a Perl number
32
    $version =~ s/(.*\..*)\.(.*)\.(.*)/$1$2$3/;
33
    # three X's at the end indicate that you are testing patch with dbrev
34
    # change it into 999
35
    # prevents error on a < comparison between strings (should be: lt)
36
    $version =~ s/XXX$/999/;
37
    return $version;
38
}
39
40
1;
(-)a/installer/data/mysql/updatedatabase.pl (-1 / +2 lines)
Lines 27-32 Link Here
27
27
28
# NOTE: Please keep the version in kohaversion.pl up-to-date!
28
# NOTE: Please keep the version in kohaversion.pl up-to-date!
29
29
30
use Koha::Installer;
31
30
use Modern::Perl;
32
use Modern::Perl;
31
33
32
use feature 'say';
34
use feature 'say';
33
- 

Return to bug 34088