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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 4.5.2, 5.0-milestone-2, 5.0.1
    • Fix Version/s: 4.5.4, 5.0.2, 5.1-milestone-1
    • Component/s: Old Core
    • Labels:
      None
    • Difficulty:
      Unknown
    • Documentation:
      N/A
    • Documentation in Release Notes:
      N/A
    • Similar issues:

      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

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Date of First Response: