@@ -, +, @@ If you have temporary uploads, check the reported count. --- installer/data/mysql/atomicupdate/bug17669.perl | 14 ++++++++++++++ installer/data/mysql/sysprefs.sql | 1 + .../prog/en/modules/admin/preferences/tools.pref | 6 ++++++ 3 files changed, 21 insertions(+) create mode 100644 installer/data/mysql/atomicupdate/bug17669.perl --- a/installer/data/mysql/atomicupdate/bug17669.perl +++ a/installer/data/mysql/atomicupdate/bug17669.perl @@ -0,0 +1,14 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + $dbh->do(q| +INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES ('Upload_PurgeTemporaryFiles_Days','',NULL,'If not empty, number of days used when automatically deleting temporary uploads','integer'); + |); + + my ( $cnt ) = $dbh->selectrow_array( "SELECT COUNT(*) FROM uploaded_files WHERE permanent IS NULL or permanent=0" ); + if( $cnt ) { + print "NOTE: You have $cnt temporary uploads. You could benefit from setting pref Upload_PurgeTemporaryFiles_Days now to automatically delete them.\n"; + } + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 17669 - Introduce preference for deleting temporary uploads)\n"; +} --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -535,6 +535,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('UniqueItemFields','barcode','','Space-separated list of fields that should be unique (used in acquisition module for item creation). Fields must be valid SQL column names of items table','Free'), ('UpdateNotForLoanStatusOnCheckin', '', 'NULL', 'This is a list of value pairs. When an item is checked in, if the not for loan value on the left matches the items not for loan value it will be updated to the right-hand value. E.g. ''-1: 0'' will cause an item that was set to ''Ordered'' to now be available for loan. Each pair of values should be on a separate line.', 'Free'), ('UpdateTotalIssuesOnCirc','0',NULL,'Whether to update the totalissues field in the biblio on each circ.','YesNo'), +('Upload_PurgeTemporaryFiles_Days','',NULL,'If not empty, number of days used when automatically deleting temporary uploads','integer'), ('uppercasesurnames','0',NULL,'If ON, surnames are converted to upper case in patron entry form','YesNo'), ('URLLinkText','',NULL,'Text to display as the link anchor in the OPAC','free'), ('UsageStats', 0, NULL, 'Share anonymous usage data on the Hea Koha community website.', 'YesNo'), --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/tools.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/tools.pref @@ -26,3 +26,9 @@ Tools: staff: "Staff client only" both: "Both OPAC and staff client" - + Upload: + - + - Automatically delete temporary uploads older than + - pref: Upload_PurgeTemporaryFiles_Days + class: integer + - "days in cleanup_database cron job. NOTE: If you leave this field empty (zero), the cron job will not delete any files." --