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 = new $class;
$o->filename = $file; $o->filename = $file;
$o->file_signature = $o->getObjectOriginal('file_signature');
$o->save(); $o->save();
CatalogScan::dispatch($o) CatalogScan::dispatch($o)
@ -77,30 +76,29 @@ class CatalogScanAll extends Command
// Check the details are valid // Check the details are valid
if ($o->file_signature === $o->getObjectOriginal('file_signature')) { if ($o->file_signature === $o->getObjectOriginal('file_signature')) {
// For sanity, we'll check a couple of other attrs // 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]', Log::alert(sprintf('Dimensions [%s] (%s x %s) mismatch for [%s]',
$o->dimensions, $o->dimensions,
$o->getObjectOriginal('width'), $o->getObjectOriginal('width'),
$o->getObjectOriginal('height'), $o->getObjectOriginal('height'),
$o->file_name(FALSE))); $o->file_name(FALSE)));
$c++;
continue;
}
} else { } else {
Log::alert(sprintf('File Signature [%s] doesnt match [%s] for [%s]', Log::alert(sprintf('File Signature [%s] doesnt match [%s] for [%s]',
$o->getObjectOriginal('file_signature'), $o->getObjectOriginal('file_signature'),
$o->file_signature, $o->file_signature,
$o->file_name(FALSE))); $o->file_name(FALSE)));
$c++;
continue;
} }
if ($o->signature !== $o->getObjectOriginal('signature')) { $o->scanned = FALSE;
Log::notice(sprintf('Updating image signature for [%s] to [%s] was [%s]',$o->filename,$o->signature,$o->getObjectOriginal('signature'))); $o->touch();
$o->signature = $o->getObjectOriginal('signature');
}
if ($o->isDirty())
$o->save();
else
$o->touch();
if ($this->option('scan')) { if ($this->option('scan')) {
Log::info(sprintf('Forcing re-scan of [%s] - queued',$o->filename)); Log::info(sprintf('Forcing re-scan of [%s] - queued',$o->filename));