From 846409fb9f8952b4b7b5f0ded537f1943b631f34 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 29 Apr 2016 13:51:00 +0000 Subject: [PATCH] Bug 16041: Update DB rev (3.22.06.002) Signed-off-by: Julian Maurice --- Koha.pm | 2 +- .../data/mysql/atomicupdate/bug_16041.perl | 23 ------------- installer/data/mysql/updatedatabase.pl | 33 +++++++++++++++++++ 3 files changed, 34 insertions(+), 24 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug_16041.perl diff --git a/Koha.pm b/Koha.pm index 781d086b89..508891a2a6 100644 --- a/Koha.pm +++ b/Koha.pm @@ -29,7 +29,7 @@ use vars qw{ $VERSION }; # - #4 : the developer version. The 4th number is the database subversion. # used by developers when the database changes. updatedatabase take care of the changes itself # and is automatically called by Auth.pm when needed. -$VERSION = "3.22.06.001"; +$VERSION = "3.22.06.002"; sub version { return $VERSION; diff --git a/installer/data/mysql/atomicupdate/bug_16041.perl b/installer/data/mysql/atomicupdate/bug_16041.perl deleted file mode 100644 index 809325c83a..0000000000 --- a/installer/data/mysql/atomicupdate/bug_16041.perl +++ /dev/null @@ -1,23 +0,0 @@ -my $dbh = C4::Context->dbh; -my ( $count_imageurl ) = $dbh->selectrow_array(q| - SELECT COUNT(*) - FROM authorised_values - WHERE imageurl IS NOT NULL - AND imageurl <> "" -|); -unless ( $count_imageurl ) { - if ( C4::Context->preference('AuthorisedValueImages') - or C4::Context->preference('StaffAuthorisedValueImages') ) { - $dbh->do(q| - UPDATE systempreferences - SET value=0 - WHERE variable="AuthorisedValueImages" - or variable="StaffAuthorisedValueImages" - |); - warn "The system preferences AuthorisedValueImages and StaffAuthorisedValueImages have been turned off\n"; - warn "authorised_values.imageurl is not populated, that means you are not using this feature\n" - } -} else { - warn "At least one authorised value has an icon defined (imageurl)\n"; - warn "The system preference AuthorisedValueImages or StaffAuthorisedValueImages could be turned off if you are not aware of this feature\n"; -} diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index c8eb480da0..a80ee3d34f 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -11550,6 +11550,39 @@ if ( CheckVersion($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.22.06.002"; +if ( CheckVersion($DBversion) ) { + + my ($count_imageurl) = $dbh->selectrow_array(q| + SELECT COUNT(*) + FROM authorised_values + WHERE imageurl IS NOT NULL + AND imageurl <> "" + |); + + unless ($count_imageurl) { + if ( C4::Context->preference('AuthorisedValueImages') + or C4::Context->preference('StaffAuthorisedValueImages') ) + { + $dbh->do(q| + UPDATE systempreferences + SET value = 0 + WHERE variable = "AuthorisedValueImages" + or variable = "StaffAuthorisedValueImages" + |); + warn "The system preferences AuthorisedValueImages and StaffAuthorisedValueImages have been turned off\n"; + warn "authorised_values.imageurl is not populated, that means you are not using this feature\n"; + } + } + else { + warn "At least one authorised value has an icon defined (imageurl)\n"; + warn "The system preference AuthorisedValueImages or StaffAuthorisedValueImages could be turned off if you are not aware of this feature\n"; + } + + print "Upgrade to $DBversion done (Bug 16041 - StaffAuthorisedValueImages & AuthorisedValueImages preferences - impact on search performance)\n"; + SetVersion($DBversion); +} + # DEVELOPER PROCESS, search for anything to execute in the db_update directory # SEE bug 13068 -- 2.39.5