Over the years I have seen a number of individual command line tools working with Moodle, providing non-web access to Moodle features to the server admin, however this plugin brings a suite of features into the open which should make server admins life a bit less painless.
So what am I on about?
There are a number of commands available in Moodle for command line already:
- Install Moodle
- Turn on/off Maintenance mode
- Upgrade Moodle
- Reset Admin Password
- MySQL Storage engine conversion
However that is about it, but there are a lot of tasks an admin may do that are only available through the web interface or a web service – that is until now.
The MOOSH plugin provides access a number of other admin features into the command line.Technically it is not a plugin, it is a standalone tool that works with Moodle to provide access to the Moodle features through command line.
What does it do?
Currently if you are an admin and you want to create a user in Moodle there are a number of ways:
- Log in as admin to the website and use the add user to add just one at a time
- Log in as admin to the website and use the Upload users from a spreadsheet
However, if you are used to using the command line to admin your servers there is now an alternative by just having the following commands:
To just create with default fields
moosh user-create testuser
This will return the userid of the created user. However, if you want to specify the fields rather than just a username you can be more direct –
moosh user-create --password pass --email johnS@example.com --city London --country UK --firstname John --lastname Smith testuser99
So that can be very useful.
Is it simple to install?
If you are not a the admin of your server this plugin is not for you anyhow as that is the level of access required to run it. Therefore the below assumes you are admin of your own Moodle server.
As this is a standalone tool it is very easy to install (and the instructions below are directly from the documentation).
Clone moosh github repository:
git clone firstname.lastname@example.org:tmuras/moosh.git
Link to a location that is set in your $PATH, eg:
ln -s $PWD/moosh/moosh.php ~/bin/moosh
sudo ln -s $PWD/moosh/moosh.php /usr/local/bin/moosh
It becomes just another command you can use, and you use it from within the Moodle directory you are adminning.
Is there documentation for it?
The documentation is on the Github site and in the zip which you download but hopefully we will see it on Moodle Docs soon. The documentation covers both installation and gives examples of each of the functions and how they are to be used.
Is it easy for the admin to use?
This is a server admin only feature and it is very easy to use. Just follow the documentation examples and it just works.
Currently the functions are:
- user-create (Create a user)
- user-mod (Modify an existing user)
- user-list (List user accounts)
- role-create (Create new role)
- role-delete (Delete role by ID or shortname.)
- course-create (Create a new course)
- course-enrol (Enrol user(s) into a course)
- sql-run (Run a custom sql query)
- config-get (Get config variable from config)
- config-set (Set config variable)
- config-plugins (Shows all plugins that have at least one entry in the config_plugins table)
- file-list (Search and list files from mdl_files table)
- file-delete (Delete Moodle files from DB and possibly move them to trash)
- file-path (Show full path in the filesystem to a Moodle file)
Does it do what it promises?
Yes. It is really a great start on filling out the features for command line management of Moodle. I am sure that once admins become aware of this, we will see a flurry of activity with people adding more features. I also foresee that the three file commands are going to be heavily used.
Stars: 4 out of 5 stars.
These reviews check out the plugin for usability not for security. If you are considering installing any module on your site you should also check that is secure and does not impact the server performance.