SAAS-527: Allow files to be uploaded to either the cloud or on local file storage
Not quite done.
This commit is contained in:
parent
ff0a685243
commit
1de326283e
5 changed files with 29 additions and 12 deletions
|
@ -34,6 +34,10 @@ class Config {
|
|||
$CC_CONFIG[$backend] = $cloudStorageValues[$backend];
|
||||
}
|
||||
|
||||
// Tells us where file uploads will be uploaded to.
|
||||
// It will either be set to a cloud storage backend or local file storage.
|
||||
$CC_CONFIG["current_backend"] = $cloudStorageValues["current_backend"]["storage_backend"];
|
||||
|
||||
$values = parse_ini_file($filename, true);
|
||||
|
||||
// Name of the web server user
|
||||
|
|
|
@ -80,11 +80,12 @@ class Application_Model_RabbitMq
|
|||
}
|
||||
|
||||
public static function SendMessageToAnalyzer($tmpFilePath, $importedStorageDirectory, $originalFilename,
|
||||
$callbackUrl, $apiKey)
|
||||
$callbackUrl, $apiKey, $currentStorageBackend)
|
||||
{
|
||||
$exchange = 'airtime-uploads';
|
||||
|
||||
$data['tmp_file_path'] = $tmpFilePath;
|
||||
$data['current_storage_backend'] = $currentStorageBackend;
|
||||
$data['import_directory'] = $importedStorageDirectory;
|
||||
$data['original_filename'] = $originalFilename;
|
||||
$data['callback_url'] = $callbackUrl;
|
||||
|
|
|
@ -413,9 +413,12 @@ class Rest_MediaController extends Zend_Rest_Controller
|
|||
}
|
||||
|
||||
//TODO: Remove uploadFileAction from ApiController.php **IMPORTANT** - It's used by the recorder daemon...
|
||||
|
||||
$storDir = Application_Model_MusicDir::getStorDir();
|
||||
$importedStorageDirectory = $storDir->getDirectory() . "/imported/" . $ownerId;
|
||||
|
||||
$importedStorageDirectory = "";
|
||||
if ($CC_CONFIG["current_backend"] == "file") {
|
||||
$storDir = Application_Model_MusicDir::getStorDir();
|
||||
$importedStorageDirectory = $storDir->getDirectory() . "/imported/" . $ownerId;
|
||||
}
|
||||
|
||||
try {
|
||||
//Copy the temporary file over to the "organize" folder so that it's off our webserver
|
||||
|
@ -426,12 +429,14 @@ class Rest_MediaController extends Zend_Rest_Controller
|
|||
Logging::error($e->getMessage());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Logging::info($importedStorageDirectory);
|
||||
//Dispatch a message to airtime_analyzer through RabbitMQ,
|
||||
//notifying it that there's a new upload to process!
|
||||
Application_Model_RabbitMq::SendMessageToAnalyzer($newTempFilePath,
|
||||
$importedStorageDirectory, basename($originalFilename),
|
||||
$callbackUrl, $apiKey);
|
||||
$callbackUrl, $apiKey, $CC_CONFIG["current_backend"]);
|
||||
}
|
||||
|
||||
private function getOwnerId()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue