largeExportBySpace

Large Export

<%

import com.xpn.xwiki.*; import com.xpn.xwiki.doc.*; import com.xpn.xwiki.plugin.packaging.*; import java.util.zip.*; import com.xpn.xwiki.util.Util;

def getXAR(String filename, XWikiContext context) { def request = context.getRequest(); def export = context.getWiki().getPluginApi("package", context); List spaces = request.getParameterMap().get("spaces"); export.setWithVersions(true); export.setAuthorName("XWiki.Admin"); export.setDescription(""); export.setLicence(""); export.setVersion(""); export.setBackupPack(true); export.setName("backup"); def pack = export.getPackage(); for(String space : spaces){ for(String docName : context.getWiki().getSpaceDocsName(space, context)){ pack.add(space+"."+docName, com.xpn.xwiki.plugin.packaging.DocumentInfo.ACTION_OVERWRITE, context); } } if(request.dir){ pack.exportToDir(new File(filename), context); }else{ pack.export(new FileOutputStream(new File(filename)), context); } }

if (request.filename) { getXAR(request.filename, context.getContext()) } else { %> should be save at : tomcat/logs/

File/directory to write to:
<% for(String space : xwiki.getSpaces()){ println(space+"n"); } %> Don't zip files, output to directory
<% } %>