set noavatar si avatar non existant (ref #77)

This commit is contained in:
afornerot 2020-02-25 11:19:19 +01:00
parent 2641c8197f
commit 99894ec91c

View File

@ -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');