RFC Feature PR-5.2-dev Pending

User tests: Successful: Unsuccessful:

avatar Fedik
Fedik
12 May 2024

Summary of Changes

This is concept of loading the plugins on demand.
The idea (not new) is to instantiate the plugin only when the event is triggered, thus reduce App initialisation and execution in general. This can be achieved for plugins that implements SubscriberInterface.

The PR contains an examples based on: LanguageFilter, Debug and GuidedTours plugins.

It works as folowing:
PluginHelper::importPlugin() reading the plugin event with getSubscribedEvents(), and creates a clousore for each.
When the event is triggered the closure is looking for the plugin instance, and executes the event method.

Instead of use $app->bootPlugin() it introduce $app->getPluginContainer(), which allows to retrieve the plugin information without booting it in first place.

New options for plugin service:

  • plugin.information Define the plugin class name, and implemented interfaces. This is important to be able to get the class name without booting whole plugin. (Should be probably some kind of configurable class, that can read this information from XML automaticaly, or set by developer. Need to discuss, please share your ideas)
  • plugin.executeValidation Validate if the plugin should be executed in current runtime. This solves long standing problem, when we have to run $app->isClinet('potato') in many events. (Should probably also be some kind of configurable class. Need to discuss, please share your ideas)

The PR uses a simple arrays for new options, however it is only for purpuse of demonstration. Some of these things need to be updated to to proper Class/Interface.

impact on existing plugins:

Zero, Null, Nulo, no backward compatibility break. All existing plugins will work as before.

Testing Instructions

The PR can be merged without testing.

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:
  • No documentation changes for docs.joomla.org needed
  • Pull Request link for manual.joomla.org: TBD
  • No documentation changes for manual.joomla.org needed

Please share your opinions ?

avatar Fedik Fedik - open - 12 May 2024
avatar Fedik Fedik - change - 12 May 2024
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 12 May 2024
Category Libraries Front End Plugins
avatar Fedik Fedik - change - 12 May 2024
The description was changed
avatar Fedik Fedik - edited - 12 May 2024
avatar Fedik Fedik - change - 12 May 2024
The description was changed
avatar Fedik Fedik - edited - 12 May 2024
89197ea 12 May 2024 avatar Fedik phpcs
avatar Fedik Fedik - change - 12 May 2024
Labels Added: RFC Feature PR-5.2-dev
b1442b0 30 May 2024 avatar Fedik kick
avatar Fedik Fedik - change - 15 Jun 2024
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2024-06-15 11:24:31
Closed_By Fedik
avatar Fedik Fedik - close - 15 Jun 2024

Add a Comment

Login with GitHub to post a comment