/** * @DI\Observe("delete_claroline_web_resource") * * @param DeleteResourceEvent $event */ public function onDelete(DeleteResourceEvent $event) { $file = $this->filesPath . $event->getResource()->getHashName(); $unzipFile = $this->zipPath . $event->getResource()->getHashName(); if (file_exists($file)) { $event->setFiles([$file]); } if (file_exists($unzipFile)) { $this->unzipDelete($unzipFile); } $event->stopPropagation(); }
/** * @DI\Observe("delete_file") * * @param DeleteResourceEvent $event */ public function onDelete(DeleteResourceEvent $event) { $workspaceCode = $event->getResource()->getResourceNode()->getWorkspace()->getCode(); $pathName = $this->container->getParameter('claroline.param.files_directory') . DIRECTORY_SEPARATOR . $event->getResource()->getHashName(); if (file_exists($pathName)) { $event->setFiles(array($pathName)); } $event->stopPropagation(); }
/** * @DI\Observe("delete_claroline_scorm_12") * * @param DeleteResourceEvent $event */ public function onDelete(DeleteResourceEvent $event) { $hashName = $event->getResource()->getHashName(); $scormArchiveFile = $this->filePath . $hashName; $scormResourcesPath = $this->scormResourcesPath . $hashName; $nbScorm = (int) $this->scormResourceRepo->getNbScormWithHashName($hashName); if ($nbScorm === 1) { if (file_exists($scormArchiveFile)) { $event->setFiles(array($scormArchiveFile)); } if (file_exists($scormResourcesPath)) { $this->deleteFiles($scormResourcesPath); } } $this->om->remove($event->getResource()); $event->stopPropagation(); }