diff --git a/installer/data/mysql/atomicupdate/bug17669.perl b/installer/data/mysql/atomicupdate/bug17669.perl new file mode 100644 index 0000000000..ef2e58f4b4 --- /dev/null +++ b/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"; +} diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 64aa4930f0..a3f240ee39 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -540,6 +540,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'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/tools.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/tools.pref index a2a381d3f9..a64a25c42f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/tools.pref +++ b/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."