When de-listing, remove unsent items and unsubscribe from file/echo areas.
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 38s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 1m48s
Create Docker Image / Final Docker Image Manifest (push) Successful in 10s

This commit is contained in:
Deon George 2024-05-26 21:41:02 +10:00
parent 7e0178d183
commit b6639c7bfc

View File

@ -13,7 +13,8 @@ use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Notification; use Illuminate\Support\Facades\Notification;
use App\Models\{Address,Domain,Echoarea}; use App\Classes\FTN\Message;
use App\Models\{Address,Domain};
use App\Notifications\Echomails\AbsentNodes; use App\Notifications\Echomails\AbsentNodes;
use App\Notifications\Emails\NodeMarkedDown as NodeMarkedDownEmail; use App\Notifications\Emails\NodeMarkedDown as NodeMarkedDownEmail;
use App\Notifications\Netmails\NodeMarkedDown as NodeMarkedDownNetmail; use App\Notifications\Netmails\NodeMarkedDown as NodeMarkedDownNetmail;
@ -57,8 +58,34 @@ class AddressIdle implements ShouldQueue
Log::info(sprintf('%s:- Delisting [%s], not seen for [%d] days',self::LOGKEY,$ao->ftn,config('fido.idle.delist'))); Log::info(sprintf('%s:- Delisting [%s], not seen for [%d] days',self::LOGKEY,$ao->ftn,config('fido.idle.delist')));
$contact = FALSE; $contact = FALSE;
// @todo Subscribe from echoareas/fileareas // Remove echomail not collected from echomail_seenby
DB::table('echomail_seenby')
->where('address_id',$ao->id)
->whereNotNull('export_at')
->whereNull('sent_at')
->delete();
// Remove FLAG_INTRANSIT from netmail that hasnt been delivered
DB::table('netmails')
->where('tftn_id',$ao->id)
->whereRaw(sprintf('(flags & %d) > 0',Message::FLAG_INTRANSIT))
->update(['flags'=>DB::raw(sprintf('(flags & ~%d)',Message::FLAG_INTRANSIT))]);
// Remove files not collected
DB::table('file_seenby')
->where('address_id',$ao->id)
->whereNotNull('export_at')
->whereNull('sent_at')
->delete();
// Remove subscribed echoareas
$ao->echoareas()->detach();
// Remove subscribed fileareas
$ao->fileareas()->detach();
$ao->active = FALSE; $ao->active = FALSE;
$ao->validated = FALSE;
$ao->save(); $ao->save();
// Email Alert // Email Alert