From 00d577fd5bc76235b653901f060d4202e9ca611a Mon Sep 17 00:00:00 2001 From: Martin Konecny Date: Mon, 4 Mar 2013 15:22:09 -0500 Subject: [PATCH] CC-4985: Ensure files deleted via the UI are deleted from stor directory. -temporary fix. We know rabbitmq received the message, but we don't know if media-monitor actually acted on it. --- airtime_mvc/application/models/RabbitMq.php | 5 +++++ airtime_mvc/application/models/StoredFile.php | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/airtime_mvc/application/models/RabbitMq.php b/airtime_mvc/application/models/RabbitMq.php index af20d473e..371fab0b9 100644 --- a/airtime_mvc/application/models/RabbitMq.php +++ b/airtime_mvc/application/models/RabbitMq.php @@ -22,6 +22,11 @@ class Application_Model_RabbitMq $CC_CONFIG["rabbitmq"]["user"], $CC_CONFIG["rabbitmq"]["password"], $CC_CONFIG["rabbitmq"]["vhost"]); + + if (!isset($conn)) { + throw new Exception("Cannot connect to RabbitMQ server"); + } + $channel = $conn->channel(); $channel->access_request($CC_CONFIG["rabbitmq"]["vhost"], false, false, true, true); diff --git a/airtime_mvc/application/models/StoredFile.php b/airtime_mvc/application/models/StoredFile.php index 769f6176e..adb5c4c8a 100644 --- a/airtime_mvc/application/models/StoredFile.php +++ b/airtime_mvc/application/models/StoredFile.php @@ -368,7 +368,12 @@ SQL; if (file_exists($filepath) && $type == "stor") { $data = array("filepath" => $filepath, "delete" => 1); - Application_Model_RabbitMq::SendMessageToMediaMonitor("file_delete", $data); + try { + Application_Model_RabbitMq::SendMessageToMediaMonitor("file_delete", $data); + } catch (Exception $e) { + Logging::error($e->getMessage()); + return; + } }