Open connorshea opened 5 years ago
A few comments on things you asked on Gitter, and some additional considerations...
Before using any permissions code, please tell me about which code you want to use; much of it is not good code at all, and I'd like to avoid the bad parts.
About the phpinfo - I am interested in making sure the Diagnostics have a good sense of whether they're running from CLI or from web server, and it would be great if they could give us information about the other side also (not the one where they're running).
2a. To get web server info from CLI, you could make an entry-point that you can call with curl
and gives you the phpinfo
output, but it would require some security mechanism to ensure it's not being called by some anonymous hacker from somewhere. (For example: generate a random Key and write it to tmp
dir or database; send it as a parameter into the web entry-point; wait 20 seconds and delete the key. This way the entry-point can check it has a valid code before replying).
2b. In the opposite direction, diagnostics running from web server could call exec
to run a PHP CLI script (could be the Robo task directly), in the servers where that is allowed.
Have you used PHP's ini_get
function? With it you could retrieve specific php.ini
items witouth any screen-scraping.
It would be important to retrieve date.timezone
information.
We should keep stuff that identifies the installation in a separate section, so that users can remove it when pasting stuff online to get help in Forums. Things like site_url
and host_name
from config.php
As the information collected grows, I'm thinking we might want two separate versions of Diagnostics: short and long. I plan to use this task to ask people for reliable information when answering Forum threads, and I don't think I will always need a huge endless list of stuff.
We should have a task for printing diagnostics:
./vendor/bin/robo diagnostics
It'd be useful for debugging problems people have on the forums and on GitHub issues.
It should:
composer validate
doesn't return errorscomposer diagnose
doesn't return errorscomposer check-platform-reqs
doesn't return errorsI'm guessing it'd look similar to this:
It might help to use the code in this comment (or find a package that does this for us) to determine some of this info: https://www.php.net/manual/en/function.phpinfo.php#117961
We could also have a
--debug
flag that'd display the diagnostic command output even if the command was successful (we can't use--verbose
because Robo already has that).We should just get a working Robo task developed first, we don't need to cover all of these from the start. Most of these are aspirational :P
cc: @pgorod