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