Internal optimisations and additional flags for Photo/Video
This commit is contained in:
@@ -15,7 +15,10 @@ class CatalogScan extends Command
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'catalog:scan {type : Photo | Video } {id : Photo ID}';
|
||||
protected $signature = 'catalog:scan'.
|
||||
' {type : Photo | Video }'.
|
||||
' {id : Photo ID}'.
|
||||
' {--dirty : Show Dirty}';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
@@ -49,17 +52,17 @@ class CatalogScan extends Command
|
||||
$o->setThumbnail();
|
||||
|
||||
// If this is a duplicate
|
||||
$x = $o->duplicates()->get();
|
||||
$x = $o->myduplicates()->get();
|
||||
if (count($x)) {
|
||||
foreach ($x as $oo) {
|
||||
// And that photo is not marked as a duplicate
|
||||
if (! $oo->duplicate) {
|
||||
$o->duplicate = '1';
|
||||
$this->warn(sprintf('Image [%s] marked as a duplicate',$o->file_path()));
|
||||
$this->warn(sprintf('Image [%s] marked as a duplicate',$o->filename));
|
||||
|
||||
// If the file signature also matches, we'll mark it for deletion
|
||||
if ($oo->file_signature AND $o->file_signature == $oo->file_signature) {
|
||||
$this->warn(sprintf('Image [%s] marked for deletion',$o->file_path()));
|
||||
$this->warn(sprintf('Image [%s] marked for deletion',$o->filename));
|
||||
$o->remove = '1';
|
||||
}
|
||||
|
||||
@@ -72,9 +75,15 @@ class CatalogScan extends Command
|
||||
|
||||
if ($o->getDirty()) {
|
||||
$this->warn(sprintf('Image [%s] metadata changed',$o->filename));
|
||||
dump(['id'=>$o->id,'data'=>$o->getDirty()]);
|
||||
|
||||
if ($this->option('dirty'))
|
||||
dump(['id'=>$o->id,'data'=>$o->getDirty()]);
|
||||
}
|
||||
|
||||
// If the file signature changed, abort the update.
|
||||
if ($o->getOriginal('file_signature') AND $o->getDirty('file_signature'))
|
||||
abort(500,'File Signature Changed?');
|
||||
|
||||
$o->save();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user