Delete avatar image from disk on user deletion

@param User $user
@param LifecycleEventArgs $event
967474
public function preRemove(User $user, LifecycleEventArgs $event)
    {
        $oldAvatarImage = $user->getAvatarImage();
        if (!empty($oldAvatarImage)) {
            $this->userService->deleteAvatar($oldAvatarImage);
        }
    }
818315
public function onUsersDelete(GenericDatasEvent $event)
    {
        $users = $event->getDatas();
        $ids = array();

        foreach ($users as $user) {
            $ids[] = $user->getId();
        }
        $this->tagManager->removeTaggedObjectsByClassAndIds(
            'Claroline\CoreBundle\Entity\User',
            $ids
        );
    }
991258
protected function removeOwnerFromUsersWorkspaces(User $user)
    {
        /** @var Workspace $workspace */
        foreach ($this->workspaceRepository->findByOwner($user) as $workspace) {
            $workspace->setOwner(null);
            $this->workspaceRepository->update($workspace);
        }
    }
706184
private function deleteSessions(Entity\Users $user)
    {
        $savePath = $this->sessionStorage->getOptions()->get('save_path');
        try {
            $sessionFiles = $this->filesystem->find()->files()->in($savePath);
        } catch (FileNotFoundException $e) {
            return;
        }

        /** @var \Bolt\Filesystem\Handler\File $sessionFile */
        foreach ($sessionFiles as $sessionFile) {
            $data = Serialization::parse($sessionFile->read());
            if (!isset($data['_sf2_attributes']['authentication'])) {
                continue;
            }
            if (!$data['_sf2_attributes']['authentication'] instanceof Token) {
                continue;
            }
            /** @var \Bolt\AccessControl\Token\Token $token */
            $token = $data['_sf2_attributes']['authentication'];
            if ($token->getUser()->getId() === $user->getId()) {
                $sessionFile->delete();
            }
        }
    }
372260
private function cleanProperties(User $user)
    {
        $sql = 'DELETE FROM `edit_presets` WHERE usr_id = :usr_id';
        $stmt = $this->appboxConnection->prepare($sql);
        $stmt->execute([':usr_id' => $user->getId()]);
        $stmt->closeCursor();

        $this->cleanSettings($user);
        $this->cleanTokens($user);
        $this->cleanQueries($user);
        $this->cleanFtpCredentials($user);
        $this->cleanOrders($user);
        $this->cleanFtpExports($user);
        $this->cleanAuthProvider($user);
        $this->cleanUserSessions($user);
        $this->cleanOauthApplication($user);
    }
39635
public function handle(DeletingUser $event)
    {
        if ($event->user->isAdmin())
            return false;

        if ($event->user->isForceDeleting())
            $event->user->detachAllRoles(false);

        return true;
    }
237147
public function delete(Item $item, $user, $skipErrors = false)
    {
        if (!$this->canEdit($item, $user)) {
            if (!$skipErrors) {
                throw new \Exception('You can not delete this item.');
            } else {
                return;
            }
        }

        $this->om->remove($item);
        $this->om->flush();
    }
843622
public function deleteAction(User $user)
    {
        if ($user === $this->currentUser) {
            $this->addFlashMessage('You can not delete the currently logged in user', 'Current user can\'t be deleted', Message::SEVERITY_WARNING, [], 1412374546);
            $this->redirect('index');
        }
        $this->userService->deleteUser($user);
        $this->addFlashMessage('The user "%s" has been deleted.', 'User deleted', Message::SEVERITY_NOTICE, [htmlspecialchars($user->getName()->getFullName())], 1412374546);
        $this->redirect('index');
    }
1090850
public function logout(Event $event, array $user)
    {
        $this->_registry->Cookie->delete($this->_config['cookie']['name']);
    }
740238
public function removeUser(\Haven\SecurityBundle\Entity\User $users)
    {
        $this->users->removeElement($users);
    }
866458
private void postDelete(User user) throws Exception
   {
      for (UserEventListener listener : listeners)
      {
         listener.postDelete(user);
      }
   }
1175567
public function remove(UserInterface $user): bool
    {
        try {
            $this->storage->delete(User::TABLE, $user->getId()->toString());
        } catch (Exception $e) {
            throw $e;
        }
        return true;
    }
823177
private function collectEventsFromDocument(LifecycleEventArgs $event)
    {
        $entity = $event->getEntity();

        if ($entity instanceof UserAggregateRoot) {
            foreach ($entity->events() as $event) {
                $this->collectedEvents[] = $event;
            }

            $entity->eraseEvents();
        }
    }
1019649
public function deleteUser(User $user)
    {
        $parent = $user->getParent();
        if (!isset($this->userList[$user->getUsername()]) || $this->userList[$user->getUsername()] !== $user ||
            $parent == null
        ) {
            return false;
        }
        $this->connection->beginTransaction();
        $children = $this->getChildren($user);
        $success = true;
        foreach ($children as $child) {
            /** @var $child User */
            $success = $success && $child->setParent($parent);
        }
        $success = $success && $user->delete();

        if ($success) {
            $this->connection->commit();
            $this->setUpIterator();
        } else {
            $this->connection->rollBack();
        }
        return $success;
    }
891108
public function removeUser(\WobbleCode\UserBundle\Document\User $user)
    {
        $this->users->removeElement($user);
    }
761049
public function deleteAsset($user, $repo, $assetId)
	{
		// Build the request path.
		$path = '/repos/' . $user . '/' . $repo . '/releases/assets/' . (int) $assetId;

		// Send the request.
		$this->processResponse($this->client->delete($this->fetchUrl($path)), 204);

		return true;
	}
1348087
public function onQuit(Event $event)
    {
        $msg = $event->getMessage();

        if (!isset($msg['nick'])) {
            return;
        }

        $nick = $msg['nick'];

        $this->storage->removeUser($nick);
    }