From 278aa31d2f91109ffa4c5c709c4e863033a2166e Mon Sep 17 00:00:00 2001 From: Albert Santoni Date: Wed, 4 Mar 2015 15:53:43 -0500 Subject: [PATCH 1/2] Hack: avoid calling WHMCS to get the station instance id --- airtime_mvc/application/common/Billing.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/airtime_mvc/application/common/Billing.php b/airtime_mvc/application/common/Billing.php index a4bb72150..6753f2326 100644 --- a/airtime_mvc/application/common/Billing.php +++ b/airtime_mvc/application/common/Billing.php @@ -14,8 +14,13 @@ class Billing /** Get the Airtime instance ID of the instance the customer is currently viewing. */ public static function getClientInstanceId() { - $currentProduct = Billing::getClientCurrentAirtimeProduct(); - return $currentProduct["id"]; + #$currentProduct = Billing::getClientCurrentAirtimeProduct(); + #return $currentProduct["id"]; + //XXX: Major hack attack. Since this function gets called often, rather than querying WHMCS + // we're just going to extract it from airtime.conf since it's the same as the rabbitmq username. + $CC_CONFIG = Config::getConfig(); + $instanceId = $CC_CONFIG['rabbitmq']['username']; + return $instanceId; } public static function getProducts() @@ -318,4 +323,4 @@ class Billing $result = Billing::makeRequest($credentials["url"], $query_string); } -} \ No newline at end of file +} From 181db7617aa168eaabf0745db3f380bc3c801e61 Mon Sep 17 00:00:00 2001 From: Albert Santoni Date: Wed, 4 Mar 2015 17:02:30 -0500 Subject: [PATCH 2/2] Use Billing::getClientInstanceId() in Amazon_S3StorageBackend --- .../application/cloud_storage/Amazon_S3StorageBackend.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/airtime_mvc/application/cloud_storage/Amazon_S3StorageBackend.php b/airtime_mvc/application/cloud_storage/Amazon_S3StorageBackend.php index 406e81016..e2b6a1ba6 100644 --- a/airtime_mvc/application/cloud_storage/Amazon_S3StorageBackend.php +++ b/airtime_mvc/application/cloud_storage/Amazon_S3StorageBackend.php @@ -60,8 +60,7 @@ class Amazon_S3StorageBackend extends StorageBackend public function getFilePrefix() { - $clientCurrentAirtimeProduct = Billing::getClientCurrentAirtimeProduct(); - $hostingId = $clientCurrentAirtimeProduct["id"]; + $hostingId = Billing::getClientInstanceId(); return substr($hostingId, -2)."/".$hostingId; } }