Change ScanAll logic, we'll just queue a scan instead of recording some info initially

This commit is contained in:
Deon George 2024-09-18 09:32:08 +10:00
parent 6e2a1e8670
commit a6796a24ae

View File

@ -64,7 +64,6 @@ class CatalogScanAll extends Command
$o = new $class;
$o->filename = $file;
$o->file_signature = $o->getObjectOriginal('file_signature');
$o->save();
CatalogScan::dispatch($o)
@ -77,30 +76,29 @@ class CatalogScanAll extends Command
// Check the details are valid
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')))
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;
}
if ($o->signature !== $o->getObjectOriginal('signature')) {
Log::notice(sprintf('Updating image signature for [%s] to [%s] was [%s]',$o->filename,$o->signature,$o->getObjectOriginal('signature')));
$o->signature = $o->getObjectOriginal('signature');
}
if ($o->isDirty())
$o->save();
else
$o->touch();
$o->scanned = FALSE;
$o->touch();
if ($this->option('scan')) {
Log::info(sprintf('Forcing re-scan of [%s] - queued',$o->filename));