Added Files Trait, added createParentDirs
This commit is contained in:
@@ -9,6 +9,8 @@ use App\Model\Photo;
|
||||
|
||||
class Move extends Command
|
||||
{
|
||||
use \App\Traits\Files;
|
||||
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
@@ -55,6 +57,9 @@ class Move extends Command
|
||||
$po = Photo::notRemove()->notDuplicate();
|
||||
}
|
||||
|
||||
if (! $po)
|
||||
exit;
|
||||
|
||||
// Show a progress bar
|
||||
$bar = $this->output->createProgressBar($po->count());
|
||||
$bar->setFormat("%current%/%max% [%bar%] %percent:3s%% (%memory%) (%remaining%) ");
|
||||
@@ -66,7 +71,7 @@ class Move extends Command
|
||||
if (($x = $po->moveable()) === TRUE) {
|
||||
Log::info(sprintf('%s: Moving (%s)[%s]',__METHOD__,$po->id,$po->filename));
|
||||
|
||||
if (rename($po->file_path(),$po->file_path(FALSE,TRUE)))
|
||||
if ($this->makeParentDir(dirname($po->file_path(FALSE,TRUE))) AND rename($po->file_path(),$po->file_path(FALSE,TRUE)))
|
||||
{
|
||||
// Convert the path to a relative one.
|
||||
$po->filename = $po->file_path(TRUE,TRUE);
|
||||
|
Reference in New Issue
Block a user