UserFrosting icon indicating copy to clipboard operation
UserFrosting copied to clipboard

Possibly replace CheckEnvironment with a nimbler set of exceptions and handlers

Open alexweissman opened this issue 8 years ago • 9 comments

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).

alexweissman avatar Feb 01 '17 16:02 alexweissman

Can we list on the first post what needs to be done so it's easier to plan / split?

lcharette avatar Feb 03 '17 03:02 lcharette

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

Silic0nS0ldier avatar Feb 03 '17 03:02 Silic0nS0ldier

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.

lcharette avatar May 14 '17 01:05 lcharette

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.

lcharette avatar May 14 '17 02:05 lcharette

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).

Silic0nS0ldier avatar May 14 '17 07:05 Silic0nS0ldier

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?

lcharette avatar Mar 26 '19 12:03 lcharette

I feel like that Apache check could be converted to a behaviour driven test. Something that would work with more than just Apache.

Silic0nS0ldier avatar Mar 26 '19 19:03 Silic0nS0ldier

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"

lcharette avatar Mar 26 '19 20:03 lcharette

True, but we can always strike a balance.

Silic0nS0ldier avatar Mar 26 '19 21:03 Silic0nS0ldier

CheckEnvrionement is gone in UF5 :)

lcharette avatar Nov 25 '23 02:11 lcharette