[commits] [Wiki] created: Doc/Dev/Bootstrap
Ralf Lang (B1 Systems GmbH)
lang at b1-systems.de
Thu Apr 14 10:15:25 UTC 2022
rlang Thu, 14 Apr 2022 10:15:25 +0000
Created page: https://wiki.horde.org/Doc/Dev/Bootstrap
+ Bootstrapping an environment
Horde's registry and bootstrapping predates composer, composer
autoloader and most modern conventions. It is not helped by being
super flexible in almost every aspect.
Bootstrapping is the order in which (a necessary part of) the Horde
application environment is set up before actually running useful code.
The current process is hard to understand and reason about.
With modern standards and concepts, a basic service or app need not
carry around baggage from assumptions that may be entire irrelevant.
For example, the horde base app
++ H5/Classic
Not necessarily in that order. Even getting the order right is non-trivial.
- Calling the core from the page, service endpoint or CLI
- setting up preliminary autoloading
- Setting up some fundamental constants, including guessing some paths.
- Lots of chicken/egg things
- setting up a preliminary (opinionated) selection of Dependency
Injection keys for the Horde\Injector DI
- setting up all sorts of scary globals
- finding installed applications
- finding config for installed applications
- finding out if or if not snippets matching the current domain vhost
should be applied
- Setting up even more autoloading for the current app
- Setting up filesystem locations and web-visible paths (possibly
domains, too) for apps and the horde base app, themes, javascript,
templates ...
- Session handling, based on config
- determine if the current session is administrative or has a certain
permission
- Language handling
- Setting up fundamental services like auth, logging
- Everything happens live on request
++ Standalone/Web
Three stages:
+++ Early stage
- Web server calls entrypoint.
- Composer autoloader first. One load to rule them all.
- Feed the DI with the bare minimum for routing purposes. (Less is better)
- Load cached list of relevant apps/services that expose routes. If it
does not exist, assemble it.
- some primitive early error handling
+++ Routing stage
- Load routes
- Assemble request object
- match request with routes
- call stack associated with route
- Perform PSR7/15 dance
- handle route-not-found / default route
+++ Middleware/Controller stage
- authentication, if they want it
- permission handling, if they want it
- prefs handling, if they want it
- login to backing services, if they want it
- handle any errors
++ Modern/CLI
TBD
More information about the commits
mailing list