cogChange the content type to Pure Text in all wikis for XWiki.StyleSheetExtension
Developed by

Vincent Massol

Rating
Rate!
0 Votes
LicenseGNU Lesser General Public License 2.1

Description

Demonstrates:

  • Iterating over all subwikis
  • How to access an XClass xproperty
  • How to access an XClass xproperty metadata (the Content Type metadata here for a TextAreaClass)
  • How to modify an XClass xproperty and save it
{{velocity}}
#foreach ($wiki in $xwiki.getWikiNames())
  #set ($xdoc = $xwiki.getDocument("${wiki}:XWiki.StyleSheetExtension"))
  #set ($contenttype = $xdoc.getxWikiClass().get('code').getPropertyClass().getContentType())
  #if ($contenttype != "puretext")
    #set ($discard = $xdoc.getxWikiClass().get('code').getPropertyClass().setContentType('PureText'))
    #set ($discard = $xdoc.save('Update content type to pure text', true))
    * $wiki - $contenttype - Modified to 'puretext'
  #else
    * $wiki - $contenttype - OK
  #end
#end
{{/velocity}}

Prerequisites & Installation Instructions

Copy the code snippet to a page and save it.

Tags:
Created by Vincent Massol on 2019/02/28 13:49
     

Get Connected