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

This commit is contained in:
drigato 2014-12-01 21:05:46 -05:00
parent 432245b18e
commit 7c0a25be7f
7 changed files with 194 additions and 133 deletions

View file

@ -0,0 +1,44 @@
<?php
require_once 'StorageBackend.php';
require_once 'Amazon_S3.php';
/**
*
* Controls access to the storage backend class where a file is stored.
*
*/
class ProxyStorageBackend extends StorageBackend
{
private $storageBackend;
/**
* Receives the file's storage backend and instantiates the approriate
* object.
*/
public function ProxyStorageBackend($storageBackend)
{
$this->storageBackend = new $storageBackend();
}
public function getAbsoluteFilePath($resourceId)
{
return $this->storageBackend->getAbsoluteFilePath($resourceId);
}
public function getSignedURL($resourceId)
{
return $this->storageBackend->getSignedURL($resourceId);
}
public function getFileSize($resourceId)
{
return $this->storageBackend->getFileSize($resourceId);
}
public function deletePhysicalFile($resourceId)
{
$this->storageBackend->deletePhysicalFile($resourceId);
}
}