supression icon si fichier non existant

This commit is contained in:
afornerot 2020-06-18 10:56:13 +02:00
parent d916b59f1c
commit eedd7a786f
1 changed files with 10 additions and 0 deletions

View File

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