Bug 17669: [QA Follow-up] Rename preference by removing underscores

Requested by QA on comment25.
Result of:
git grep -l Upload_PurgeTemporaryFiles_Days | xargs sed -i -e "s/Upload_PurgeTemporaryFiles_Days/UploadPurgeTemporaryFilesDays/g"

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

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 2017-03-30 08:42:38 +02:00 committed by Kyle M Hall
parent 8042267a78
commit bab3a204be
5 changed files with 9 additions and 9 deletions

View File

@ -77,7 +77,7 @@ sub delete {
=head3 delete_temporary
Delete_temporary is called by cleanup_database and only removes temporary
uploads older than [pref Upload_PurgeTemporaryFiles_Days] days.
uploads older than [pref UploadPurgeTemporaryFilesDays] days.
It is possible to override the pref with the override_pref parameter.
Returns true if no errors occur. (Even when no files had to be deleted.)
@ -87,7 +87,7 @@ Returns true if no errors occur. (Even when no files had to be deleted.)
sub delete_temporary {
my ( $self, $params ) = @_;
my $days = $params->{override_pref} ||
C4::Context->preference('Upload_PurgeTemporaryFiles_Days');
C4::Context->preference('UploadPurgeTemporaryFilesDays');
return 1 if !$days;
my $dt = dt_from_string();
$dt->subtract( days => $days );

View File

@ -1,12 +1,12 @@
$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');
INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES ('UploadPurgeTemporaryFilesDays','',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";
print "NOTE: You have $cnt temporary uploads. You could benefit from setting pref UploadPurgeTemporaryFilesDays now to automatically delete them.\n";
}
SetVersion( $DBversion );

View File

@ -540,7 +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'),
('UploadPurgeTemporaryFilesDays','',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

@ -29,6 +29,6 @@ Tools:
Upload:
-
- Automatically delete temporary uploads older than
- pref: Upload_PurgeTemporaryFiles_Days
- pref: UploadPurgeTemporaryFilesDays
class: integer
- "days in cleanup_database cron job. NOTE: If you leave this field empty (zero), the cron job will not delete any files."

View File

@ -269,15 +269,15 @@ subtest 'Testing delete_temporary' => sub {
$recs[2]->dtcreated($dt)->store;
# Now call delete_temporary with 0, 6, 5 and 1 (via override)
t::lib::Mocks::mock_preference('Upload_PurgeTemporaryFiles_Days', 0 );
t::lib::Mocks::mock_preference('UploadPurgeTemporaryFilesDays', 0 );
Koha::UploadedFiles->delete_temporary;
is( Koha::UploadedFiles->search->count, 6, 'Delete with pref==0' );
t::lib::Mocks::mock_preference('Upload_PurgeTemporaryFiles_Days', 6 );
t::lib::Mocks::mock_preference('UploadPurgeTemporaryFilesDays', 6 );
Koha::UploadedFiles->delete_temporary;
is( Koha::UploadedFiles->search->count, 6, 'Delete with pref==6' );
t::lib::Mocks::mock_preference('Upload_PurgeTemporaryFiles_Days', 5 );
t::lib::Mocks::mock_preference('UploadPurgeTemporaryFilesDays', 5 );
Koha::UploadedFiles->delete_temporary;
is( Koha::UploadedFiles->search->count, 4, 'Delete with pref==5 makes 4' );