purge conteneur file projecttask et calendarevent

This commit is contained in:
afornerot 2020-09-17 14:57:02 +02:00
parent 5941260165
commit 6c00001075
1 changed files with 23 additions and 1 deletions

View File

@ -65,7 +65,7 @@ class PurgeFileCommand extends Command
if($fs->exists($directory)) {
$finder = new Finder();
$finder->in($directory)->directories()->exclude("thumb")->exclude("thumbmini");
$finder->depth('== 0')->in($directory)->directories();
foreach (iterator_to_array($finder) as $file) {
$name = $file->getRelativePathname();
@ -83,6 +83,28 @@ class PurgeFileCommand extends Command
}
}
break;
case "projecttask":
$entity=$this->em->getRepository("CadolesPortalBundle:Projecttask")->find($id);
if(!$entity) {
$this->writeln($name);
$url=$directory."/".$name;
if($fs->exists($url)) {
$fs->remove($url);
}
}
break;
case "calendarevent":
$entity=$this->em->getRepository("CadolesPortalBundle:Calendarevent")->find($id);
if(!$entity) {
$this->writeln($name);
$url=$directory."/".$name;
if($fs->exists($url)) {
$fs->remove($url);
}
}
break;
}
}
}