moosh

Utilities
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.
Latest release:
1k downloads
65 fans
Current versions available: 2

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

Screenshot #0

Contributors

Tomasz Muras (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments RSS

Comments

  • 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
  • Chris Schembri Baldacchino's Pic
    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.
  • Fri, Aug 5, 2016, 3:14 AM
    Yes, it does run with PHP7:

    vagrant@vagrant:~/moosh$ php --version
    PHP 7.0.8-0ubuntu0.16.04.2 (cli) ( NTS )
    Copyright (c) 1997-2016 The PHP Group
    Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.8-0ubuntu0.16.04.2, Copyright (c) 1999-2016, by Zend Technologies

    vagrant@vagrant:~/moosh$ ./moosh.php
    moosh version 0.21
    No command provided, possible commands:
    category-export
    ...
  • Mon, Aug 22, 2016, 8:00 PM
    Hi,
    I'm getting an error when I'm using user-delete:

    PHP Fatal error: Call to undefined function get_sorted_course_formats() in /moodleapp/course/format/lib.php on line 103

    it eventually works after a couple of tries and the user is deleted.
    I've tried upgrading to the latest moosh version but still getting the same error, tried on Moodle 2.8/2.9 and both give same error
  • Fri, May 26, 2017, 7:22 PM
    Hi,
    Is it possible backup and restore an activity using moosh?
    Thanks
  • Sat, May 27, 2017, 4:38 AM
    At the moment the only backup implemented is backup::TYPE_1COURSE (whole course) in course-backup command.
  • Mon, Jul 31, 2017, 7:20 PM
    Hi,
    Is it possible delete multiple users filtering by role? (moosh user-delete)
    Thank's in advance
Please login to post comments