Koha/misc/cronjobs
Magnus Enger e8a24c35f6 Bug 11188 - Make gather_print_notices.pl die on failed open()
Problem:
If you tell gather_print_notices.pl to write output to a location
you do not have write access to, it will silently fail to write the
data, but still mark unsent messages as sent.

Solution:
This patch adds two lines of defense:
1. Check that the location given for the output is writable
2. use "open() or die" instead of just "open()" when writing the
   output
The first measure should catch most of the potential errors, but
I guess a directory can be writable, but the open() still can fail
because the disk is full or something similar.

To test:
- Make sure you have some unsent messages in the message_queue table,
  that do not have an email adress
- Apply the patch
- Run the script, pointing at a location you do not have access to
  write to. Check that the script exits with an appropriate error
  message, and that the unsent messages are still unsent. Do this
  both with and without the -s option.
- To fake passing the first line of defence, comment out line 62
  and put this in instead:
  if ( !$output_directory || !-d $output_directory ) {
- Run the script again as above, check you get an appropriate
  error and that the message queue is not touched
- Reset line 62 to how it was
- Run the script against a directory you do have access to write to
  and check that output is produced as expected and that messages
  are marked as sent
- Sign off

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes all tests and QA script.
Works as described.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-12-30 15:12:48 +00:00
..
holds bug_5911: Transport Cost Matrix 2012-09-12 14:49:25 +02:00
rss Bug 5370: Fix all references to koha.org 2010-11-08 09:41:47 +13:00
social_data Bug 10156 - Fix usr/bin/perl path for get_report_social_data.pl 2013-05-08 09:52:21 -04:00
thirdparty Bug 8606 - Talking Tech broken by Bug 7001 2012-09-20 14:12:41 +02:00
advance_notices.pl Bug 9499 - --itemscontent= option is undocumented in advanced-notice.pl cronjob + default date should be date_due, not issuedate 2013-02-07 19:44:50 -05:00
backup.sh Bug 9235 - Hardcoded values in cronjobs/backup.sh 2012-12-21 07:20:50 -05:00
batch_anonymise.pl Bug 6506: When AnonymousPatron not set, deletion of issue history silently failed. 2013-05-01 08:44:11 -04:00
build_browser_and_cloud.pl Bug 2505 - Add commented use warnings where missing in the misc/ directory 2010-04-21 20:26:44 +12:00
cart_to_shelf.pl 7368 Typo in cart_to_shelf 2012-03-16 11:50:29 +01:00
check-url-quick.pl Bug 11185: fix bug preventing check-url-quick.pl from working 2013-11-15 15:30:20 +00:00
check-url.pl Bug 7963 Parallel HTTP requests when checking URLs 2012-10-05 11:44:52 +02:00
cleanup_database.pl Bug 10361: Add option to cleanup_database.pl to purge OPAC search history 2013-09-04 14:22:50 +00:00
cloud-kw.pl Bug 5385: POD Cleanups (part 2) 2010-11-12 10:06:56 +13:00
cloud-sample.conf Fixes bugs #2875-2879 2008-12-29 19:59:44 -06:00
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 2505 - remove unnecessary -w and replace with use warnings; 2010-04-07 13:27:07 -04:00
crontab.example Bug 8741 - crontab.example missing username, fails in some systems 2012-10-09 17:55:12 +02:00
delete_expired_opac_registrations.pl Bug 7067: Followup FIX QA fails 2012-12-14 08:09:00 -05:00
delete_patrons.pl bug 10419: (follow-up) improvements to the usage text 2013-10-03 22:13:40 +00:00
delete_unverified_opac_registrations.pl Bug 7067: Followup FIX QA fails 2012-12-14 08:09:00 -05:00
fines.pl Bug 9671: Make fines.pl help text more accurate 2013-04-26 18:35:40 -04:00
gather_print_notices.pl Bug 11188 - Make gather_print_notices.pl die on failed open() 2013-12-30 15:12:48 +00:00
import_webservice_batch.pl Bug 7475: Teach matching rules to handle authorities 2012-09-19 17:15:56 +02:00
j2a.pl Bug 7157 follow-up: j2a.pl executable again 2012-01-27 12:18:25 +01:00
longoverdue.pl Bug 7639: add option to forgive overdue fines when declaring items lost 2013-09-17 15:10:46 +00:00
MARC21_parse_test.pl Bug 6752: Be stricter with utf-8 encoding of output 2012-01-27 12:11:06 +01:00
overdue_notices.pl Bug 10720: fix issue that prevented use of HTML tags in overdue notices 2013-11-01 00:28:04 +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 5251 : Enhancement: [3.2] (Resubmission) Adding code to support using gmail as an SMTP server 2011-04-08 14:01:15 +12:00
purge_suggestions.pl Bug 5944 : (MT #3000) new cronjob script to delete old suggestions 2011-03-24 22:10:20 +13:00
runreport.pl Bug 9033: Wide character error in runreport.pl 2012-12-12 07:26:52 -05:00
serialsUpdate.pl Bug 9739: (follow-up) improve help text a bit 2013-10-20 18:57:19 +00:00
services_throttle.pl Minor updates to minor cronjob script. 2008-12-31 09:47:54 -06:00
staticfines.pl Bug 8420: tool statisticfines.pl and hourly loan 2012-09-14 16:19:25 +02:00
update_totalissues.pl Bug 6557: Record bib popularity in totalissues 2012-06-29 14:29:22 +02:00