From 21df743ad51978c70dc7e11abbec3ef7bd27dd0e Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Thu, 30 Mar 2017 08:42:38 +0200 Subject: [PATCH] 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 Signed-off-by: Jonathan Druart --- Koha/UploadedFiles.pm | 4 ++-- installer/data/mysql/atomicupdate/bug17669.perl | 4 ++-- installer/data/mysql/sysprefs.sql | 2 +- .../intranet-tmpl/prog/en/modules/admin/preferences/tools.pref | 2 +- t/db_dependent/Upload.t | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Koha/UploadedFiles.pm b/Koha/UploadedFiles.pm index 06a9965..3d28b25 100644 --- a/Koha/UploadedFiles.pm +++ b/Koha/UploadedFiles.pm @@ -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 ); diff --git a/installer/data/mysql/atomicupdate/bug17669.perl b/installer/data/mysql/atomicupdate/bug17669.perl index ef2e58f..d4c4f86 100644 --- a/installer/data/mysql/atomicupdate/bug17669.perl +++ b/installer/data/mysql/atomicupdate/bug17669.perl @@ -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 ); diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index a3f240e..ef52c81 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -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'), 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 a64a25c..9403951 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 @@ -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." diff --git a/t/db_dependent/Upload.t b/t/db_dependent/Upload.t index 6d7864d..136a9d7 100644 --- a/t/db_dependent/Upload.t +++ b/t/db_dependent/Upload.t @@ -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' ); -- 2.9.3