@Override public void cleanupOnDelete(final ICourse course) { // mark the subscription to this node as deleted final SubscriptionContext subsContext = WikiManager.createTechnicalSubscriptionContextForCourse( course.getCourseEnvironment(), this); NotificationsManager.getInstance().delete(subsContext); }
/** * @see org.olat.course.nodes.GenericCourseNode#archiveNodeData(java.util.Locale, * org.olat.course.ICourse, java.io.File, java.lang.String) */ @Override public boolean archiveNodeData( final Locale locale, final ICourse course, final File exportDirectory, final String charset) { final String repoRef = (String) this.getModuleConfiguration().get("reporef"); final OLATResourceable ores = RepositoryManager.getInstance() .lookupRepositoryEntryBySoftkey(repoRef, true) .getOlatResource(); if (WikiManager.getInstance().getOrLoadWiki(ores).getAllPagesWithContent().size() > 0) { // OK, there is somthing to archive final VFSContainer exportContainer = new LocalFolderImpl(exportDirectory); VFSContainer wikiExportContainer = (VFSContainer) exportContainer.resolve(WikiManager.WIKI_RESOURCE_FOLDER_NAME); if (wikiExportContainer == null) { wikiExportContainer = exportContainer.createChildContainer(WikiManager.WIKI_RESOURCE_FOLDER_NAME); } final String exportDirName = getShortTitle() + "_" + Formatter.formatDatetimeFilesystemSave(new Date(System.currentTimeMillis())); final VFSContainer destination = wikiExportContainer.createChildContainer(exportDirName); if (destination == null) { Tracing.logError( "archiveNodeData: Could not create destination directory: wikiExportContainer=" + wikiExportContainer + ", exportDirName=" + exportDirName, getClass()); } final VFSContainer container = WikiManager.getInstance().getWikiContainer(ores, WikiManager.WIKI_RESOURCE_FOLDER_NAME); if (container != null) { // the container could be null if the wiki is an old empty one - so nothing to // archive final VFSContainer parent = container.getParentContainer(); final VFSLeaf wikiZip = WikiToZipUtils.getWikiAsZip(parent); destination.copyFrom(wikiZip); } return true; } // empty wiki, no need to archive return false; }