cogMigrates user pages written in XWiki Syntax 1.0 into XWiki Syntax 2.0
Developed by

Vincent Massol

Rating
Rate!
0 Votes
LicenseGNU Lesser General Public License 2.1

Description

This conversion allows to benefit from the new WYSIWYG editor from the user pages.

In order to execute, create a new page in your wiki (in XWiki Syntax 2.0) and copy the following content, then follow the instructions:

{{velocity}}
#set ($userPages = $xwiki.searchDocuments(", BaseObject obj where obj.name = doc.fullName and obj.className='XWiki.XWikiUsers' and doc.syntaxId='xwiki/1.0'", 0, 0))
#if ($request.confirm == "1")
  #foreach ($userPage in $userPages)
    #if ($userDoc.getContent().trim().equals('#includeForm("XWiki.XWikiUserSheet")'))
      #set ($dummy = $userDoc.setSyntaxId("xwiki/2.0"))
      #set ($dummy = $userDoc.setContent('{{include document="XWiki.XWikiUserSheet"/}}'))
      #set ($dummy = $userDoc.save("Migrated to XWiki Syntax 2.0", true))
      * [[$userPage]] migrated
    #else
      * [[$userPage]] not migrated (it had extra content). You need to migrate this page manually.
    #end
  #end
#else
  #if ($userPages.size() > 0)
    The following users need to converted to XWiki Syntax 2.0:
    #foreach ($userPage in $userPages)
      * [[$userPage]]
    #end

    [[Start migration>>?confirm=1]]
  #else
    All user pages are in XWiki Syntax 2.0. No migration needed.
  #end
#end
{{/velocity}}

Prerequisites & Installation Instructions

Copy the code snippet to a page and save it.

Created by Vincent Massol on 2010/04/07 17:02
     

Get Connected