cc-3936:
Added success logging when identifier file has been written.
This commit is contained in:
parent
23e3f6137d
commit
f940c20701
|
@ -889,23 +889,31 @@ class Application_Model_StoredFile
|
||||||
// Did all the checks for realz, now trying to copy
|
// Did all the checks for realz, now trying to copy
|
||||||
$audio_stor = Application_Common_OsPath::join($stor, "organize", $fileName);
|
$audio_stor = Application_Common_OsPath::join($stor, "organize", $fileName);
|
||||||
Logging::info("copyFileToStor: moving file $audio_file to $audio_stor");
|
Logging::info("copyFileToStor: moving file $audio_file to $audio_stor");
|
||||||
//Martin K.: changed to rename: Much less load + quicker since this is an atomic operation
|
// 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.
|
//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.
|
//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($audio_file); //remove the file after failed rename
|
||||||
return array(
|
return array(
|
||||||
"code" => 108,
|
"code" => 108,
|
||||||
"message" => "
|
"message" => "
|
||||||
The file was not uploaded, this error can occur if the computer
|
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
|
||||||
directory does not have correct write permissions. ");
|
directory does not have correct write permissions.");
|
||||||
}
|
}
|
||||||
// Now that we successfully added this file, we will add another tag
|
// Now that we successfully added this file, we will add another tag
|
||||||
// file that will identify the user that owns it
|
// file that will identify the user that owns it
|
||||||
$uid = Application_Model_User::getCurrentUser()->getId();
|
$uid = Application_Model_User::getCurrentUser()->getId();
|
||||||
if (file_put_contents($audio_stor,$uid) === false) {
|
$id_file = "$audio_stor.identifier";
|
||||||
Logging::info("Could write file to identify user: '$uid'");
|
if (file_put_contents($id_file,$uid) === false) {
|
||||||
|
Logging::info("Could not write file to identify user: '$uid'");
|
||||||
|
Logging::info("Id file path: '$id_file'");
|
||||||
|
Logging::info("Defaulting to admin (no identification file was
|
||||||
|
written)");
|
||||||
|
} else {
|
||||||
|
Logging::info("Successfully written identification file for
|
||||||
|
uploaded '$audio_stor'");
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue