More changes to scanall to address memory issues
This commit is contained in:
parent
a6796a24ae
commit
59925f3af9
@ -46,6 +46,10 @@ class CatalogScanAll extends Command
|
|||||||
$started = Carbon::now();
|
$started = Carbon::now();
|
||||||
$class = $this->getModelType($this->argument('type'));
|
$class = $this->getModelType($this->argument('type'));
|
||||||
|
|
||||||
|
// Flag everything if we are forcing a rescan
|
||||||
|
if ($this->option('scan'))
|
||||||
|
$class::select('id')->update(['flag'=>TRUE]);
|
||||||
|
|
||||||
Log::info('Scanning disk: '.Storage::disk('nas')->path(''));
|
Log::info('Scanning disk: '.Storage::disk('nas')->path(''));
|
||||||
|
|
||||||
$c = 0;
|
$c = 0;
|
||||||
@ -73,31 +77,9 @@ class CatalogScanAll extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach ($list as $o) {
|
foreach ($list as $o) {
|
||||||
// Check the details are valid
|
if ($o->flag) {
|
||||||
if ($o->file_signature === $o->getObjectOriginal('file_signature')) {
|
|
||||||
// For sanity, we'll check a couple of other attrs
|
|
||||||
if (($o->width !== $o->getObjectOriginal('width')) || ($o->height !== $o->getObjectOriginal('height'))) {
|
|
||||||
Log::alert(sprintf('Dimensions [%s] (%s x %s) mismatch for [%s]',
|
|
||||||
$o->dimensions,
|
|
||||||
$o->getObjectOriginal('width'),
|
|
||||||
$o->getObjectOriginal('height'),
|
|
||||||
$o->file_name(FALSE)));
|
|
||||||
|
|
||||||
$c++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
Log::alert(sprintf('File Signature [%s] doesnt match [%s] for [%s]',
|
|
||||||
$o->getObjectOriginal('file_signature'),
|
|
||||||
$o->file_signature,
|
|
||||||
$o->file_name(FALSE)));
|
|
||||||
|
|
||||||
$c++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$o->scanned = FALSE;
|
$o->scanned = FALSE;
|
||||||
|
$o->flag = FALSE;
|
||||||
$o->touch();
|
$o->touch();
|
||||||
|
|
||||||
if ($this->option('scan')) {
|
if ($this->option('scan')) {
|
||||||
@ -107,6 +89,11 @@ class CatalogScanAll extends Command
|
|||||||
->onQueue('scan');
|
->onQueue('scan');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$o->flag = FALSE;
|
||||||
|
$o->touch();
|
||||||
|
}
|
||||||
|
|
||||||
$c++;
|
$c++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,6 +59,35 @@ class CatalogScan implements ShouldQueue, ShouldBeUnique
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check the details are valid
|
||||||
|
if ($this->o->file_signature === $this->o->getObjectOriginal('file_signature')) {
|
||||||
|
// For sanity, we'll check a couple of other attrs
|
||||||
|
if (($this->o->width !== $this->o->getObjectOriginal('width')) || ($this->o->height !== $this->o->getObjectOriginal('height'))) {
|
||||||
|
Log::alert(sprintf('Dimensions [%s] (%s x %s) mismatch for [%s]',
|
||||||
|
$this->o->dimensions,
|
||||||
|
$this->o->getObjectOriginal('width'),
|
||||||
|
$this->o->getObjectOriginal('height'),
|
||||||
|
$this->o->file_name(FALSE)));
|
||||||
|
|
||||||
|
throw new \Exception(sprintf('Dimensions [%s] (%s x %s) mismatch for [%s]',
|
||||||
|
$this->o->dimensions,
|
||||||
|
$this->o->getObjectOriginal('width'),
|
||||||
|
$this->o->getObjectOriginal('height'),
|
||||||
|
$this->o->file_name(FALSE)));
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Log::alert(sprintf('File Signature [%s] doesnt match [%s] for [%s]',
|
||||||
|
$x=$this->o->getObjectOriginal('file_signature'),
|
||||||
|
$this->o->file_signature,
|
||||||
|
$this->o->file_name(FALSE)));
|
||||||
|
|
||||||
|
throw new \Exception(sprintf('File Signature [%s] doesnt match [%s] for [%s]',
|
||||||
|
$x,
|
||||||
|
$this->o->file_signature,
|
||||||
|
$this->o->file_name(FALSE)));
|
||||||
|
}
|
||||||
|
|
||||||
$this->o->init();
|
$this->o->init();
|
||||||
|
|
||||||
// If this is a duplicate
|
// If this is a duplicate
|
||||||
|
Loading…
Reference in New Issue
Block a user