-
Notifications
You must be signed in to change notification settings - Fork 40
PHP Shell
The shell folder lets you add custom aliases and functions to your php containers.
Any file with the .sh extension will be sourced into your php container whenever you bash/zsh into it.
This is useful for when you need to run complex commands often during development, such as initialising tests.
By default, there are aliases in the shell/ directory that have a few helpers to get you started. They are:
-
install- installs a fresh instance of Totara -
upgrade- upgrades an existing site -
cron- runs cron -
purge- purges the site caches -
install_phpunit- initialises PHPUnit -
phpunit- runs PHPUnit -
phpunit_pcov- runs PHPUnit with code coverage -
install_behat- runs a helper script for installing Behat -
behat- runs a helper script for running Behat -
behat_logs- outputs the behat error logs from the last run -
create_course- creates a course -
create_courses- creates a specific number of courses - e.g.create_course 20 -
create_user- create user(s) -
config_var- extract a$CFGvariable from the site config.php. For example, you can gocd $(config_var dataroot), which will take you to the dataroot folder. -
totara_version- gets the current Totara (or Moodle) version. Can also usetotara_version majorto get just the major version. This can be useful for writing conditional logic in custom scripts.
Feel free to add your own .sh files into the shell directory.
Note that the aliases listed above must be run inside the PHP docker containers at the root of your Totara site directory, or via tphp - e.g. tphp install
For the PHP containers, the Oh My Zsh extention is used on top of zsh.
Oh My Zsh is highly configurable - see shell/.zshrc for the current configuration and check out the ohmyzsh and powerline10k docs for more ideas on what is possible.
Copyright (c) 2025 Totara Learning Solutions Limited