Bugzilla – Attachment 58811 Details for
Bug 17669
Add purging temporary uploads to cleanup_database
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17669: Incorporate the changes in cleanup_database
Bug-17669-Incorporate-the-changes-in-cleanupdataba.patch (text/plain), 3.92 KB, created by
Marcel de Rooy
on 2017-01-11 13:26:45 UTC
(
hide
)
Description:
Bug 17669: Incorporate the changes in cleanup_database
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2017-01-11 13:26:45 UTC
Size:
3.92 KB
patch
obsolete
>From 159f3d6ae433ec2f1e5ef4ec93520d13d396969d Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Tue, 13 Dec 2016 16:44:26 +0100 >Subject: [PATCH] Bug 17669: Incorporate the changes in cleanup_database >Content-Type: text/plain; charset=utf-8 > >Two command line options are added: >[1] -temp-uploads to indicate that you want to purge these uploads, >[2] -temp-uploads-override DAYS to (optionally) tell that you want to > override the corresponding pref value. > >Test plan: >[1] Check the modified usage statement. >[2] If needed, backup your temporary uploads :) > In case you do not have one, add a temporary one with Tools/Upload. > Note: Do not choose an upload category. >[3] Set pref to 0, and run cleanup_database with only --temp-uploads. > No files should be deleted. >[4] Check number of "old" temp uploads. Set pref to nonzero value. > Verify that the oldest are gone (depending on the value chosen). >[5] Set pref to 0 again. > If all uploads are gone now, add a new one with Tools/Upload. > Run cleanup_database with --temp-uploads --temp-uploads-override -1 > All temporary files are gone. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > misc/cronjobs/cleanup_database.pl | 20 +++++++++++++++++++- > 1 file changed, 19 insertions(+), 1 deletion(-) > >diff --git a/misc/cronjobs/cleanup_database.pl b/misc/cronjobs/cleanup_database.pl >index 52028f2..f67a934 100755 >--- a/misc/cronjobs/cleanup_database.pl >+++ b/misc/cronjobs/cleanup_database.pl >@@ -40,10 +40,11 @@ use C4::Search::History; > use Getopt::Long; > use C4::Log; > use C4::Accounts; >+use Koha::UploadedFiles; > > sub usage { > print STDERR <<USAGE; >-Usage: $0 [-h|--help] [--sessions] [--sessdays DAYS] [-v|--verbose] [--zebraqueue DAYS] [-m|--mail] [--merged] [--import DAYS] [--logs DAYS] [--searchhistory DAYS] [--restrictions DAYS] [--all-restrictions] [--fees DAYS] >+Usage: $0 [-h|--help] [--sessions] [--sessdays DAYS] [-v|--verbose] [--zebraqueue DAYS] [-m|--mail] [--merged] [--import DAYS] [--logs DAYS] [--searchhistory DAYS] [--restrictions DAYS] [--all-restrictions] [--fees DAYS] [--temp-uploads] [--temp-uploads-override DAYS] > > -h --help prints this help message, and exits, ignoring all > other options >@@ -80,6 +81,8 @@ Usage: $0 [-h|--help] [--sessions] [--sessdays DAYS] [-v|--verbose] [--zebraqueu > --del-exp-selfreg Delete expired self registration accounts > --del-unv-selfreg DAYS Delete unverified self registrations older than DAYS > --unique-holidays DAYS Delete all unique holidays older than DAYS >+ --temp-uploads Delete temporary uploads. >+ --temp-uploads-override DAYS Override the corresponding preference value. > USAGE > exit $_[0]; > } >@@ -102,6 +105,8 @@ my $pExpSelfReg; > my $pUnvSelfReg; > my $fees_days; > my $special_holidays_days; >+my $temp_uploads; >+my $override_temp_uploads; > > GetOptions( > 'h|help' => \$help, >@@ -122,6 +127,8 @@ GetOptions( > 'del-exp-selfreg' => \$pExpSelfReg, > 'del-unv-selfreg' => \$pUnvSelfReg, > 'unique-holidays:i' => \$special_holidays_days, >+ 'temp-uploads' => \$temp_uploads, >+ 'temp-uploads-override:i' => \$override_temp_uploads, > ) || usage(1); > > # Use default values >@@ -153,6 +160,7 @@ unless ( $sessions > || $pExpSelfReg > || $pUnvSelfReg > || $special_holidays_days >+ || $temp_uploads > ) { > print "You did not specify any cleanup work for the script to do.\n\n"; > usage(1); >@@ -302,6 +310,16 @@ if ($special_holidays_days) { > DeleteSpecialHolidays( abs($special_holidays_days) ); > } > >+if( $temp_uploads ) { >+ # Delete temporary uploads, governed by a pref. >+ # If the pref is empty, nothing happens (unless you override). >+ print "Purging temporary uploads.\n" if $verbose; >+ Koha::UploadedFiles->delete_temporary({ >+ override_pref => $override_temp_uploads, >+ }); >+ print "Done purging temporary uploads.\n" if $verbose; >+} >+ > exit(0); > > sub RemoveOldSessions { >-- >2.1.4
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 17669
:
58176
|
58177
|
58178
|
58179
|
58810
|
58811
|
58812
|
61239
|
61240
|
61241
|
61242
|
61243
|
61465
|
61466
|
61467
|
61468
|
61469
|
61727
|
61729
|
61730
|
61742
|
61743
|
61805
|
61809
|
61818
|
61819
|
62486
|
62487
|
62488
|
62489
|
62490
|
62491
|
62492
|
62493
|
62494
|
62495