SAAS-505: Extract Amazon_S3 class and have it inherit from a general 'cloud backend' class

Fixed reading credentials in from cloud_storage.conf
This commit is contained in:
drigato 2014-12-02 09:06:28 -05:00
parent 7c0a25be7f
commit bf91677f91
3 changed files with 12 additions and 10 deletions

View file

@ -6,13 +6,11 @@ class Amazon_S3 extends StorageBackend
{
private $zendServiceAmazonS3;
public function Amazon_S3()
public function Amazon_S3($securityCredentials)
{
$CC_CONFIG = Config::getConfig();
$this->setBucket($CC_CONFIG['storage_backend']['bucket']);
$this->setAccessKey($CC_CONFIG['storage_backend']['api_key']);
$this->setSecretKey($CC_CONFIG['storage_backend']['api_key_secret']);
$this->setBucket($securityCredentials['bucket']);
$this->setAccessKey($securityCredentials['api_key']);
$this->setSecretKey($securityCredentials['api_key_secret']);
$this->zendServiceAmazonS3 = new Zend_Service_Amazon_S3(
$this->getAccessKey(),

View file

@ -18,7 +18,9 @@ class ProxyStorageBackend extends StorageBackend
*/
public function ProxyStorageBackend($storageBackend)
{
$this->storageBackend = new $storageBackend();
$CC_CONFIG = Config::getConfig();
$this->storageBackend = new $storageBackend($CC_CONFIG[$storageBackend]);
}
public function getAbsoluteFilePath($resourceId)