Bug 17669: Introduce new preference for purging temp uploads

The new preference is: Upload_PurgeTemporaryFiles_Days.
It controls if the cron job will delete temporary uploaded files and if so,
how many days should have passed before doing so.

Since the default value is empty, it will not start deleting these uploads
until you change the pref. No behavior change. But the dbrev will print a
message if you already have temporary uploads.

Test plan:
[1] Check Administration, Preferences, Tools for the new pref.
[2] Run the db rev.
    If you have temporary uploads, check the reported count.
[3] Bonus: Run sysprefs.sql in a safe environment.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Mirko Tietgen <mirko@abunchofthings.net>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
Marcel de Rooy 2016-12-13 14:03:27 +01:00 committed by Kyle M Hall
parent 5f3e93c6f5
commit fe9a8bf973
3 changed files with 21 additions and 0 deletions

View File

@ -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";
}

View File

@ -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'),

View File

@ -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."