Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

pixelfed/pixelfed

6813 stars
1 code files
View pixelfed/pixelfed on GitHub

app/Jobs/DeletePipeline/DeleteRemoteProfilePipeline.php

Open in GitHub
class DeleteRemoteProfilePipeline implements ShouldQueue
{
//
public function handle()
{
$profile = $this->profile;
 
if($profile->domain == null || $profile->private_key) {
return;
}
 
DB::transaction(function() use ($profile) {
$profile->avatar->forceDelete();
 
$id = $profile->id;
 
MediaTag::whereProfileId($id)->delete();
StatusHashtag::whereProfileId($id)->delete();
DirectMessage::whereFromId($id)->delete();
FollowRequest::whereFollowingId($id)
->orWhere('follower_id', $id)
->forceDelete();
Follower::whereProfileId($id)
->orWhere('following_id', $id)
->forceDelete();
Like::whereProfileId($id)->forceDelete();
});
 
DB::transaction(function() use ($profile) {
$pid = $profile->id;
StoryView::whereProfileId($pid)->delete();
$stories = Story::whereProfileId($pid)->get();
foreach($stories as $story) {
$path = storage_path('app/'.$story->path);
if(is_file($path)) {
unlink($path);
}
$story->forceDelete();
}
});
 
DB::transaction(function() use ($profile) {
$medias = Media::whereProfileId($profile->id)->get();
foreach($medias as $media) {
$path = storage_path('app/'.$media->media_path);
$thumb = storage_path('app/'.$media->thumbnail_path);
if(is_file($path)) {
unlink($path);
}
if(is_file($thumb)) {
unlink($thumb);
}
$media->forceDelete();
}
});
//
}
}

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.