Migrate User Pages To New Syntax

Last modified by Vincent Massol on 2021/03/18 11:28

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

Vincent Massol

0 Votes
LicenseGNU Lesser General Public License 2.1

Table of contents


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:

#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
     * [[$userPage]] not migrated (it had extra content). You need to migrate this page manually.
  #if ($userPages.size() > 0)
   The following users need to converted to XWiki Syntax 2.0:
    #foreach ($userPage in $userPages)
     * [[$userPage]]

    [[Start migration>>?confirm=1]]
   All user pages are in XWiki Syntax 2.0. No migration needed.

Get Connected