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

Vincent Massol

Rating
0 Votes
LicenseGNU Lesser General Public License 2.1

Table of contents

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}}
     

Get Connected