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,16 +289,23 @@ class CronUploader extends Extension
// Create // Create
$newDir = $this->root_dir; $newDir = $this->root_dir;
// Determine which dir to move to $relativeDir = dirname(substr($path, strlen($this->root_dir) + 7));
if ($corrupt) {
// Move to corrupt dir // Determine which dir to move to
$newDir .= "/failed_to_upload/"; if ($corrupt) {
$info = "ERROR: Image was not uploaded."; // Move to corrupt dir
} else { $newDir .= "/failed_to_upload/".$relativeDir;
$newDir .= "/uploaded/"; $info = "ERROR: Image was not uploaded.";
$info = "Image successfully 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 // move file to correct dir
rename($path, $newDir.$filename); rename($path, $newDir.$filename);