/**
* @see org.olat.course.nodes.GenericCourseNode#archiveNodeData(java.util.Locale, org.olat.course.ICourse, java.io.File, java.lang.String)
*/
public void archiveNodeData(Locale locale, ICourse course, File exportDirectory, String charset) {
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);
}
String exportDirName = getShortTitle()+"_"+Formatter.formatDatetimeFilesystemSave(new Date(System.currentTimeMillis()));
VFSContainer destination = wikiExportContainer.createChildContainer(exportDirName);
if (destination==null) {
Tracing.logError("archiveNodeData: Could not create destination directory: wikiExportContainer="+wikiExportContainer+", exportDirName="+exportDirName, getClass());
}
String repoRef = (String)this.getModuleConfiguration().get("reporef");
OLATResourceable ores = RepositoryManager.getInstance().lookupRepositoryEntryBySoftkey(repoRef, true).getOlatResource();
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
VFSContainer parent = container.getParentContainer();
VFSLeaf wikiZip = WikiToZipUtils.getWikiAsZip(parent);
destination.copyFrom(wikiZip);
}
}