Moodle Plugins directory: moosh | Moodle.org
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:
2k downloads
107 fans
Moodle 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8
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}
Useful links
Contributors
Tomasz Muras (Lead maintainer)
Please login to view contributors details and/or to contact them
I need to copy a questionnaire in multiple courses. Through moosh I use the following instruction.
moosh -n activity-add --name "Enquesta Avaluació Assignatura" --section 1 --idnumber "45766" --name "Enquesta Àlex" questionnaire 3735 but this copy the questionnaire without the questions.
i see the documentation and i don't know we happend.
regards
alex
Firstly, let me say what an excellent tool moosh is. We have used it extensively in v3.9.1, and it has been invaluable.
Is there going to be a 3.10.2 version soon? We are testing an upgrade annd when I run moosh, I get this error message
Fatal error: Uncaught Exception: Unable to determine branch version from 'C:\inetpub\mapleroot/version.php' in C:\Users\bhaji\moosh\includes\functions.php:147
Stack trace:
#0 C:\Users\bhaji\moosh\moosh.php(74): moosh_moodle_version()
#1 {main}
thrown in C:\Users\bhaji\moosh\includes\functions.php on line 147
We're on Windows (sorry about that) running php v7.4
"sudo -u www-data moosh db-stats" gives me:
"Default exception handler: Erro ao ler a base de dados Debug: ERROR: syntax error at or near "'table'"
LINE 1: SELECT table_name AS 'table',
^
SELECT table_name AS 'table',
ROUND(((data_length + index_length))) AS 'size'
FROM information_schema.TABLES
WHERE table_schema = 'db_ava_nead'
ORDER BY (data_length + index_length) DESC
-- line 25 of /usr/share/moosh/Moosh/Command/Moodle39/Report/DbStats.php: call to pgsql_native_moodle_database->get_records_sql()
[array (
)]
Error code: dmlreadexception
* line 486 of /lib/dml/moodle_database.php: dml_read_exception thrown
* line 329 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()
* line 977 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
* line 25 of /usr/share/moosh/Moosh/Command/Moodle39/Report/DbStats.php: call to pgsql_native_moodle_database->get_records_sql()
* line 361 of /usr/bin/moosh: call to Moosh\Command\Moodle39\Report\DbStats->execute()
!!! Erro ao ler a base de dados !!!"
Moodle v3.11.4+"
PostgreSQL 12
PHP 7.4
Ubuntu 20.04
Ricardo
Moosh has a command for enroll cohort "my cohort18" to course id 4:
moosh cohort-enrol -c 4 "my cohort18"
But Moosh does not have a similar command for enroll students via the course meta link.
Can you add a command
moosh meta-enrol -c 4 18
for enroll in course id 4 students enrolled in course id 18?
Thank you!
I've recently upgraded to Moodle 4.0 and tried to use moosh to reset some courses. I did it one year ago and worked fine (Moodle 3.X).
But now, it is not working.
Running command "moosh" is returning this error message:
"PHP Deprecated: Return type of GetOptionKit\OptionCollection::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /root/moosh/vendor/corneltek/getoptionkit/src/OptionCollection.php on line 196"
And running more complex comands results in a large list of similar errors.
Any idea on what is hapening?
Thanks for sharing your work, it is very useful this plugin to do less annonyng the daly admin routines.
Would be gladful a command to add course meta link, like Alexandre Scherbyna wrote:
>Moosh has a command for enroll cohort "my cohort18" to course id 4:
>moosh cohort-enrol -c 4 "my cohort18"
>But, Moosh does not have a similar command for enroll students via the course meta link.
>Can you add a command
>moosh meta-enrol -c 4 18
>for enroll in course id 4 students enrolled in course id 18?
>Thank you!
Thank you so much!
Thanks a lot Tomasz for this great plugin.
I tried to add some labels (lot of videos to include), but I couldn't get them to work neither on 3.10 or 4.0.4...
I created an issue in github if you go there sometimes.
Maybe someone else knows what to modify in the code to make them work.
https://github.com/tmuras/moosh/issues/419
Cheers
François
After running "moosh file-dbcheck" I got this message:
"List of files on disk but not in DB:
/www/moodledata/filedir/07/6e/076e13e06b13acb5c699372d23ed80f0a2549f2f
/www/moodledata/filedir/10/a8/10a8438cb752380396d8906caf615c8663c8a667
/www/moodledata/filedir/17/33/17334433c8ad5f34312005a9660f4831fe535d8f
/www/moodledata/filedir/25/4f/254fd46abbe9386ab25cd37f1b21011dcb81ac19
/www/moodledata/filedir/2a/66/2a6676e2f000e31c3948a9501ea67784b55d4846
/www/moodledata/filedir/4c/39/4c3942f1abfe8f7c6fb4923b772cf013082bcc33
/www/moodledata/filedir/79/d8/79d8291afbe116f1f346339152cadec7b56d0282
/www/moodledata/filedir/81/61/816131c0dbf2d0200314c9e77554dfc667b4a35c
/www/moodledata/filedir/91/a3/91a3ca800eff23d5b1aa1a02289483c42bc79fba
/www/moodledata/filedir/9b/4d/9b4d85ddefe9d5bd9f250fc3e0a1dbac2abfe19b
/www/moodledata/filedir/b1/f9/b1f99ef9ebd4231347bbf87a26b6ea17d498cee9
/www/moodledata/filedir/bc/cc/bccc8c81c01a9c0bdb6ffa9dce4657d406e5542f
/www/moodledata/filedir/be/da/beda8aba8c987d8c8cf1b7c438fcb11f97c00ea2
/www/moodledata/filedir/c8/d2/c8d2a54c355b1b54c463248a0f4a78541270cda4
/www/moodledata/filedir/cf/65/cf65e0d932cc06a5e6d2270d1975ab536a4f9910
/www/moodledata/filedir/d1/0b/d10be20ed4c53355966ba93746067f5d5c5afba7"
Is it safe to delete these files from disk?
Ricardo
My challenge is to modify existing courses section by adding new activity and Modify /Add Access restrictions (sets) on existing and/or new activity
moosh activity-add / activity-move will add and locate new activity
But I' m looking after any syntax allowing to import or set any activity 'Access Restrictions" set
Is that possible with Moosh ?
Thanks in advance
I have a question: I am working with version 3.11.7 of Moodle and version 1.3 of moosh and when trying to export the categories of my moodle it throws an error. Could it be because it is an old version of moosh? What version of moosh do you recommend for moodle 3.11.7? I want to export the current categories to take them to a new Moodle in version 4.1.7 and there I already have moosh 1.14
Thanks again
When i am trying to run moosh i get an error like 'Fatal error: Uncaught Error: Call to undefined function get_local_referer() in E:\laragon\www\myproject\lib\setuplib.php on line 575'
I have the latest version of moosh.
Do you have any solution?