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:
Albert Santoni 2015-03-24 14:56:03 -04:00
parent bc2acaea51
commit d1b28fd564
4 changed files with 9 additions and 3 deletions

View File

@ -138,7 +138,9 @@ class Logging {
switch($err['type'])
{
case E_ERROR:
case E_WARNING:
case E_PARSE:
case E_NOTICE:
case E_CORE_ERROR:
case E_CORE_WARNING:
case E_COMPILE_ERROR:

View File

@ -986,13 +986,12 @@ SQL;
// Martin K.: changed to rename: Much less load + quicker since this is
// 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 .
//the audio_stor to move the file too warn the user that .
//the file wasn't uploaded and they should check if there .
//is enough disk space .
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 "
. "hard drive does not have enough disk space or the stor "

View File

@ -124,6 +124,7 @@ class Rest_MediaController extends Zend_Rest_Controller
catch (Exception $e) {
$this->unknownErrorResponse();
Logging::error($e->getMessage());
throw $e;
}
}

View File

@ -2,10 +2,14 @@
post_file() {
#kill process after 30 minutes (360*5=30 minutes)
max_retry=360
max_retry=5
retry_count=0
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
# http://curl.haxx.se/mail/archive-2009-07/0029.html
stripped_file_path=${file_path//','/''}