Update nodelist parsing now that we have mailer_system

This commit is contained in:
2023-07-09 22:03:15 +10:00
parent d4439a6b58
commit 52055c5217
4 changed files with 173 additions and 60 deletions

View File

@@ -36,12 +36,11 @@ trait Import
return $c;
}
// @todo Consider merging this with File::openZipFile
private function openFile(string $file,&$f): \ZipArchive
{
$z = new \ZipArchive;
if ($z->open($file)) {
if ($z->open($file,\ZipArchive::RDONLY) === TRUE) {
if ($z->count() !== 1)
throw new \Exception(sprintf('%s:File [%s] has more than 1 file (%d)', self::LOGKEY, $file, $z->count()));
@@ -82,12 +81,17 @@ trait Import
return ($x=$this->_columns->search(strtoupper($this->columns->get($key)))) !== FALSE ? $x : NULL;
}
private function getFileFromHost(string $key,File $file): string
private function getFileFromHost(string $key,mixed $file): string
{
$path = sprintf('import/%s.%d',$key,$file->id);
if ($file instanceof File) {
$path = sprintf('import/%s.%d',$key,$file->id);
Storage::disk('local')->put($path,Storage::get($file->full_storage_path));
Storage::disk('local')->put($path,Storage::get($file->full_storage_path));
return Storage::disk('local')->path($path);
return Storage::disk('local')->path($path);
} else {
return Storage::disk('local')->path($file);
}
}
}