Koha/misc/cronjobs
Marcel de Rooy 8c80c9b8e1 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
uploaded_files table.

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
first).

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.

Test plan:
[1] Run t/db_dependent/Upload.t
[2] Upload a file and delete the file manually.
[3] Run cleanup_database.pl --uploads-missing
    It should report at least one missing file now.
    Check that the record has not been deleted.
[4] Run cleanup_database.pl --uploads-missing 1
    It should report that it removed at least one file.
    Check that the record is gone.

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>
2017-04-21 00:11:39 +00:00
..
holds Bug 13889: Add information about cron jobs to system log 2015-05-04 11:11:14 -03:00
rss Bug 14383: misc: Fix some typos in comments and documentation 2015-06-22 17:34:45 -03:00
social_data Bug 15193 - Perl scripts missing exec permission 2015-12-11 16:36:08 +00:00
thirdparty Bug 9004: Use Koha::Calendar instead of C4::Calendar 2016-04-29 12:01:24 +00:00
advance_notices.pl Bug 15629: Koha::Libraries - Remove GetBranchDetail 2016-02-24 03:55:06 +00:00
automatic_item_modification_by_age.pl Bug 11023: Automatic item modification by age (Was Toggle "new" status") 2016-03-02 22:56:31 +00:00
automatic_renewals.pl Bug 13889: Add information about cron jobs to system log 2015-05-04 11:11:14 -03:00
backup.sh Bug 9235 - Hardcoded values in cronjobs/backup.sh 2012-12-21 07:20:50 -05:00
batch_anonymise.pl Bug 16966: move parameters to hashref 2017-03-03 17:20:05 +00:00
build_browser_and_cloud.pl Bug 13889: Add information about cron jobs to system log 2015-05-04 11:11:14 -03:00
cart_to_shelf.pl Bug 13889: Add information about cron jobs to system log 2015-05-04 11:11:14 -03:00
check-url-quick.pl Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
check-url.pl Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
cleanup_database.pl Bug 18300: Delete missing upload records 2017-04-21 00:11:39 +00:00
cloud-kw.pl Bug 14383: misc: Fix some typos in comments and documentation 2015-06-22 17:34:45 -03:00
cloud-sample.conf
CONFIGURE.gmail Bug 5251 : Enhancement: [3.2] (Resubmission) Adding code to support using gmail as an SMTP server 2011-04-08 14:01:15 +12:00
create_koc_db.pl Bug 9978: (followup) Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:43 -03:00
crontab.example Bug 17669: Add new switch to crontab example and debian daily cron file 2017-04-21 13:55:25 -04:00
delete_expired_opac_registrations.pl Bug 16907: Koha::Patrons - Move DelMember to ->delete 2016-10-21 16:20:41 +00:00
delete_items.pl Bug 14504: (followup) Make deletion conditional on --commit 2016-08-26 12:07:27 +00:00
delete_patrons.pl Bug 16907: Koha::Patrons - Move HandleDelBorrower to ->delete 2016-10-21 16:20:41 +00:00
delete_records_via_leader.pl Bug 17196 - (QA Followup) Use items from Koha::Biblio 2017-01-13 13:49:29 +00:00
delete_unverified_opac_registrations.pl Bug 16907: Koha::Patrons - Move DelMember to ->delete 2016-10-21 16:20:41 +00:00
edi_cron.pl Bug 17141: Call config method to retrieve logdir 2016-09-02 15:49:12 +00:00
fines.pl Bug 15675 - Add issue_id column to accountlines and use it for updating fines 2016-03-02 03:24:45 +00:00
gather_print_notices.pl Bug 14960: Remove C4::Dates from files in misc/cronjobs 2015-11-17 15:36:43 -03:00
import_webservice_batch.pl Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
j2a.pl Bug 15742 [QA Followup] - Tidy script 2016-02-23 21:19:08 +00:00
longoverdue.pl Bug 15548: Move new patron related code to Patron* 2016-03-03 14:38:26 -07:00
membership_expiry.pl Bug 17569: Do not limit by branch if option is not passed 2016-12-30 11:55:14 +00:00
merge_authorities.pl Bug 9988: Refactor the cron script 2017-04-13 08:53:47 -04:00
nl-sync-from-koha.pl Bug 15193 - Perl scripts missing exec permission 2015-12-11 16:36:08 +00:00
nl-sync-to-koha.pl Bug 15193 - Perl scripts missing exec permission 2015-12-11 16:36:08 +00:00
notice_unprocessed_suggestions.pl Bug 15629: Koha::Libraries - Remove GetBranchDetail 2016-02-24 03:55:06 +00:00
overdue_notices.pl Bug 17470 Make overdue notices according to branch item only 2016-12-16 11:06:52 +00:00
printoverdues.sh Bug 10127 : Printoverdues.sh should tar only pdf files 2013-07-16 15:47:13 +00:00
process_message_queue.pl Bug 13889: Add information about cron jobs to system log 2015-05-04 11:11:14 -03:00
purge_suggestions.pl Bug 13889: Add information about cron jobs to system log 2015-05-04 11:11:14 -03:00
remove_temporary_edifiles.pl Bug 7736: Support Ordering via Edifact EDI messages 2016-04-01 20:03:17 +00:00
runreport.pl Bug 14365 - Populate never used saved_sql column last_run when execute_query is called 2017-03-31 13:54:22 +00:00
serialsUpdate.pl Bug 14960: Remove C4::Dates from files in misc/cronjobs 2015-11-17 15:36:43 -03:00
services_throttle.pl
share_usage_with_koha_community.pl Bug 18066: Hea V2 2017-03-23 00:10:46 +00:00
sitemap.pl Bug 16751: What is sitemaper? 2016-06-24 13:19:06 +00:00
staticfines.pl Bug 14960: Simplify the date management in staticfines 2015-11-17 15:36:51 -03:00
update_totalissues.pl Bug 13889: Add information about cron jobs to system log 2015-05-04 11:11:14 -03:00