User tests: Successful: Unsuccessful:
This is an idea about what we can do to prevent plugin from booting, when it will not be in use.
Example, when plugin designed to work only for Site or only for Administrator.
When the plugin should not be loaded, the service/provider should return a plugin placeholder.
We already have a class for it called DummyPlugin, so it is not a new feature.
What do you think about it?
Apply patch, and check the modified plugins, they should work as before.
For advanced users: dump $dispatcher, to make sure the plugin not loaded when they should not.
Please select:
Category | ⇒ | Libraries Front End Plugins |
Status | New | ⇒ | Pending |
we still have the plugin in our dispatcher
Nope, it not there, check it ;)
If you do
dump($dispatcher->getListeners());
You will see that dump()
does not contain Dummy Plugins.
can't we really just not load it?
We could return false
for $app->bootPlugin()
but intrface require to return PluginInterface
.
or only load it when it is really triggered based on getEventListners?
First I thought it is a good idea, now after looking around, I think this will not help much.
You see, we still need to query all plugins from DB, and then check them on each Event trigger, whether they are booted or not.
This require rewriting our dispatcher, or have an extra abstraction on top of existing dispatcher, that complicates the logic.
I call this: much hassle, small profit :)
This PR just an idea, that already can work without much investment.
I am not insist on it, maybe we can find some better solution.
Addittionaly I would disable onBeforeExtensionBoot
and onAfterExtensionBoot
events for Plugins. But that another topic.
Thanks for caring about this issue. The big problem with this approach is that service providers should not contain any logic. Their job is just to provide the services. The logic should be somewhere else. I mean we have a client flag in the db record, perhaps you can use that one much earlier in the life cycle.
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2023-05-26 06:53:17 |
Closed_By | ⇒ | Fedik | |
Labels |
Added:
PR-5.0-dev
|
I don't like it much, we still have the plugin in our dispatcher, can't we really just not load it? or only load it when it is really triggered based on getEventListners?