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

MandatoryDocumentInitializer#updateDocument() is not invoked on extension installation

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.4.4
    • Fix Version/s: 7.0-milestone-1, 6.4.1
    • Component/s: Extension
    • Labels:
      None
    • Difficulty:
      Unknown
    • Documentation:
      N/A
    • Documentation in Release Notes:
      N/A
    • Similar issues:

      Description

      When installing an extension, if it register MandatoryDocumentInitializer roles, their updateDocument() method should be called in each context (wiki) that the extension is installed in.

      Note, that due to an issue soon to be resolved (see XWIKI-10352) in Utils#getComponentList() which cause the root CM to be used instead of the context CM, it will not be called on restart either.

      The current workaround is the create a listener on ApplicationReadyEvent, WikiReadyEvent and ExtensionInstalledEvent to hook your own implementation of MandatoryDocumentInitializer#updateDocument(). Be careful to

      • check that your listener is registered in the current context, since it will be called for any context
      • use hashCode() to build the name of your listener, so its name is unique among all contexts (see XCOMMONS-213)

      I attach a zip with 1 interface and 2 classes, showing a reimplementation of MandatoryDocumentInitializer based on such a listener to helps

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: