Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-9159

XWikiContext#getWikiServer() is deprecated without any replacement and does not work on subwikis anymore

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Blocker
    • 4.5.4, 5.0.2, 5.1-milestone-1
    • 4.5.2, 5.0-milestone-2, 5.0.1
    • Old Core
    • None
    • Unknown
    • N/A
    • N/A

    Description

      The document returned by XWikiContext#getWikiServer() must came from the main wiki, and currently came from the subwiki, which is a serious regression.
      Moreover, the method is marked deprecated, and I do not see a replacement. The comment says the following which has absolutely not the same usage:

      @deprecated use {@link XWiki#getWikiOwner(String, XWikiContext)} instead
      

      My current (lengthy) workaround in velocity is:

      #set( $serverDoc = $xwiki.getDocument("xwiki:${context.Context.getWikiServer().fullName}").getDocument() )
      

      Attachments

        Issue Links

          Activity

            People

              tmortagne Thomas Mortagne
              softec Denis Gervalle
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: