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

Installing or upgrading an extension fails when an extension is still registered on a wiki that no longer exists

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • 17.10.10
    • Extension
    • None
    • Unknown

    Description

      Steps to reproduce

      1. Have an extension (e.g. the XWiki Standard flavor) installed on a sub-wiki foo
      2. 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
      3. 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:

      org.xwiki.extension.UninstallException: Uninstall of extension [org.xwiki.platform:xwiki-platform-distribution-flavor-tour/17.10.10] is not allowed
      Caused by: org.xwiki.security.authorization.AccessDeniedException: Access denied when checking [admin] access to [Wiki foo] for user [xwiki:XWiki.Admin]
      Caused by: org.xwiki.security.authorization.AuthorizationException: Could not retrieve the document to check security access when checking access to [foo:XWiki.XWikiPreferences]
      Caused by: com.xpn.xwiki.XWikiException: Error number 2 in 0: No wiki with id [foo] could be found
      

      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

      Attachments

        Activity

          People

            Unassigned Unassigned
            vmassol Vincent Massol
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: