feat(app-framework): Add support for global middlewares
This allows apps to register middlewares that always register, not just
for the app's own requests
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
perf(app-framework): Make the app middleware registration lazy
Before this patch, app middlewares were registered on the dispatcher for
every app loaded in a Nextcloud process. With the patch, only
middlewares belonging to the same app of a dispatcher instance are
loaded.
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
- per design, all enabled apps have their registration run
- limitations, e.g. enabled by group, are not considered in that state,
because we do not have a session (and might need apps?)
- before instantiation of widget it has to be checked whether the providing
app is actually enabled for the logged in user.
- a public interface is being changed, but it is not meant to be
implemented or used outside of the core handling. Therefore save to
backport.
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Harden bootstrap context registrations when apps are missing
It's not expected that an app would be unavailable when the app
container is created but when services are registered, but Sentry tells
me on Nextcloud 21 there is an edge case where this can happen.
Therefore this patch hardens the code a bit to log a meaningful error
message and skipping the next code instead of logging a php notice for
the undefined index and an exception for calling a method on null.
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
During app installation we run migration steps. Those steps may use
services the app registers or classes from composer. Hence we have to
make sure the app runs through the registration.
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
* Keep the registration context
* Expose the context object for other components
* Ensure registration is only run once
Search providers are migrated for demonstration.
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>