Bugzilla – Attachment 61810 Details for
Bug 18300
Delete missing upload records
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18300: [QA Follow-up] Fix return value inconsistency
Bug-18300-QA-Follow-up-Fix-return-value-inconsiste.patch (text/plain), 1.77 KB, created by
Marcel de Rooy
on 2017-04-03 19:45:36 UTC
(
hide
)
Description:
Bug 18300: [QA Follow-up] Fix return value inconsistency
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2017-04-03 19:45:36 UTC
Size:
1.77 KB
patch
obsolete
>From 795d445b16f95cf9a74e45daca0b87b04d65aad5 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Mon, 3 Apr 2017 21:43:48 +0200 >Subject: [PATCH] Bug 18300: [QA Follow-up] Fix return value inconsistency >Content-Type: text/plain; charset=utf-8 > >As noted on bug report 17669, the return values of delete (both singular >and plural), delete_missing and delete_temporary should be consistent. >--- > Koha/UploadedFiles.pm | 15 ++++++++++----- > 1 file changed, 10 insertions(+), 5 deletions(-) > >diff --git a/Koha/UploadedFiles.pm b/Koha/UploadedFiles.pm >index 394a8f5..6e4a802 100644 >--- a/Koha/UploadedFiles.pm >+++ b/Koha/UploadedFiles.pm >@@ -115,24 +115,29 @@ Deletes all records where the actual file is not found. > > Supports a keep_record hash parameter to do a check only. > >-Returns the number of missing files (and/or deleted records). >+Return value: see delete. > > =cut > > sub delete_missing { > my ( $self, $params ) = @_; > $self = Koha::UploadedFiles->new if !ref($self); # handle class call >- my $cnt = 0; >+ my $rv = 0; > while( my $row = $self->next ) { > if( my $file = $row->full_path ) { > next if -e $file; >+ if( $params->{keep_record} ) { >+ $rv++; >+ next; >+ } > # We are passing keep_file since we already know that the file > # is missing and we do not want to see the warning >- $row->delete({ keep_file => 1 }) if !$params->{keep_record}; >- $cnt++; >+ my $delete = $row->delete({ keep_file => 1 }) // -1; >+ # Apply the same logic as in delete for the return value >+ $rv = ( $delete < 0 || $rv < 0 ) ? -1 : ( $rv + $delete ); > } > } >- return $cnt; >+ return $rv; > } > > =head3 search_term >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 18300
:
61250
|
61470
|
61778
|
61810
|
61821
|
61822
|
62496
|
62497