Check Moodle Environment via CLI

No GUI to the moodle and need to check the environment to see if the server meets specs?   No problem now … with a shared .php file in admin/cli/ one can check the environment and it will tell what needs updating etc.

Since the cli script is not in official Moodle releases
a git pull for an update or even an upgrade to moodle
should cause a git error … complaining about a file it doesn’t know about.
That’s a good thing … but how to get around it?

Now to figure out how to tell git to ingnore.
https://help.github.com/articles/ignoring-files/

Me thinks .gitignore best ..

https://github.com/github/gitignore

at the root of the moodle code diretory.
There should already be a .gitignore so just add a line ** see below

If there isn’t a .gitignore create one:

touch .gitignore

Then edit .gitignore with a text editor … nano used in example:

nano .gitignore

add one line:

./admin/cli/envcheck.php

Save the .gitignore file

Now when doing git pulls or upgrades git won’t complain! 🙂

The code .. contributed by Howard in Moodle forums
https://moodle.org/mod/forum/discuss.php?d=379601#p1530402