props.setProperty( "log4j.appender.outlog.layout", "org.apache.log4j.PatternLayout" );
props.setProperty( "jspwiki.useLucene", "false" );
props.setProperty( "log4j.rootCategory", "INFO,outlog" );
WikiEngine engine = new WikiEngine( props );
WikiPageProvider sourceProvider = engine.getPageManager().getProvider();
File tmpDir = new File( SystemUtils.JAVA_IO_TMPDIR, "converter-tmp" );
props.setProperty( AbstractFileProvider.PROP_PAGEDIR, tmpDir.getAbsolutePath() );
WikiPageProvider destProvider = new VersioningFileProvider();
destProvider.initialize( engine, props );
Collection allPages = sourceProvider.getAllPages();
int idx = 1;
for( Iterator i = allPages.iterator(); i.hasNext(); )
{
WikiPage p = (WikiPage)i.next();
System.out.println("Converting page: "+p.getName()+" ("+idx+"/"+allPages.size()+")");
List pageHistory = engine.getVersionHistory( p.getName() );
for( ListIterator v = pageHistory.listIterator(pageHistory.size()); v.hasPrevious(); )
{
WikiPage pv = (WikiPage)v.previous();
String text = engine.getPureText( pv.getName(), pv.getVersion() );
destProvider.putPageText( pv, text );
}
//
// Do manual setting now
//