Changed cron import to output imported/failed files to subdirectories matching the imported file's original subdirectory
This commit is contained in:
parent
e651da03cc
commit
38badf7e45
1 changed files with 17 additions and 10 deletions
|
@ -289,16 +289,23 @@ class CronUploader extends Extension
|
|||
// Create
|
||||
$newDir = $this->root_dir;
|
||||
|
||||
// Determine which dir to move to
|
||||
if ($corrupt) {
|
||||
// Move to corrupt dir
|
||||
$newDir .= "/failed_to_upload/";
|
||||
$info = "ERROR: Image was not uploaded.";
|
||||
} else {
|
||||
$newDir .= "/uploaded/";
|
||||
$info = "Image successfully uploaded. ";
|
||||
}
|
||||
|
||||
$relativeDir = dirname(substr($path, strlen($this->root_dir) + 7));
|
||||
|
||||
// Determine which dir to move to
|
||||
if ($corrupt) {
|
||||
// Move to corrupt dir
|
||||
$newDir .= "/failed_to_upload/".$relativeDir;
|
||||
$info = "ERROR: Image was not uploaded.";
|
||||
}
|
||||
else {
|
||||
$newDir .= "/uploaded/".$relativeDir;
|
||||
$info = "Image successfully uploaded. ";
|
||||
}
|
||||
$newDir = str_replace ( "//", "/", $newDir."/" );
|
||||
|
||||
if (!is_dir($newDir))
|
||||
mkdir ( $newDir, 0775, true );
|
||||
|
||||
// move file to correct dir
|
||||
rename($path, $newDir.$filename);
|
||||
|
||||
|
|
Reference in a new issue