Skip to content

PHP Shell

Mark Metcalfe edited this page Nov 18, 2021 · 2 revisions

Aliases

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/sh into it. This is useful for when you need to run complex commands often during development, such as initialising tests.

By default, there is a totara-aliases.sh file that has 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
  • installunit - initialises PHPUnit
  • unit - runs PHPUnit
  • installbehat - runs a helper script for installing Behat
  • behat - runs a helper script for running Behat
  • behatlogs - outputs the behat error logs from the last run
  • createcourse - creates a course
  • createuser - create user(s)
  • config_var - extract a $CFG variable from the site config.php. For example, you can go cd $(config_var dataroot), which will take you to the dataroot folder.

Feel free to add your own .sh/.bash 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.

Oh My Zsh

For the PHP containers, the Oh My Zsh extention is used on top of zsh.

Note that you will need to set your terminal's font to use one of the fonts from this repo in order for some icons to correctly display.

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.