Massive refactor of the analyzer branch and sync it back up with the
cloud storage branch (for the last time) * Backported all the bugfixes from cc-5709-airtime-analyzer-cloud-storage * Backported missing FileStorageBackend.php * Fixed CC-6001: Track titles and artist names with slashes break audio preview * Refactored all the MediaController code, pulling out the logic into MediaService * Fixed an API key leak to guests in the Media API * Made this branch work without cloud_storage.conf (defaults to file storage) * Made ApiController's getMediaAction use the MediaService code
This commit is contained in:
parent
6d00da89db
commit
2a89e4d5a0
13 changed files with 275 additions and 179 deletions
|
@ -1,19 +1,20 @@
|
|||
<?php
|
||||
|
||||
require_once 'StorageBackend.php';
|
||||
require_once 'Amazon_S3.php';
|
||||
require_once 'FileStorageBackend.php';
|
||||
require_once 'Amazon_S3StorageBackend.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
|
||||
* Receives the file's storage backend and instantiates the appropriate
|
||||
* object.
|
||||
*/
|
||||
public function ProxyStorageBackend($storageBackend)
|
||||
|
@ -23,27 +24,42 @@ class ProxyStorageBackend extends StorageBackend
|
|||
//The storage backend in the airtime.conf directly corresponds to
|
||||
//the name of the class that implements it (eg. Amazon_S3), so we
|
||||
//can easily create the right backend object dynamically:
|
||||
$this->storageBackend = new $storageBackend($CC_CONFIG[$storageBackend]);
|
||||
if ($storageBackend == "amazon_S3") {
|
||||
$this->storageBackend = new Amazon_S3StorageBackend($CC_CONFIG["amazon_S3"]);
|
||||
} else 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 getSignedURL($resourceId)
|
||||
{
|
||||
return $this->storageBackend->getSignedURL($resourceId);
|
||||
}
|
||||
|
||||
|
||||
public function getFileSize($resourceId)
|
||||
{
|
||||
return $this->storageBackend->getFileSize($resourceId);
|
||||
}
|
||||
|
||||
|
||||
public function deletePhysicalFile($resourceId)
|
||||
{
|
||||
$this->storageBackend->deletePhysicalFile($resourceId);
|
||||
}
|
||||
|
||||
}
|
||||
public function deleteAllCloudFileObjects()
|
||||
{
|
||||
$this->storageBackend->deleteAllCloudFileObjects();
|
||||
}
|
||||
|
||||
public function getFilePrefix()
|
||||
{
|
||||
return $this->storageBackend->getFilePrefix();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue