Bugzilla – Attachment 154482 Details for
Bug 28267
Older databases fail to upgrade due to having a row format other than "DYNAMIC"
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28267: [22.05] Simplify things
Bug-28267-2205-Simplify-things.patch (text/plain), 7.88 KB, created by
Victor Grousset/tuxayo
on 2023-08-17 04:54:01 UTC
(
hide
)
Description:
Bug 28267: [22.05] Simplify things
Filename:
MIME Type:
Creator:
Victor Grousset/tuxayo
Created:
2023-08-17 04:54:01 UTC
Size:
7.88 KB
patch
obsolete
>From 2030e70667174a9aa6dae93ddd33c2763b790fbe Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 4 May 2023 09:05:17 +0200 >Subject: [PATCH] Bug 28267: [22.05] Simplify things > >We don't need: >* a separate Koha::Installer module when we already have >C4::Installer >* the tests as they are actually modifying the DB structure >without rolling back >* An unecessary complicated subroutine, just make is simple > >WNC amended patch: Remove change to Koha.pm > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >(cherry picked from commit f394bf61cf7e60058afd9856f7ae8dda8afb385b) >Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> >--- > C4/Installer.pm | 26 +++++++++++++- > Koha/Installer.pm | 60 --------------------------------- > about.pl | 7 ++-- > installer/install.pl | 4 +-- > t/db_dependent/Koha/Installer.t | 48 -------------------------- > 5 files changed, 28 insertions(+), 117 deletions(-) > delete mode 100644 Koha/Installer.pm > delete mode 100755 t/db_dependent/Koha/Installer.t > >diff --git a/C4/Installer.pm b/C4/Installer.pm >index e133a19c10..eadf2ddea8 100644 >--- a/C4/Installer.pm >+++ b/C4/Installer.pm >@@ -34,7 +34,7 @@ use vars qw(@ISA @EXPORT); > BEGIN { > require Exporter; > @ISA = qw( Exporter ); >- push @EXPORT, qw( primary_key_exists unique_key_exists foreign_key_exists index_exists column_exists TableExists marc_framework_sql_list TransformToNum CheckVersion NewVersion SetVersion sanitize_zero_date update get_db_entries get_atomic_updates run_atomic_updates ); >+ push @EXPORT, qw( primary_key_exists unique_key_exists foreign_key_exists index_exists column_exists TableExists marc_framework_sql_list TransformToNum CheckVersion NewVersion SetVersion sanitize_zero_date update get_db_entries get_atomic_updates run_atomic_updates has_non_dynamic_row_format ); > }; > > =head1 NAME >@@ -1039,6 +1039,30 @@ sub sanitize_zero_date { > } > } > >+=head3 has_non_dynamic_row_format >+ >+Return the number of tables with row_format that is not Dynamic >+ >+=cut >+ >+sub has_non_dynamic_row_format { >+ my ($class) = @_; >+ my $database = C4::Context->config('database'); >+ my $count = 0; >+ if ($database){ >+ my $dbh = C4::Context->dbh; >+ my $sql = q# >+ SELECT count(table_name) >+ FROM information_schema.tables >+ WHERE >+ table_schema = ? >+ AND row_format != "Dynamic" >+ #; >+ ( $count ) = $dbh->selectrow_array($sql, undef, $database); >+ } >+ return $count; >+} >+ > =head1 AUTHOR > > C4::Installer is a refactoring of logic originally from installer/installer.pl, which was >diff --git a/Koha/Installer.pm b/Koha/Installer.pm >deleted file mode 100644 >index 4d2f3d12ac..0000000000 >--- a/Koha/Installer.pm >+++ /dev/null >@@ -1,60 +0,0 @@ >-package Koha::Installer; >- >-# This file is part of Koha. >-# >-# Koha is free software; you can redistribute it and/or modify it >-# under the terms of the GNU General Public License as published by >-# the Free Software Foundation; either version 3 of the License, or >-# (at your option) any later version. >-# >-# Koha is distributed in the hope that it will be useful, but >-# WITHOUT ANY WARRANTY; without even the implied warranty of >-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >-# GNU General Public License for more details. >-# >-# You should have received a copy of the GNU General Public License >-# along with Koha; if not, see <http://www.gnu.org/licenses>. >- >-use Modern::Perl; >- >-use C4::Context; >- >-=head1 NAME >- >-Koha::Installer - Class that provides installation related methods >- >-=head1 API >- >-=head2 Class Methods >- >-=cut >- >-=head3 check_db_row_format >- >-=cut >- >-sub check_db_row_format { >- my ($class) = @_; >- my %result = (); >- my $database = C4::Context->config('database'); >- if ($database){ >- my $dbh = C4::Context->dbh; >- my $sql = q# >- SELECT count(table_name) >- FROM information_schema.tables >- WHERE >- table_schema = ? >- AND row_format != "Dynamic" >- #; >- my $sth = $dbh->prepare($sql); >- $sth->execute($database); >- my $row = $sth->fetchrow_arrayref; >- my $count = $row->[0]; >- if ($count){ >- $result{count} = $count; >- } >- } >- return \%result; >-} >- >-1; >diff --git a/about.pl b/about.pl >index 2d3248c573..6772293967 100755 >--- a/about.pl >+++ b/about.pl >@@ -36,6 +36,7 @@ use Encode; > use C4::Output qw( output_html_with_http_headers ); > use C4::Auth qw( get_template_and_user get_user_subpermissions ); > use C4::Context; >+use C4::Installer; > use C4::Installer::PerlModules; > > use Koha; >@@ -54,7 +55,6 @@ use Koha::Illrequest::Config; > use Koha::SearchEngine::Elasticsearch; > use Koha::Logger; > use Koha::Filter::MARC::ViewPolicy; >-use Koha::Installer; > > use C4::Members::Statistics; > >@@ -624,10 +624,7 @@ $template->param( 'bad_yaml_prefs' => \@bad_yaml_prefs ) if @bad_yaml_prefs; > > #BZ 28267: Warn administrators if there are database rows with a format other than 'DYNAMIC' > { >- my $db_row_format_result = Koha::Installer->check_db_row_format(); >- if ( my $count = $db_row_format_result->{count} ){ >- $template->param( warnDbRowFormat => $count ); >- } >+ $template->param( warnDbRowFormat => C4::Installer->has_non_dynamic_row_format ); > } > > my %versions = C4::Context::get_versions(); >diff --git a/installer/install.pl b/installer/install.pl >index d7be88cdbb..87d2a9291b 100755 >--- a/installer/install.pl >+++ b/installer/install.pl >@@ -32,7 +32,6 @@ use C4::Installer; > use C4::Installer::PerlModules; > > use Koha; >-use Koha::Installer; > > my $query = CGI->new; > my $step = $query->param('step'); >@@ -187,8 +186,7 @@ elsif ( $step && $step == 2 ) { > } > $template->param( "checkgrantaccess" => $grantaccess ); > >- my $db_row_format_result = Koha::Installer->check_db_row_format(); >- if ( my $count = $db_row_format_result->{count} ){ >+ if ( my $count = $installer->has_non_dynamic_row_format ) { > $template->param( warnDbRowFormat => $count ); > $template->param( error => "InnoDB row format" ); > } >diff --git a/t/db_dependent/Koha/Installer.t b/t/db_dependent/Koha/Installer.t >deleted file mode 100755 >index f6b6878e61..0000000000 >--- a/t/db_dependent/Koha/Installer.t >+++ /dev/null >@@ -1,48 +0,0 @@ >-#!/usr/bin/perl >- >-# This file is part of Koha >-# >-# Koha is free software; you can redistribute it and/or modify it >-# under the terms of the GNU General Public License as published by >-# the Free Software Foundation; either version 3 of the License, or >-# (at your option) any later version. >-# >-# Koha is distributed in the hope that it will be useful, but >-# WITHOUT ANY WARRANTY; without even the implied warranty of >-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >-# GNU General Public License for more details. >-# >-# You should have received a copy of the GNU General Public License >-# along with Koha; if not, see <http://www.gnu.org/licenses>. >- >-use Modern::Perl; >- >-use Test::More tests => 1; >- >-use C4::Context; >-use Koha::Database; >-use Koha::Installer; >- >-use t::lib::TestBuilder; >- >-my $schema = Koha::Database->new->schema; >- >-subtest 'check_db_row_format() tests' => sub { >- >- plan tests => 2; >- >- $schema->storage->txn_begin; >- >- my $dbh = C4::Context->dbh; >- $dbh->do("ALTER TABLE tags row_format=COMPACT;"); >- >- my $pos_result = Koha::Installer->check_db_row_format; >- is($pos_result->{count},1,"Detected problem table"); >- >- $dbh->do("ALTER TABLE tags row_format=DYNAMIC;"); >- >- my $neg_result = Koha::Installer->check_db_row_format; >- is($neg_result->{count},undef,"Detected no problem tables"); >- >- $schema->storage->txn_rollback; >-}; >-- >2.41.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 28267
:
121103
|
145380
|
145386
|
145390
|
145507
|
150627
|
150628
|
150645
|
150646
|
154481
| 154482