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 <?php
require_once 'StorageBackend.php'; require_once 'StorageBackend.php';
require_once 'BillingController.php';
use Aws\S3\S3Client; use Aws\S3\S3Client;
@ -67,7 +68,14 @@ class Amazon_S3 extends StorageBackend
{ {
$this->s3Client->deleteMatchingObjects( $this->s3Client->deleteMatchingObjects(
$bucket = $this->getBucket(), $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(); $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() $this->getResponse()
->setHttpResponseCode(200) ->setHttpResponseCode(200)
->appendBody("OK"); ->appendBody("OK");

View File

@ -118,7 +118,7 @@ class Zend_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract
return; 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"); $this->setRoleName("G");
} elseif (!Zend_Auth::getInstance()->hasIdentity()) { } elseif (!Zend_Auth::getInstance()->hasIdentity()) {

View File

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