Fixed a bug in FTP upload hook, other minor improvements
* Ensure we have write permissions on any newly uploaded files by FTP * Don't silence warnings in moveFileToStor() * Reduced the FTP upload max retry count * Log E_NOTICE and E_WARNING levels to Sentry
This commit is contained in:
parent
bc2acaea51
commit
d1b28fd564
|
@ -138,7 +138,9 @@ class Logging {
|
||||||
switch($err['type'])
|
switch($err['type'])
|
||||||
{
|
{
|
||||||
case E_ERROR:
|
case E_ERROR:
|
||||||
|
case E_WARNING:
|
||||||
case E_PARSE:
|
case E_PARSE:
|
||||||
|
case E_NOTICE:
|
||||||
case E_CORE_ERROR:
|
case E_CORE_ERROR:
|
||||||
case E_CORE_WARNING:
|
case E_CORE_WARNING:
|
||||||
case E_COMPILE_ERROR:
|
case E_COMPILE_ERROR:
|
||||||
|
|
|
@ -986,13 +986,12 @@ SQL;
|
||||||
|
|
||||||
// Martin K.: changed to rename: Much less load + quicker since this is
|
// Martin K.: changed to rename: Much less load + quicker since this is
|
||||||
// an atomic operation
|
// an atomic operation
|
||||||
if (@rename($audio_file, $audio_stor) === false) {
|
if (rename($audio_file, $audio_stor) === false) {
|
||||||
//something went wrong likely there wasn't enough space in .
|
//something went wrong likely there wasn't enough space in .
|
||||||
//the audio_stor to move the file too warn the user that .
|
//the audio_stor to move the file too warn the user that .
|
||||||
//the file wasn't uploaded and they should check if there .
|
//the file wasn't uploaded and they should check if there .
|
||||||
//is enough disk space .
|
//is enough disk space .
|
||||||
unlink($audio_file); //remove the file after failed rename
|
unlink($audio_file); //remove the file after failed rename
|
||||||
//unlink($id_file); // Also remove the identifier file
|
|
||||||
|
|
||||||
throw new Exception("The file was not uploaded, this error can occur if the computer "
|
throw new Exception("The file was not uploaded, this error can occur if the computer "
|
||||||
. "hard drive does not have enough disk space or the stor "
|
. "hard drive does not have enough disk space or the stor "
|
||||||
|
|
|
@ -124,6 +124,7 @@ class Rest_MediaController extends Zend_Rest_Controller
|
||||||
catch (Exception $e) {
|
catch (Exception $e) {
|
||||||
$this->unknownErrorResponse();
|
$this->unknownErrorResponse();
|
||||||
Logging::error($e->getMessage());
|
Logging::error($e->getMessage());
|
||||||
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,14 @@
|
||||||
|
|
||||||
post_file() {
|
post_file() {
|
||||||
#kill process after 30 minutes (360*5=30 minutes)
|
#kill process after 30 minutes (360*5=30 minutes)
|
||||||
max_retry=360
|
max_retry=5
|
||||||
retry_count=0
|
retry_count=0
|
||||||
|
|
||||||
file_path="${1}"
|
file_path="${1}"
|
||||||
|
# Give us write permissions on the file to prevent problems if the user
|
||||||
|
# uploads a read-only file.
|
||||||
|
chmod +w "${file_path}"
|
||||||
|
|
||||||
#We must remove commas because CURL can't upload files with commas in the name
|
#We must remove commas because CURL can't upload files with commas in the name
|
||||||
# http://curl.haxx.se/mail/archive-2009-07/0029.html
|
# http://curl.haxx.se/mail/archive-2009-07/0029.html
|
||||||
stripped_file_path=${file_path//','/''}
|
stripped_file_path=${file_path//','/''}
|
||||||
|
|
Loading…
Reference in New Issue