How can my Extension know if XWiki supports Nested Spaces?

Last modified by Vincent Massol on 2016/02/22

Imagine that you're writing an Extension and that you wish that it supports both an XWiki version prior to Nested Spaces and one after Nested Spaces.

You could check if the current XWiki version supports Nested Spaces by using from Velocity:

  • With XWiki 8.0M2+:
    #set ($supportsNS = $services.extension.core.getCoreExtension('org.xwiki.platform:xwiki-platform-model').id.version.compareTo('7.2') >= 0)
    #if ($supportsNS)
      ...
    #else
      ...
    #end
  • Before XWiki 8.0M2:
    #set ($supportsNS = $services.extension.core.getCoreExtension('org.xwiki.platform:xwiki-platform-model').id.version.compareTo($services.extension.parseVersion('7.2')) >= 0)
    #if ($supportsNS)
      ...
    #else
      ...
    #end
Tags:
Created by Vincent Massol on 2016/02/09
   

Get Connected