Make easier to install old plugins as extension

Hi devs,

We always refrained from touching the old plugin system since we want to get rid of it. But one change that would actually help a lot removing plugins is to make them easy to install as extensions.

Right now, when you install a plugin as extension you have two problems:

  • plugins are loaded at startup
  • and more importantly, only plugins listed in the very static xwiki.cfg file are loaded

So I propose to introduce a component entry point to allow some plugins to be found by the plugin manager even when not listed in xwiki.cfg and so that the plugin manager can react to the component registration/unregistration events to update the list.

I honestly don’t feel we need to come up with any configuration to be able to disable such dynamically registered plugins. I don’t think it’s a real need (we did not feel that need most types of components and I don’t see why this legacy feature would really need that, the main reason why there is a configurable list is that it’s a system dating for before we have any kind of dynamic way to register components). But if some people strongly believe with need one, something like a xwiki.plugins.disabled in xwiki.cfg (for consistency with the current xwiki.plugins property) should do.

WDYT ?

Thx Thomas.

One other idea: why not use AI to rewrite the few plugins we have and turn them into components, and then deprecate the plugin system and move it legacy?

I believe it could be done very easily and quickly.

I’d rather we stop working on this old technology and put it behind us and keep it free from our codebase.

WDYT?

This is a very different subject. We obviously need to move what we have in those plugins in proper locations (script services mainly, but also some other types of components), but the old plugins are still API that may be used and what you propose does not really help in any way with the retro compatibility aspect (the new script service would have completely different entry points and I doubt we would want to keep the exact same methods etc when migrating those features anyway). My proposal is what’s missing to be able to do what you are proposing without breaking anything (i.e. allow an admin to easily install a removed plugin if needed).

Ok, I agree the 2 proposals are orthogonal. If yours is quick to do, fine with me, as long as it’s written so that the plugin handling part can easily be moved to legacy later on (e.g. the new component entry point and the code reacting to its registration/unregistration events kept separate from the rest of oldcore, so that they can move to legacy together with the plugin manager).

I still think we should move faster on rewriting the plugins we have:

  • For the core plugins (skinx, fileupload, image, scheduler, etc.), we need the replacement anyway, so that we can then move to legacy not only the plugins but also the plugin manager and the plugin APIs (XWikiPluginInterface, XWikiDefaultPlugin, XWiki#getPlugin*, the $xwiki.xxx resolution, etc.). The old plugin APIs would keep working from the legacy modules, so no retro compatibility issue.
  • The main missing piece is not the plugin rewrite itself but the extension points that oldcore currently provides only to plugins: end of parsing (used by skinx to inject CSS/JS), attachment download (image resizing, zipexplorer), wiki init, and end of request (fileupload). We need to add events/components for these.
  • For non-core plugins, removing them from the XS distribution is already possible today: admins who need one can add it back to their xwiki.cfg.

I had a quick look: we have 13 plugins in platform (counting the 7 skinx ones as 1). About half are easy (mailsender is already replaced by the Mail API, jodatime, monitor, zipexplorer, tag), the hard ones being skinx, fileupload, image and scheduler, because of the hooks mentioned above. With strong AI assistance, I’d estimate the whole thing at 2-3 weeks of work, most of it for the hard ones (designing the new extension points, reviewing, and making sure the old APIs still work).

WDYT?

Thanks

PS: This post was co-written with Claude Code.

+1

Fine with me, and I guess adding such mechanism is not too difficult if we identify an actually need for it.

Again, I’m obviously not against migrating old plugins, but this discussion does not really have anything to do in this thread.

+1. I agree we don’t need a configuration option to disable installed plugins. You can uninstall them.

Thanks,
Marius

+1 as well.

+1, maybe we should make it clear/a best practice though that we shouldn’t use this new approach for plugins that cannot be uninstalled.

I hesitated to suggest that in the initial proposal, but I don’t think it’s really required for plugins which don’t really do anything if nobody call them (I don’t see many people requesting ways to disabled script services, which is a very similar use case for most plugins).

At first sight, they seem orthogonal but they’re not:

  1. I really don’t see the need to make it easier to install old plugins. Where did you get this need from? It’s rare and configuring them statically in xwiki.cfg is far from enough IMO.
  2. The 2 ideas do collide in the sense that they both need some dev time, so if you spend, say 2 says on implementing this feature then it’s 2 days not spent converting the existing plugins.

As I said, I won’t oppose it (say I’m +0 if it’s easy to do) but I don’t understand why everyone thinks it’s a good idea when there’s no expressed need that I can see (the thread doesn’t mention any need at least - over manual config). I see it as over-engineering and it’ll put more code in core that we’ll then need to remove when we legacify the plugin system. I’d rather we spend 1-2 days to introduce the Listener Events that are missing to convert the plugins. Then the conversion would take a couple of days IMO. For any external plugin not converted, it’s not like users would be blocked, they would simply continue to use the xwiki.cfg way to add/remove plugins.

Anyway, it seems I’m the only one thinking this so I’ll accept that I’m wrong :slight_smile:

Thx

Indeed, so we could also move all plugins to use the new mechanism which would reduce the work for admins when we move them to optional extensions one by one later (it would eliminate the need to update the list in xwiki.cfg on every update that moves one).

Yes, while implementing this new system I was planning to check if we could do that (i.e. if there would be any plugin for which being able to disable it would still be needed) and send another proposal for that.