Author: Marcel de Rooy <[hidden email]>
Date: Sun Mar 19 17:25:01 2017 +0100
Bug 18300: Delete missing upload records
If you deleted files from the upload directories manually, or you rebooted
with files in the temporary upload folder, or for some other reason have
records without a file, you may want to cleanup your records in the
This patch adds the method delete_missing to Koha::UploadedFiles. It also
supports a keep_record parameter to do a dry run (count the missing files
Also, we add an option --uploads-missing to cleanup_database. If you add
the flag 1 after this option, you will delete missing files. If you add the
flag 0 or only use the option, you will count missing files.
A subtest is added to Upload.t for delete_missing tests.
 Run t/db_dependent/Upload.t
 Upload a file and delete the file manually.
 Run cleanup_database.pl --uploads-missing
It should report at least one missing file now.
Check that the record has not been deleted.
 Run cleanup_database.pl --uploads-missing 1
It should report that it removed at least one file.
Check that the record is gone.