Finished work on Catalog::verify

This commit is contained in:
Deon George
2020-07-16 13:40:16 +10:00
parent 18812b51e0
commit 3d5c0cfe9f
2 changed files with 42 additions and 5 deletions

View File

@@ -16,7 +16,7 @@ trait Files
if (is_null($option['file']) AND is_null($option['dir']))
abort(500,'Missing filename, please use --file= OR --dir=');
Log::info(sprintf('%s: Processing: %s',__METHOD__,($option['file'] ? $option['file'] : $option['dir'])));
Log::debug(sprintf('%s: Processing: %s',__METHOD__,($option['file'] ? $option['file'] : $option['dir'])));
$files = collect();
$dir = '';
@@ -26,7 +26,7 @@ trait Files
$dir = preg_replace('/\/$/','',$option['dir']);
// Exclude . & .. from the path.
$files = $files->merge(array_diff(scandir($dir),array('.','..')));
$files = $files->merge(array_filter(array_diff(scandir($dir),array('.','..')),function($item) use ($dir) { return is_file($dir.'/'.$item); }));
} elseif ($option['file'] AND ! is_dir($option['file']) AND file_exists($option['file'])) {
$dir = dirname($option['file']);
@@ -43,7 +43,7 @@ trait Files
return sprintf('%s/%s',$dir,$value);
});
Log::info(sprintf('%s: Processing: %s (%s)',__METHOD__,($option['file'] ? $option['file'] : $option['dir']),count($files)));
Log::debug(sprintf('%s: Processing: %s (%s)',__METHOD__,($option['file'] ? $option['file'] : $option['dir']),count($files)));
return $files;
}