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

(-)a/Koha/Installer.pm (+60 lines)
Line 0 Link Here
1
package Koha::Installer;
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18
use Modern::Perl;
19
20
use C4::Context;
21
22
=head1 NAME
23
24
Koha::Installer - Class that provides installation related methods
25
26
=head1 API
27
28
=head2 Class Methods
29
30
=cut
31
32
=head3 check_db_row_format
33
34
=cut
35
36
sub check_db_row_format {
37
    my ($class) = @_;
38
    my %result = ();
39
    my $database = C4::Context->config('database');
40
    if ($database){
41
        my $dbh = C4::Context->dbh;
42
        my $sql = q#
43
            SELECT count(table_name)
44
            FROM information_schema.tables
45
            WHERE
46
                table_schema = ?
47
                AND row_format != "Dynamic"
48
        #;
49
        my $sth = $dbh->prepare($sql);
50
        $sth->execute($database);
51
        my $row = $sth->fetchrow_arrayref;
52
        my $count = $row->[0];
53
        if ($count){
54
            $result{count} = $count;
55
        }
56
    }
57
    return \%result;
58
}
59
60
1;
(-)a/about.pl (+9 lines)
Lines 55-60 use Koha::Illrequest::Config; Link Here
55
use Koha::SearchEngine::Elasticsearch;
55
use Koha::SearchEngine::Elasticsearch;
56
use Koha::Logger;
56
use Koha::Logger;
57
use Koha::Filter::MARC::ViewPolicy;
57
use Koha::Filter::MARC::ViewPolicy;
58
use Koha::Installer;
58
59
59
use C4::Members::Statistics;
60
use C4::Members::Statistics;
60
61
Lines 629-634 $template->param( 'bad_yaml_prefs' => \@bad_yaml_prefs ) if @bad_yaml_prefs; Link Here
629
    }
630
    }
630
}
631
}
631
632
633
#BZ 28267: Warn administrators if there are database rows with a format other than 'DYNAMIC'
634
{
635
    my $db_row_format_result = Koha::Installer->check_db_row_format();
636
    if ( my $count = $db_row_format_result->{count} ){
637
        $template->param( warnDbRowFormat => $count );
638
    }
639
}
640
632
my %versions = C4::Context::get_versions();
641
my %versions = C4::Context::get_versions();
633
642
634
$template->param(
643
$template->param(
(-)a/installer/install.pl (+8 lines)
Lines 32-37 use C4::Installer; Link Here
32
use C4::Installer::PerlModules;
32
use C4::Installer::PerlModules;
33
33
34
use Koha;
34
use Koha;
35
use Koha::Installer;
35
36
36
my $query = CGI->new;
37
my $query = CGI->new;
37
my $step  = $query->param('step');
38
my $step  = $query->param('step');
Lines 185-190 elsif ( $step && $step == 2 ) { Link Here
185
                    }
186
                    }
186
                }
187
                }
187
                $template->param( "checkgrantaccess" => $grantaccess );
188
                $template->param( "checkgrantaccess" => $grantaccess );
189
190
                my $db_row_format_result = Koha::Installer->check_db_row_format();
191
                if ( my $count = $db_row_format_result->{count} ){
192
                    $template->param( warnDbRowFormat => $count );
193
                    $template->param( error => "InnoDB row format" );
194
                }
195
188
            }    # End mysql connect check...
196
            }    # End mysql connect check...
189
197
190
            elsif ( $info{dbms} eq "Pg" ) {
198
            elsif ( $info{dbms} eq "Pg" ) {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt (-1 / +10 lines)
Lines 267-273 Link Here
267
                        [% SET warnMissingCompiledFiles = 1 %]
267
                        [% SET warnMissingCompiledFiles = 1 %]
268
                    [% END %]
268
                    [% END %]
269
                    [% WRAPPER tab_panel tabname= "sysinfo" %]
269
                    [% WRAPPER tab_panel tabname= "sysinfo" %]
270
                        [% IF weasyprint_missing || warnPrefRequireChoosingExistingAuthority || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatronOPACPrivacy || warnPrefAnonymousPatronAnonSuggestions || warnPrefAnonymousPatronOPACPrivacy_PatronDoesNotExist || warnPrefAnonymousPatronAnonSuggestions_PatronDoesNotExist || warnPrefKohaAdminEmailAddress || warnPrefOpacHiddenItems || invalid_yesno.count || warnNoActiveCurrency || warnIsRootUser || xml_config_warnings.size || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm || warnStatisticsFieldsError || warnNoTemplateCaching || warnILLConfiguration || has_ai_issues || oauth2_missing_deps || bad_yaml_prefs || warnRelationships || log4perl_errors || config_bcrypt_settings_no_set || warnHiddenBiblionumbers.size || warnConnectBroker || elasticsearch_has_missing || warnMissingCompiledFiles%]
270
                        [% IF weasyprint_missing || warnPrefRequireChoosingExistingAuthority || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatronOPACPrivacy || warnPrefAnonymousPatronAnonSuggestions || warnPrefAnonymousPatronOPACPrivacy_PatronDoesNotExist || warnPrefAnonymousPatronAnonSuggestions_PatronDoesNotExist || warnPrefKohaAdminEmailAddress || warnPrefOpacHiddenItems || invalid_yesno.count || warnNoActiveCurrency || warnIsRootUser || xml_config_warnings.size || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm || warnStatisticsFieldsError || warnNoTemplateCaching || warnILLConfiguration || has_ai_issues || oauth2_missing_deps || bad_yaml_prefs || warnRelationships || log4perl_errors || config_bcrypt_settings_no_set || warnHiddenBiblionumbers.size || warnConnectBroker || elasticsearch_has_missing || warnMissingCompiledFiles || warnDbRowFormat %]
271
                            [% IF ( warnDbRowFormat ) %]
272
                                <h2>Database row format incorrect</h2>
273
                                <p>Database tables with a row format other than 'DYNAMIC': [% warnDbRowFormat | html %]</p>
274
                                <p>You may experience problems upgrading to newer versions of Koha unless you update the row format for your database tables.</p>
275
                                <p>To know how to avoid this problem see the related wiki page:
276
                                    <a href="https://wiki.koha-community.org/wiki/Database_row_format">Database row format</a>
277
                                </p>
278
                            [% END %]
279
271
                            [% IF (warnIsRootUser) %]
280
                            [% IF (warnIsRootUser) %]
272
                                <h2>Warning regarding current user</h2>
281
                                <h2>Warning regarding current user</h2>
273
                                <p>You are logged in as the database administrative user. This is not recommended because some parts of Koha will not function as expected when using this account.</p>
282
                                <p>You are logged in as the database administrative user. This is not recommended because some parts of Koha will not function as expected when using this account.</p>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step2.tt (+9 lines)
Lines 49-54 Link Here
49
                                    <p>Need help? For help with granting permissions, please search online for "[% dbms | $HtmlTags tag=>'code' %] manual grant permissions"
49
                                    <p>Need help? For help with granting permissions, please search online for "[% dbms | $HtmlTags tag=>'code' %] manual grant permissions"
50
                                    </p>
50
                                    </p>
51
                                [% END %]
51
                                [% END %]
52
                                [% IF ( warnDbRowFormat ) %]
53
                                    <div class="alert alert-danger" role="alert">
54
                                        <p>Database tables with a row format other than 'DYNAMIC': [% warnDbRowFormat | html %]</p>
55
                                        <p>You may experience problems upgrading to newer versions of Koha unless you update the row format for your database tables.</p>
56
                                        <p>To know how to avoid this problem see the related wiki page:
57
                                            <a href="https://wiki.koha-community.org/wiki/Database_row_format">Database row format</a>
58
                                        </p>
59
                                    </div>
60
                                [% END %]
52
                            [% ELSE %]
61
                            [% ELSE %]
53
                                <div class="alert alert-danger" role="alert"><p>No database named [% dbname | $HtmlTags tag=>'code' %] detected.</p></div>
62
                                <div class="alert alert-danger" role="alert"><p>No database named [% dbname | $HtmlTags tag=>'code' %] detected.</p></div>
54
                                <p>Please create the database before continuing.</p>
63
                                <p>Please create the database before continuing.</p>
(-)a/t/db_dependent/Koha/Installer.t (-1 / +48 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
3
# This file is part of Koha
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18
use Modern::Perl;
19
20
use Test::More tests => 1;
21
22
use C4::Context;
23
use Koha::Database;
24
use Koha::Installer;
25
26
use t::lib::TestBuilder;
27
28
my $schema  = Koha::Database->new->schema;
29
30
subtest 'check_db_row_format() tests' => sub {
31
32
    plan tests => 2;
33
34
    $schema->storage->txn_begin;
35
36
    my $dbh = C4::Context->dbh;
37
    $dbh->do("ALTER TABLE tags row_format=COMPACT;");
38
39
    my $pos_result = Koha::Installer->check_db_row_format;
40
    is($pos_result->{count},1,"Detected problem table");
41
42
    $dbh->do("ALTER TABLE tags row_format=DYNAMIC;");
43
44
    my $neg_result = Koha::Installer->check_db_row_format;
45
    is($neg_result->{count},undef,"Detected no problem tables");
46
47
    $schema->storage->txn_rollback;
48
};

Return to bug 28267