From 99894ec91ce06a6b4359286d59681099e89f2d3c Mon Sep 17 00:00:00 2001 From: afornerot Date: Tue, 25 Feb 2020 11:19:19 +0100 Subject: [PATCH] set noavatar si avatar non existant (ref #77) --- .../Cadoles/CoreBundle/Command/PurgeFileCommand.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/PurgeFileCommand.php b/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/PurgeFileCommand.php index 7fea6bcc..ac2572df 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/PurgeFileCommand.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/PurgeFileCommand.php @@ -110,6 +110,17 @@ class PurgeFileCommand extends Command } } + $fs = new Filesystem(); + $users=$this->em->getRepository("CadolesCoreBundle:User")->findAll(); + foreach($users as $user) { + if(!$fs->exists($directory."/".$user->getAvatar())) { + $this->writeln($user->getUsername()); + $user->setAvatar("noavatar.png"); + $this->em->persist($user); + $this->em->flush(); + } + } + // /web/uploads/header $this->writelnred(''); $this->writelnred('== Directory = Header');