UserFrosting
UserFrosting copied to clipboard
Possibly replace CheckEnvironment with a nimbler set of exceptions and handlers
As we discussed in #dev, we should consider replacing the monolithic CheckEnvironment
with appropriate exceptions and exception handlers in the portions of the code where they are relevant. For example, the check to see if cache/
is writable could happen the first time something actually tries to write to that directory (so, maybe the locator service could do this check and throw the exception).
This would also allow us to preserve the easy toggling between "dev" mode (sending errors to the response) and "production" mode (sending errors to a log and showing the client a generic message).
Can we list on the first post what needs to be done so it's easier to plan / split?
I agree with @lcharette, should make it much easier to keep track of progress on this.
Also sounds like an opportunity to use GitHub tasks.
- [ ] Task name
- [ ] Task name
FYI, while most check will be made by the CLI in 4.1
, detecting the presence of apache mod rewrite will still need to be done by the core code since apache is not involved in the CLI, therefore the function used to detect mod_rewrite
won't be useful in the cli environment.
Same goes for folder permission apparently. Checking them via the CLI will return the permission of the user running the cli command, which might be different from the apache user. And using exec
trick or looking at the chmod
value doesn't seems reliable enough.
Whatever solution is landed on, it needs to support Nginx and IIS as well. Might be an idea to have specialised classes for each web server. Such an approach might make it possible to eliminate the need for checkenvironment, provided the CLI tools are decent for Apache and Nginx. (I know IIS is already fully controllable via CLI).
Do we still need a single page with all the checks? Or could we move to a one exception at a time solution?
For example, Apache and permission fails. Right now both would be displayed on the same page. Do we need to do that, or could be display Apache exception, then, when it's fixed, display the permission exception?
I feel like that Apache check could be converted to a behaviour driven test. Something that would work with more than just Apache.
At the same time it would be more useful to tell the (new) dev "you need mod rewrite" than "This don't work. It may be mod_rewrite, or ISS thing, or nginx thing"
True, but we can always strike a balance.
CheckEnvrionement is gone in UF5 :)