From 6e54a915d4cc82f418ab2c004b1442c267ea082e Mon Sep 17 00:00:00 2001 From: phl0 Date: Tue, 11 Apr 2023 22:40:53 +0200 Subject: [PATCH] Make LotW downloads more verbose regarding file writing --- application/controllers/Lotw.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/application/controllers/Lotw.php b/application/controllers/Lotw.php index e4a6debb..5384f1e0 100644 --- a/application/controllers/Lotw.php +++ b/application/controllers/Lotw.php @@ -615,6 +615,9 @@ class Lotw extends CI_Controller { $config['upload_path'] = './uploads/'; $file = $config['upload_path'] . 'lotwreport_download.adi'; + if (file_exists($file) && ! is_writable($file)) { + return "Temporary download file ".$file." is not writable. Aborting!"; + } // Get credentials for LoTW $data['user_lotw_name'] = urlencode($user->user_lotw_name); @@ -643,6 +646,9 @@ class Lotw extends CI_Controller { $lotw_url .= "&qso_qslsince="; $lotw_url .= "$lotw_last_qsl_date"; + if (! is_writable(dirname($file))) { + return "Temporary download directory ".dirname($file)." is not writable. Aborting!"; + } file_put_contents($file, file_get_contents($lotw_url)); ini_set('memory_limit', '-1');