diff --git a/app/Jobs/CatalogVerify.php b/app/Jobs/CatalogVerify.php index 0d5ab05..efee0c1 100644 --- a/app/Jobs/CatalogVerify.php +++ b/app/Jobs/CatalogVerify.php @@ -42,14 +42,14 @@ class CatalogVerify extends Job implements ShouldQueue $good = $bad = $ugly = 0; $class::select('*')->each(function($o) use ($good,$bad,$ugly) { - if (! file_exists($o->file_name(FALSE))) { - Log::error(sprintf('Media doesnt exist: [%s] (%d:%s)',$this->type,$o->id,$o->file_name(FALSE))); + if (! file_exists($o->file_name_current(FALSE))) { + Log::error(sprintf('Media doesnt exist: [%s] (%d:%s)',$this->type,$o->id,$o->file_name_current(FALSE))); $bad++; return; } - if (($x=md5_file($o->file_name(FALSE))) !== $o->file_signature) { - Log::error(sprintf('Media MD5 doesnt match DB: [%s] (%d:%s) [%s:%s]',$this->type,$o->id,$o->file_name(FALSE),$x,$o->file_signature)); + if (($x=md5_file($o->file_name_current(FALSE))) !== $o->file_signature) { + Log::error(sprintf('Media MD5 doesnt match DB: [%s] (%d:%s) [%s:%s]',$this->type,$o->id,$o->file_name_current(FALSE),$x,$o->file_signature)); $ugly++; return; } diff --git a/app/Models/Abstracted/Catalog.php b/app/Models/Abstracted/Catalog.php index b5e6632..54981eb 100644 --- a/app/Models/Abstracted/Catalog.php +++ b/app/Models/Abstracted/Catalog.php @@ -251,6 +251,16 @@ abstract class Catalog extends Model return (($short OR preg_match('/^\//',$file)) ? '' : config($this->type.'.dir').DIRECTORY_SEPARATOR).$file; } + /** + * Return the current filename + * + * @return string + */ + public function file_name_current(bool $short=TRUE): string + { + return (($short OR preg_match('/^\//',$this->filename)) ? '' : config($this->type.'.dir').DIRECTORY_SEPARATOR).$this->filename; + } + /** * Determine the new name for the image * @deprecated use $this->file_name()