Move the send DB updates out of the protocol and into Send::class
This commit is contained in:
@@ -2,9 +2,12 @@
|
||||
|
||||
namespace App\Classes\File;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
use App\Classes\Node;
|
||||
use App\Models\File as FileModel;
|
||||
|
||||
final class File extends Send
|
||||
@@ -49,11 +52,22 @@ final class File extends Send
|
||||
}
|
||||
}
|
||||
|
||||
public function close(bool $successful): void
|
||||
public function close(bool $successful,Node $node): void
|
||||
{
|
||||
if ($successful)
|
||||
if ($successful) {
|
||||
$this->complete = TRUE;
|
||||
|
||||
if (($this->type === Send::T_FILE)
|
||||
&& ($x=$this->dbids)->count()
|
||||
&& $node->aka_remote_authed->count())
|
||||
DB::table('file_seenby')
|
||||
->whereIn('file_id',$x)
|
||||
->whereIn('address_id',$node->aka_remote_authed->pluck('id'))
|
||||
->update([
|
||||
'sent_at'=>Carbon::now(),
|
||||
]);
|
||||
}
|
||||
|
||||
fclose($this->fd);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user