Implementation fixes for TIC processing
This commit is contained in:
parent
7571a2cd7d
commit
34f289953d
@ -61,6 +61,8 @@ class Tic extends FTNBase
|
|||||||
private Address $to; // Should be me
|
private Address $to; // Should be me
|
||||||
|
|
||||||
public function __construct(private string $filename) {
|
public function __construct(private string $filename) {
|
||||||
|
Log::info(sprintf('%s:Processing TIC file [%s]',self::LOGKEY,$filename));
|
||||||
|
|
||||||
$fo = new File;
|
$fo = new File;
|
||||||
|
|
||||||
$fo->kludges = collect();
|
$fo->kludges = collect();
|
||||||
@ -70,19 +72,17 @@ class Tic extends FTNBase
|
|||||||
$fo->rogue_seenby = collect();
|
$fo->rogue_seenby = collect();
|
||||||
|
|
||||||
list($hex,$name) = explode('-',$filename);
|
list($hex,$name) = explode('-',$filename);
|
||||||
$ticfullpath = $this->fullpath($filename);
|
$hex = basename($hex);
|
||||||
|
|
||||||
if (! file_exists($ticfullpath))
|
if (! file_exists($filename))
|
||||||
throw new FileNotFoundException(sprintf('%s:File [%s] doesnt exist',self::LOGKEY,realpath($ticfullpath)));
|
throw new FileNotFoundException(sprintf('%s:File [%s] doesnt exist',self::LOGKEY,realpath($filename)));
|
||||||
|
|
||||||
if (! is_writable($ticfullpath))
|
if (! is_writable($filename))
|
||||||
throw new UnableToWriteFile(sprintf('%s:File [%s] is not writable',self::LOGKEY,realpath($ticfullpath)));
|
throw new UnableToWriteFile(sprintf('%s:File [%s] is not writable',self::LOGKEY,realpath($filename)));
|
||||||
|
|
||||||
Log::info(sprintf('Processing TIC file [%s]',$ticfullpath));
|
$f = fopen($filename,'rb');
|
||||||
|
|
||||||
$f = fopen($ticfullpath,'rb');
|
|
||||||
if (! $f) {
|
if (! $f) {
|
||||||
Log::error(sprintf('%s:! Unable to open file [%s] for writing',self::LOGKEY,$ticfullpath));
|
Log::error(sprintf('%s:! Unable to open file [%s] for writing',self::LOGKEY,$filename));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ final class Receive extends Item
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case self::IS_TIC:
|
case self::IS_TIC:
|
||||||
Log::info(sprintf('%s: - Processing tic file [%s]',self::LOGKEY,$this->file));
|
Log::info(sprintf('%s: - Processing TIC file [%s]',self::LOGKEY,$this->file));
|
||||||
|
|
||||||
// Queue the tic to be processed later, in case the referenced file hasnt been received yet
|
// Queue the tic to be processed later, in case the referenced file hasnt been received yet
|
||||||
TicProcess::dispatch($this->file);
|
TicProcess::dispatch($this->file);
|
||||||
|
@ -628,8 +628,8 @@ final class Binkp extends BaseProtocol
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception) {
|
} catch (Exception $e) {
|
||||||
Log::error(sprintf('%s: ! AKA is INVALID [%s]',self::LOGKEY,$rem_aka));
|
Log::error(sprintf('%s: ! AKA is INVALID [%s] (%s)',self::LOGKEY,$rem_aka,$e->getMessage()));
|
||||||
|
|
||||||
$this->msgs(self::BPM_ERR,sprintf('Bad address %s',$rem_aka));
|
$this->msgs(self::BPM_ERR,sprintf('Bad address %s',$rem_aka));
|
||||||
$this->rc = self::S_FAILURE;
|
$this->rc = self::S_FAILURE;
|
||||||
|
@ -40,6 +40,6 @@ class TicProcess implements ShouldQueue
|
|||||||
|
|
||||||
Log::info(sprintf('%s:Processed [%s] storing [%s] as id [%d]',self::LOGKEY,$this->file,$to->fo->file,$to->fo->id));
|
Log::info(sprintf('%s:Processed [%s] storing [%s] as id [%d]',self::LOGKEY,$this->file,$to->fo->file,$to->fo->id));
|
||||||
|
|
||||||
unlink($to->fullpath($this->file));
|
unlink($this->file);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -64,7 +64,7 @@ class File extends Model
|
|||||||
|
|
||||||
// Store file
|
// Store file
|
||||||
if (Storage::put($model->full_storage_path,Storage::disk('local')->get($model->fullname),'public')) {
|
if (Storage::put($model->full_storage_path,Storage::disk('local')->get($model->fullname),'public')) {
|
||||||
unlink($model->fullname);
|
unlink(Storage::disk('local')->path($model->fullname));
|
||||||
} else {
|
} else {
|
||||||
throw new \Exception(sprintf('Unable to move file [%s] to [%s]',$model->fullname,$model->full_storage_path));
|
throw new \Exception(sprintf('Unable to move file [%s] to [%s]',$model->fullname,$model->full_storage_path));
|
||||||
};
|
};
|
||||||
@ -95,6 +95,9 @@ class File extends Model
|
|||||||
'extra'=>sprintf('%s %s (%s)',$x->toRfc7231String(),$so::PRODUCT_NAME,$so->version),
|
'extra'=>sprintf('%s %s (%s)',$x->toRfc7231String(),$so::PRODUCT_NAME,$so->version),
|
||||||
]]);
|
]]);
|
||||||
|
|
||||||
|
// Make sure all the path is in the seenby
|
||||||
|
$model->set_seenby = $model->set_seenby->merge($model->set_path->pluck('address.id'))->unique();
|
||||||
|
|
||||||
// Save the seenby
|
// Save the seenby
|
||||||
$model->seenby()->sync($model->set_seenby);
|
$model->seenby()->sync($model->set_seenby);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user