SAAS-540: Change the Provisioning Controller's terminate endpoint to reflect new S3 file prefix

This commit is contained in:
drigato 2015-01-16 11:09:13 -05:00
parent 7930ae97ae
commit 57a7218a79
4 changed files with 12 additions and 14 deletions

View File

@ -1,6 +1,7 @@
<?php
require_once 'StorageBackend.php';
require_once 'BillingController.php';
use Aws\S3\S3Client;
@ -67,7 +68,14 @@ class Amazon_S3 extends StorageBackend
{
$this->s3Client->deleteMatchingObjects(
$bucket = $this->getBucket(),
$prefix = Application_Model_Preference::GetStationName());
$prefix = self::getAmazonS3FilePrefix());
}
public static function getAmazonS3FilePrefix()
{
$clientCurrentAirtimeProduct = BillingController::getClientCurrentAirtimeProduct();
$hostingId = $clientCurrentAirtimeProduct["id"];
return substr($hostingId, -2)."/".$hostingId;
}
}

View File

@ -28,14 +28,6 @@ class ProvisioningController extends Zend_Controller_Action
$proxyStorageBackend->deleteAllCloudFileObjects();
}
//check at to make sure cloud_file table is empty
if (CloudFileQuery::create()->count() > 0) {
$this->getResponse()
->setHttpResponseCode(400)
->appendBody("ERROR: Not all cloud files were deleted.");
return;
}
$this->getResponse()
->setHttpResponseCode(200)
->appendBody("OK");

View File

@ -118,7 +118,7 @@ class Zend_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract
return;
}
if (in_array($controller, array("api", "auth", "locale", "upgrade", 'whmcs-login'))) {
if (in_array($controller, array("api", "auth", "locale", "upgrade", 'whmcs-login', "provisioning"))) {
$this->setRoleName("G");
} elseif (!Zend_Auth::getInstance()->hasIdentity()) {

View File

@ -1,6 +1,6 @@
<?php
require_once 'php-amqplib/amqp.inc';
require_once 'BillingController.php';
require_once 'Amazon_S3.php';
class Application_Model_RabbitMq
{
@ -118,9 +118,7 @@ class Application_Model_RabbitMq
// customer's file/s; File restoration is done via the S3 Browser
// client. The client will hang if there are too many files under the
// same folder.
$clientCurrentAirtimeProduct = BillingController::getClientCurrentAirtimeProduct();
$hostingId = $clientCurrentAirtimeProduct["id"];
$data['file_prefix'] = substr($hostingId, -2)."/".$hostingId;
$data['file_prefix'] = Amazon_S3::getAmazonS3FilePrefix();
$jsonData = json_encode($data);
//self::sendMessage($exchange, 'topic', false, $jsonData, 'airtime-uploads');