public function delete($entity) { /* @var $entity User */ if ($path = $entity->getPath()) { $config = $this->getConfig(); $tmp = $config['web'] . $config['dirtmp'] . $path; if (file_exists($tmp)) { UtilFilesystem::removeFile($tmp); UtilFilesystem::removeEmptyDirsToPath(dirname($tmp), $config['web'] . $config['dirtmp']); } $tmp = $config['web'] . $config['dir'] . $path; if (file_exists($tmp)) { UtilFilesystem::removeFile($tmp); UtilFilesystem::removeEmptyDirsToPath(dirname($tmp), $config['web'] . $config['dir']); } } }