Rename airtime_mvc/ to legacy/
This commit is contained in:
parent
f0879322c2
commit
3e18d42c8b
1316 changed files with 0 additions and 0 deletions
30
legacy/application/cloud_storage/FileStorageBackend.php
Normal file
30
legacy/application/cloud_storage/FileStorageBackend.php
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
class FileStorageBackend extends StorageBackend
|
||||
{
|
||||
public function getAbsoluteFilePath($resourceId)
|
||||
{
|
||||
//TODO
|
||||
return $resourceId;
|
||||
}
|
||||
|
||||
public function getDownloadURLs($resourceId, $contentDispositionFilename)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
public function deletePhysicalFile($resourceId)
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
|
||||
public function deleteAllCloudFileObjects()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
public function getFilePrefix()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
55
legacy/application/cloud_storage/ProxyStorageBackend.php
Normal file
55
legacy/application/cloud_storage/ProxyStorageBackend.php
Normal file
|
@ -0,0 +1,55 @@
|
|||
<?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 appropriate
|
||||
* object.
|
||||
*/
|
||||
public function __construct($storageBackend)
|
||||
{
|
||||
$CC_CONFIG = Config::getConfig();
|
||||
|
||||
// The storage backend in the airtime.conf directly corresponds to
|
||||
// the name of the class that implements it, so we can create the
|
||||
// right backend object dynamically:
|
||||
if ($storageBackend == "file") {
|
||||
$this->storageBackend = new FileStorageBackend();
|
||||
} else {
|
||||
$this->storageBackend = new $storageBackend($CC_CONFIG[$storageBackend]);
|
||||
}
|
||||
}
|
||||
|
||||
public function getAbsoluteFilePath($resourceId)
|
||||
{
|
||||
return $this->storageBackend->getAbsoluteFilePath($resourceId);
|
||||
}
|
||||
|
||||
public function getDownloadURLs($resourceId, $contentDispositionFilename)
|
||||
{
|
||||
return $this->storageBackend->getDownloadURLs($resourceId, $contentDispositionFilename);
|
||||
}
|
||||
|
||||
public function deletePhysicalFile($resourceId)
|
||||
{
|
||||
$this->storageBackend->deletePhysicalFile($resourceId);
|
||||
}
|
||||
|
||||
public function deleteAllCloudFileObjects()
|
||||
{
|
||||
$this->storageBackend->deleteAllCloudFileObjects();
|
||||
}
|
||||
|
||||
public function getFilePrefix()
|
||||
{
|
||||
return $this->storageBackend->getFilePrefix();
|
||||
}
|
||||
}
|
59
legacy/application/cloud_storage/StorageBackend.php
Normal file
59
legacy/application/cloud_storage/StorageBackend.php
Normal file
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* Provides access to file objects stored on a specific storage backend.
|
||||
*/
|
||||
abstract class StorageBackend
|
||||
{
|
||||
private $bucket;
|
||||
private $accessKey;
|
||||
private $secretKey;
|
||||
|
||||
/** Returns the file object's URL to the storage backend it is located on. */
|
||||
abstract public function getAbsoluteFilePath($resourceId);
|
||||
|
||||
/** Returns the file object's signed URL. The URL must be signed since they
|
||||
* privately stored on the storage backend. */
|
||||
abstract public function getDownloadURLs($resourceId, $contentDispositionFilename);
|
||||
|
||||
/** Deletes the file from the storage backend. */
|
||||
abstract public function deletePhysicalFile($resourceId);
|
||||
|
||||
/** Deletes all objects (files) stored on the cloud service. To be used
|
||||
* for station termination */
|
||||
abstract public function deleteAllCloudFileObjects();
|
||||
|
||||
/** Get a prefix for the file (which is usually treated like a directory in the cloud) */
|
||||
abstract public function getFilePrefix();
|
||||
|
||||
protected function getBucket()
|
||||
{
|
||||
return $this->bucket;
|
||||
}
|
||||
|
||||
protected function setBucket($bucket)
|
||||
{
|
||||
$this->bucket = $bucket;
|
||||
}
|
||||
|
||||
protected function getAccessKey()
|
||||
{
|
||||
return $this->accessKey;
|
||||
}
|
||||
|
||||
protected function setAccessKey($accessKey)
|
||||
{
|
||||
$this->accessKey = $accessKey;
|
||||
}
|
||||
|
||||
protected function getSecretKey()
|
||||
{
|
||||
return $this->secretKey;
|
||||
}
|
||||
|
||||
protected function setSecretKey($secretKey)
|
||||
{
|
||||
$this->secretKey = $secretKey;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue