Be more liberal with finding duplicates

This commit is contained in:
Deon George 2024-10-05 21:10:15 +10:00
parent 2b4eadc33b
commit b3f381b743

View File

@ -120,12 +120,11 @@ abstract class Catalog extends Model
$query->where(fn($q)=>$q->whereNull('ignore_duplicate')
->orWhere('ignore_duplicate',FALSE));
// Exclude those marked as remove
$query->where(fn($q)=>$q->where('remove','<>',TRUE));
$query->where(function($q) {
$q->when($this->attributes['signature'],fn($q)=>$q->where('signature','=',$this->attributes['signature']))
->orWhere('file_signature','=',$this->attributes['file_signature'])
$query
->where(function($q) {
$q->when($this->attributes['signature'],
fn($q)=>$q->where('signature','=',$this->attributes['signature']))
->orWhere('file_signature','=',$this->attributes['file_signature']); })
// Where the signature is the same
->orWhere(function($q) {
@ -149,7 +148,6 @@ abstract class Catalog extends Model
$q->where('software_id','=',$this->attributes['software_id']);
}
});
});
return $query;
}
@ -413,7 +411,7 @@ abstract class Catalog extends Model
// Test if the target dir is writable
// @todo The target dir may not exist yet, so we should check that a parent exists and is writable.
$this->move_reason = 'Target parent dir doesnt is not writable';
$this->move_reason = 'Target parent dir is not writable';
if (! $this->isParentWritable(dirname($this->file_name_rel(FALSE))))
return FALSE;