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

MandatoryDocumentInitializer#updateDocument() is not invoked on extension installation

    XMLWordPrintable

Details

    • Unknown
    • N/A
    • N/A

    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

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

              Dates

                Created:
                Updated:
                Resolved: