Deploying a flavor with custom XWikiPreferences

Hi everyone,

I have a project with a custom flavor which depends on the default subwiki flavor and on an extension which includes a customized XWikiPreferences. When creating a wiki with this flavor, the wiki creation job raises an error Collision found on object [wiki » XWiki » XWikiPreferences]. I’m wondering what’s the recommended way to deal with this scenario in XWiki 14.x.

I have considered several options:

  • Declare XWikiPreferences XAR type as customizable or as edit-nodelete-overwrite using the Extra XAR entry types extension: still getting the conflict error (and even if edit-nodelete-overwrite would work on first install, this is not the type we want for upgrades since the page can be customized).
  • Extension conflict setup: I enabled the extension conflict setup in my profile but the wiki creation job does not take this option into account → should we consider exposing the conflict resolution prompt on wiki creation just like when installing an extension from the extension manager? Note that even if we do this, in my scenario I would like to avoid any manual conflict resolution and to force the installation of the customized XWikiPreferences (or possibly other pages overriding the defaults with possible conflicts as well).
  • Two steps wiki provisioning: I considered deploying the wiki with an empty flavor and install the custom one in a second step via the Distribution Wizard, hence getting the conflict resolution prompts. This approach works, with the downside that it requires many more clicks and can be error prone (an admin may select initially the target flavor instead of leaving the wiki empty). In this scenario, despite configuring the conflict setup to “Ask what to do” in all cases, the customized XWikiPreferences is installed correctly without any conflict resolution question, I’m wondering why (while the wizard prompts a choice for XWiki.Notifications.Code.NotificationAdministration).
  • Create a custom XWikiDocumentMerger for XWikiPreferences as indicated here.
  • Create a listener on event WikiProvisionedEvent which would update programmatically the subwiki XWikiPreferences once deployed.

Any feedback or recommendation welcome,