## Utilities: moosh

Maintained by Tomasz Muras
Moosh stands for MOOdle SHell. It is a commandline tool that will allow you to perform most common Moodle tasks. It's inspired by Drush - a similar tool for Drupal.
309
11
Moodle 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9

Moosh is a tool that exposes some common Moodle functionality to the commandline.

You install moosh outside of the Moodle directory, it can be anywhere really. Then simply make moosh.php (or symlink named like moosh) available somewhere in $PATH. To run moosh, change the directory into your installed Moodle's instance and run one of the commands. To get the list of all available commands only run moosh.php (or just moosh if you've symlinked it like this) or read the documentation and examples. Moosh is meant to work nicely with Linux features like bash/zsh expansion. For example, to create 10 users, you just type: % moosh user-create username{1..10} ### Screenshots ### Contributors Tomasz Muras (Lead maintainer) Please login to view contributors details and/or to contact them ### Awards ### Comments Show comments • Wed, Jul 10, 2013, 11:23 PM Hi Aaricia, I've actually heard of people running it under Windows. I'm simply not testing it under Windows at all and building it with Linux in mind, however there is nothing major that should stop it working under Windows - did you actually try it? You should simply test it under your windows environment and send me any fixes/patches required to make it work there (if necessary). • Tue, Sep 24, 2013, 4:00 AM YOU RULE! • Tue, Sep 24, 2013, 5:43 AM this is a great extension Thomasz, do you think it would be possible to extend the course section with the import from course functionality? That way its super easy to clone a course, without having to make a backup and restore. (alternatively course_clone would be even more awesome!) • Fri, Feb 28, 2014, 8:02 PM It only seems to work when logged in as root. I assume I am missing some permissions. The command runs but doesn't find any commands. What are the permissions for 'moosh'? • Sun, Jun 8, 2014, 11:36 PM I'm a big fan of Drush great to have something similar for Moodle. One question though - how to run the unit tests? Grepped the commands list for 'test' and 'unit' but can't spot anything. I've tried running tests/run-tests.php directly but I get an error about a missing file when run in the tests directory and a failed include when run from the Moosh root. I'm probably missing something obvious but a pointer would be greatly appreciated as I'd like to add a couple of tests for some additions I've made. Cheers • Thu, Aug 28, 2014, 10:42 PM Great plugin for developers and testers. It would be nice to have a command set for cloning and renaming existing plugins. What do you think? • Mon, Apr 20, 2015, 11:22 PM I am happy to announce that moosh just received our Featured Moodle plugin award. Read the interview with the maintainer at the Plugins traffic blog post. Well done Tomek, and thanks for your work on this! • Thu, May 21, 2015, 4:21 PM Good morning I have been tested this utility and the truth that is a breakthrough because it allows you to facilitate the use of the most common tasks you want to perform on moodle without having to be entering the platform. This utility basically I'm using for backup and restoration courses thereof. After several tests, when performing certain restorations of certain courses, the course moosh-restore process gives me the following error message and will stop. I generated the course but not the content of the course: [root@xxxx]# moosh course-restore LOPD.mbz 2 Restoring (new course id,shortname,destination category): 19,LOPD_3,2 Default exception handler: error/restore_not_executable_awaiting_required Debug: Error code: restore_not_executable_awaiting_required$a contents: 600
* line 164 of /backup/util/plan/restore_plan.class.php: restore_controller_exception thrown
* line 333 of /backup/controller/restore_controller.class.php: call to restore_plan->execute()
* line 150 of /root/actualizaMoodle/moosh/Moosh/Command/Moodle23/Course/CourseRestore.php: call to restore_controller->execute_plan()
* line 243 of /root/actualizaMoodle/moosh/moosh.php: call to Moosh\Command\Moodle23\Course\CourseRestore->execute()

!!! error/restore_not_executable_awaiting_required !!!

Why do I get this error for some restorations and to other restorations goes perfectly well?

Regards and congratulations for this plugin!!!!
• Thu, Sep 10, 2015, 6:26 PM
Hello
I installed moosh in version 0.19 which is the current release of moosh at the time of this comment. When I start moosh I get an error message saying that moosh.php is not able to load the required file "vendor/autoload.php" in the moosh installation directory. Indeed there is no file available with this name in the vendor subdirectory. In my older moosh installation (version 0.18) this file, and serveral others including further subdirectories, is available. Any idea how I can solve this?
Andreas

• Fri, Sep 11, 2015, 7:35 PM
Hi Andreas,

Something went wrong when I was doing 0.19 release. I'll need to do another one that fixes it, I suggest you use 0.18 until that happens (in about 1 week).

Thanks for reporting it,
Tomek
• Fri, Feb 19, 2016, 4:29 PM
Hi... This plugin seems amazing! Any plans to have it available for Moodle 3.0?
• Thu, Mar 24, 2016, 5:29 PM
Hi, I'm looking for a way to do mass backup/reset/restore, but looks like the current version doesn't support those. Do you have any plan to get that to work for 2.7+ ?
• Sat, Mar 26, 2016, 4:26 AM
Chris - most of the commands should just work with Moodle 3.0 - if any does not, report it on github.
Francis - those are already supported. For example course backup: http://moosh-online.com/commands/#course-backup :
to backup several coursed based on id, you combine moosh with a bit of bash, for example backup courses with IDs 1,2,3...100:
for c in $(seq 1 100) do moosh course-backup$i
done
• Wed, Mar 30, 2016, 5:45 PM
Thank you Thomas, I was basing myself on the red Xs from your site ( http://moosh-online.com/ci/ ). I will report some issues on github them. Great job so far !
• Wed, May 25, 2016, 9:30 PM
I hope it can run on PHP 7.