Steps to reproduce
- Have an extension (e.g. the XWiki Standard flavor) installed on a sub-wiki foo
- Make the foo wiki disappear without going through the wiki deletion UI (e.g. restore an older database backup that doesn't contain it, or drop its database schema), so that WikiDeletedEvent is never sent
- Install or upgrade an extension whose install plan needs to replace a version installed on wiki:foo (e.g. upgrade the flavor on the main wiki)
Result The install fails with:
The extension stays registered on wiki:foo in the installed extension repository (permanent directory), and there is no way from the UI to get rid of that registration: every attempt goes through the same right check on the missing wiki. The only workaround is a script calling InstalledExtensionRepository#uninstallExtension(extension, "wiki:foo") (or editing the .xed files by hand). Expected A namespace pointing to a wiki that doesn't exist anymore should not block install/upgrade/uninstall operations. Possible approaches:
- in AbstractExtensionValidator, don't fail the right check (or skip it) when the namespace is a wiki that doesn't exist
- and/or detect and clean up namespaces of non-existing wikis (at startup or from the Distribution Wizard), doing what WikiEventListener#onWikiDeleted does on a normal wiki deletion
Reported on the forum: https://forum.xwiki.org/t/multiple-versions-of-extension-after-upgrade/18781 |