Skip to content
Frédéric Massart edited this page Mar 20, 2014 · 1 revision

Here are some typical workflows. Keep in mind that any command followed by --help will give you more information on what can be done with it.

Creating a new instance

mdk create --version 26 --install --engine pgsql --run dev
  1. create --version 26 will clone a new instance of the latest Moodle 2.6
  2. --install will run the installation script
  3. --engine pgsql tells the installer to use PostgreSQL as the DB engine (does not work without --install)
  4. --run dev will execute the script dev after installing the instance

Fixing an issue

mdk fix 12345
... commit your work ...
mdk push --update-tracker
  1. fix creates a branch from the latest stable version
  2. push --update-tracker pushes the branch to github, and updates the tracker issue

Backporting a patch

... from the branch you want to backport ...
mdk backport --versions 25 26 --push --update-tracker
  1. Backports the patch to the versions 2.5 and 2.6
  2. --push pushes the branch to github
  3. --update-tracker updates the tracker issue

Updating your Moodle instances

mdk update --all --upgrade
  1. update will checkout the stable branch (master, MOODLE_26_STABLE, ...)
  2. --all specifies to work on all the instances
  3. --upgrade will also run the upgrade process after a successful update

Purge the cache

mdk purge

  1. Purges the cache

Re-installing an instance

mdk uninstall
mdk install
  1. uninstall will drop the database and the content of dataroot
  2. install runs the installer with the default settings

Enable development settings

mdk run dev
  1. Runs the script dev which sets up most settings developers are interested in

Create some default users

mdk run users
  1. Runs the script users which creates some potential students, teachers and managers (s1 to s10, t1 to t3, and m1 to m3)

Enrol users in all the courses

mdk run enrol
  1. Runs the script enrol which enrols, in all courses, the users starting with an s as students, a t as teachers and m as managers

Compile LESS

mdk css --compile
  1. Compiles the .less files of theme/bootstrapbase

Testing a patch from the tracker

mdk pull --testing 12345
  1. Creates a branch named MDL-12345-master-test from the latest stable
  2. Pulls the patch from the tracker issue MDL-12345

Run the Unit Tests

mdk phpunit --run
  1. phpunit sets up various settings and installs PHPUnit from composer
  2. --run will run the entire test suite

Run the Behat tests

mdk behat --run --disable
  1. behat sets up various settings and installs Behat from composer
  2. --run will run the entire test suite
  3. --disable will disable Behat after running the tests (no longer required from 2.7)