diff --git a/services/nginx/app/classes/wash_certificate_store.php b/services/nginx/app/classes/wash_certificate_store.php index e18c2349..7e4d5f8c 100644 --- a/services/nginx/app/classes/wash_certificate_store.php +++ b/services/nginx/app/classes/wash_certificate_store.php @@ -46,4 +46,9 @@ class wash_certificate_store implements minio_wash_certificates_i ]); return $path; } + + public function isFileInStore(string $file): bool + { + return self::getS3Client()->doesObjectExist(self::getBucket(), $file); + } } \ No newline at end of file diff --git a/services/nginx/app/file_server.php b/services/nginx/app/file_server.php index 9121fb04..8e264af5 100644 --- a/services/nginx/app/file_server.php +++ b/services/nginx/app/file_server.php @@ -7,8 +7,9 @@ $file = str_replace('/modules/washcertificates/output/certificates/', '', $file) $wash_certificate_store = new \classes\wash_certificate_store(); // Check if the certificate exists -if (!$wash_certificate_store->washCertificateExists($file)) { - header('HTTP/1.1 404 Not Found'); +if (!$wash_certificate_store->isFileInStore($file)) { + echo 'Certificate not found in store'; + //header('HTTP/1.1 404 Not Found'); exit; } diff --git a/services/nginx/app/objects/bookings_o.php b/services/nginx/app/objects/bookings_o.php index 8d2ed61f..71ccfb4a 100644 --- a/services/nginx/app/objects/bookings_o.php +++ b/services/nginx/app/objects/bookings_o.php @@ -120,7 +120,7 @@ class bookings_o extends db // Parse the bookings $parsed_bookings = $wordpress_bookings_remote->parse_bookings($bookings); // Remove the cancelled bookings from the $parsed_bookings array - $cancelled_bookings = $this->getAllCancelledBookings(); + $cancelled_bookings = $this->getAllCancelledOrCompletedBookings(); foreach ( $cancelled_bookings as $cancelled_booking ) { // Remove the cancelled booking from the parsed bookings foreach ( $parsed_bookings as $key => $parsed_booking ) { @@ -157,11 +157,11 @@ class bookings_o extends db ]; } - public function getAllCancelledBookings(): array + public function getAllCancelledOrCompletedBookings(): array { global $db; // Get all the cancelled bookings - $sql = "SELECT * FROM $this->table WHERE status = 'cancelled' OR washCertificateStatus = 'cancelled'"; + $sql = "SELECT * FROM $this->table WHERE status = 'cancelled' OR status = 'completed'"; $result = $db->query($sql); return $db->fetch_all($result); }