Changed cron import to output imported/failed files to subdirectories matching the imported file's original subdirectory

This commit is contained in:
matthew 2019-06-02 13:34:24 -05:00
parent e651da03cc
commit 38badf7e45

View file

@ -289,15 +289,22 @@ class CronUploader extends Extension
// Create
$newDir = $this->root_dir;
$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/";
$newDir .= "/failed_to_upload/".$relativeDir;
$info = "ERROR: Image was not uploaded.";
} else {
$newDir .= "/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);