Make LotW downloads more verbose regarding file writing

This commit is contained in:
phl0 2023-04-11 22:40:53 +02:00
parent 853720592b
commit 6e54a915d4
No known key found for this signature in database
GPG Key ID: 48EA1E640798CA9A

View File

@ -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');