diff --git a/app/fax_queue/resources/job/fax_send.php b/app/fax_queue/resources/job/fax_send.php index 042869b00f..3bd89946c3 100644 --- a/app/fax_queue/resources/job/fax_send.php +++ b/app/fax_queue/resources/job/fax_send.php @@ -75,6 +75,12 @@ $parameters['fax_queue_uuid'] = $fax_queue_uuid; $database->execute($sql, $parameters); unset($sql); + + //remove the old pid file + global $pid_file; + if (file_exists($pid_file)) { + unlink($pid_file); + } } register_shutdown_function('shutdown'); @@ -159,7 +165,7 @@ $sql .= "and q.domain_uuid = d.domain_uuid and f.fax_uuid = q.fax_uuid"; $parameters['fax_queue_uuid'] = $fax_queue_uuid; $row = $database->select($sql, $parameters, 'row'); - if (is_array($row)) { + if (!empty($row)) { $fax_queue_uuid = $row['fax_queue_uuid']; $domain_uuid = $row['domain_uuid']; $domain_name = $row['domain_name']; @@ -180,6 +186,12 @@ $fax_accountcode = $row["fax_accountcode"]; $fax_command = $row["fax_command"]; $fax_toll_allow = $row["fax_toll_allow"]; + } else { + // Notify user using the system logs + syslog(E_WARNING, "Fax Send: UUID {$fax_queue_uuid} not found in fax queue"); + + // Exit with non-zero exit code to indicate an error in the program execution + exit(1); } unset($parameters);