From eedd7a786f32d6d9e7cd39994acd1ff68b409265 Mon Sep 17 00:00:00 2001 From: afornerot Date: Thu, 18 Jun 2020 10:56:13 +0200 Subject: [PATCH] supression icon si fichier non existant --- .../Cadoles/CoreBundle/Command/PurgeFileCommand.php | 10 ++++++++++ 1 file changed, 10 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 1e62bac3..02bd32f1 100644 --- a/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/PurgeFileCommand.php +++ b/src/ninegate-1.0/src/Cadoles/CoreBundle/Command/PurgeFileCommand.php @@ -258,6 +258,16 @@ class PurgeFileCommand extends Command } } + $directory=$this->container->get('kernel')->getRootDir()."/../web"; + $icons=$this->em->getRepository("CadolesPortalBundle:Icon")->findAll(); + foreach($icons as $icon) { + if(!$fs->exists($directory."/".$icon->getLabel())) { + $this->writeln($directory."/".$icon->getLabel()); + $this->em->remove($icon); + $this->em->flush(); + } + } + // /web/uploads/blogarticle $this->writelnred(''); $this->writelnred('== Directory = Blog Article');