From ba626aaa94e19c50aa03ab46bab07752dda841cb Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Mon, 1 Feb 2016 17:30:52 +0100 Subject: [PATCH] Bug 14893: Update DB rev (3.22.02.001) Signed-off-by: Julian Maurice --- Koha.pm | 2 +- .../data/mysql/atomicupdate/14893_cleanup.perl | 16 ---------------- installer/data/mysql/updatedatabase.pl | 17 +++++++++++++++++ 3 files changed, 18 insertions(+), 17 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/14893_cleanup.perl diff --git a/Koha.pm b/Koha.pm index 4d81737d70..0fe4771c9e 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.02.000"; +$VERSION = "3.22.02.001"; sub version { return $VERSION; diff --git a/installer/data/mysql/atomicupdate/14893_cleanup.perl b/installer/data/mysql/atomicupdate/14893_cleanup.perl deleted file mode 100644 index e0426df850..0000000000 --- a/installer/data/mysql/atomicupdate/14893_cleanup.perl +++ /dev/null @@ -1,16 +0,0 @@ -# This perl snippet is run from within updatedatabase.pl -# Remove all temporary files from the obsolete koha_upload -# Bug 14893 replaces /tmp/koha_upload by /tmp/[db_name]_upload -# Permanent storage is not affected - -use File::Path qw[remove_tree]; # perl core module -use File::Spec; - -my $dbh= C4::Context->dbh; -$dbh->do(q| - DELETE FROM uploaded_files - WHERE COALESCE(permanent,0)=0 AND dir='koha_upload' -|); - -my $tmp= File::Spec->tmpdir.'/koha_upload'; -remove_tree( $tmp ) if -d $tmp; diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 04c1eb8da8..2224fac9cc 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -43,6 +43,9 @@ use Koha::DateUtils; use MARC::Record; use MARC::File::XML ( BinaryEncoding => 'utf8' ); +use File::Path qw(remove_tree); +use File::Spec; + # FIXME - The user might be installing a new database, so can't rely # on /etc/koha.conf anyway. @@ -11409,6 +11412,20 @@ if ( CheckVersion($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.22.02.001"; +if ( CheckVersion($DBversion) ) { + $dbh->do(q{ + DELETE FROM uploaded_files + WHERE COALESCE(permanent,0)=0 AND dir='koha_upload' + }); + + my $tmp = File::Spec->tmpdir . '/koha_upload'; + remove_tree( $tmp ) if -d $tmp; + + print "Upgrade to $DBversion done (Bug 14893 - Separate temporary storage per instance in Upload.pm)\n"; + SetVersion($DBversion); +} + # DEVELOPER PROCESS, search for anything to execute in the db_update directory # SEE bug 13068 # if there is anything in the atomicupdate, read and execute it. -- 2.39.5