Merge branch 'cc-5709-airtime-analyzer' into cc-5709-airtime-analyzer-saas
Conflicts: airtime_mvc/application/modules/rest/controllers/MediaController.php
This commit is contained in:
commit
0c0c65f69b
2 changed files with 16 additions and 6 deletions
|
@ -136,6 +136,18 @@ class Rest_MediaController extends Zend_Rest_Controller
|
||||||
$file->save();
|
$file->save();
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
/* If full_path is set, the post request came from ftp.
|
||||||
|
* Users are allowed to upload folders via ftp. If this is the case
|
||||||
|
* we need to include the folder name with the file name, otherwise
|
||||||
|
* files won't get removed from the organize folder.
|
||||||
|
*/
|
||||||
|
if (isset($whiteList["full_path"])) {
|
||||||
|
$fullPath = $whiteList["full_path"];
|
||||||
|
$basePath = isset($_SERVER['AIRTIME_BASE']) ? $_SERVER['AIRTIME_BASE']."/srv/airtime/stor/organize/" : "/srv/airtime/stor/organize/";
|
||||||
|
$relativePath = substr($fullPath, strlen($basePath));
|
||||||
|
} else {
|
||||||
|
$relativePath = $_FILES["file"]["name"];
|
||||||
|
}
|
||||||
|
|
||||||
$file->fromArray($whiteList);
|
$file->fromArray($whiteList);
|
||||||
$file->setDbOwnerId($this->getOwnerId());
|
$file->setDbOwnerId($this->getOwnerId());
|
||||||
|
@ -147,7 +159,7 @@ class Rest_MediaController extends Zend_Rest_Controller
|
||||||
|
|
||||||
$callbackUrl = $this->getRequest()->getScheme() . '://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getRequestUri() . "/" . $file->getPrimaryKey();
|
$callbackUrl = $this->getRequest()->getScheme() . '://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getRequestUri() . "/" . $file->getPrimaryKey();
|
||||||
|
|
||||||
$this->processUploadedFile($callbackUrl, $_FILES["file"]["name"], $this->getOwnerId());
|
$this->processUploadedFile($callbackUrl, $relativePath, $this->getOwnerId());
|
||||||
|
|
||||||
$this->getResponse()
|
$this->getResponse()
|
||||||
->setHttpResponseCode(201)
|
->setHttpResponseCode(201)
|
||||||
|
@ -366,8 +378,6 @@ class Rest_MediaController extends Zend_Rest_Controller
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Logging::info("Old temp file path: " . $tempFilePath);
|
|
||||||
|
|
||||||
//Dispatch a message to airtime_analyzer through RabbitMQ,
|
//Dispatch a message to airtime_analyzer through RabbitMQ,
|
||||||
//notifying it that there's a new upload to process!
|
//notifying it that there's a new upload to process!
|
||||||
Application_Model_RabbitMq::SendMessageToAnalyzer($newTempFilePath,
|
Application_Model_RabbitMq::SendMessageToAnalyzer($newTempFilePath,
|
||||||
|
|
|
@ -28,7 +28,7 @@ post_file() {
|
||||||
|
|
||||||
api_key=$(awk -F "= " '/api_key/ {print $2}' $instance_conf_path)
|
api_key=$(awk -F "= " '/api_key/ {print $2}' $instance_conf_path)
|
||||||
|
|
||||||
until curl --max-time 30 $url -u $api_key":" -X POST -F "file=@${file_path}" -F "name=${filename}"
|
until curl --max-time 30 $url -u $api_key":" -X POST -F "file=@${file_path}" -F "full_path=${file_path}"
|
||||||
do
|
do
|
||||||
retry_count=$[$retry_count+1]
|
retry_count=$[$retry_count+1]
|
||||||
if [ $retry_count -ge $max_retry ]; then
|
if [ $retry_count -ge $max_retry ]; then
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue