CLI
We already encountered the CLI selectively throughout the book and during Chapter 1, Installing Moodle, when we dealt with Moodle upgrades. However, the CLI has a few more tricks up its sleeve, which we will deal with in this section.
First, let’s look at how you call CLI scripts, which are either located in admin/cli/*
or in the sub-folder of plugins that offer a CLI option – for example, auth/ldap/cli
. To call a CLI script, follow the following notation:
sudo –u <apache_user> /usr/bin/php admin/cli/<script>.php [--params]
Your <apache_user>
is usually www-data
, httpd
, or apache
.
Important note
Always run Moodle CLI scripts under the identity of the web server user.
Every CLI script has a --help
parameter that offers additional information and also describes calling options and parameters. The following is a list of some useful CLI commands and chapter numbers in which they have been covered. Look in their respective CLI...