about moosh

about moosh

by Larbi Baraka -
Number of replies: 25

hi all i hope y're ok so my probleme is how can i install moosh please help me

 

Average of ratings: -
In reply to Larbi Baraka

Re: about moosh

by Tomasz Muras -
Picture of Core developers Picture of Plugin developers Picture of Plugins guardians Picture of Translators

It is documented on http://moosh-online.com.

 

cheers,
Tomek

In reply to Tomasz Muras

Re: about moosh

by Alan Coats -

Okay but it does not mention using it on a Windows environment.

Can it be used on a Windows platform and if so how?

In reply to Alan Coats

Re: about moosh

by Tomasz Muras -
Picture of Core developers Picture of Plugin developers Picture of Plugins guardians Picture of Translators

Hi Alan,

I know that some people do use it on Windows platform. There is nothing special about the installation - you download the files, add path to your Moosh directory to %PATH% and you should be able to run it like any other windows commanline tool.

I do not use Windows for anything and develop and administer Moodle on Linux only, so I'm not in position to support moosh installation on Windows. I would, however accept patches that fix some Windows-specific issues.

cheers,
Tomek

In reply to Tomasz Muras

Re: about moosh

by vinoth kannan -

Hi Tomasz,

I tried to install Moosh in windows environment. I installed it on E:\Moosh then i added PATH as E:\Moosh. Then in command prompt i cd to moodle installed path and when i type moosh. It opens moosh.php file in notepad. How to make it work.
Thanks
Vinoth

In reply to vinoth kannan

Re: about moosh

by Alan Coats -

I don't use moosh however your problem is that .php are not associated with the php command line program but with notepad  When you installed php, did you select to install the command line option?  If not, then that is your problem.

In reply to Alan Coats

Re: about moosh

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

I got moosh working under windows yesterday. Because .php files were not associated with php.exe I wrote a small batch file to play with it

php c:\xampp\moosh\moosh.php %1 %2 %3 %4

(the % numbers are to capture parameters and if you have more than 4 it won't work).

This generally worked but it will break if you try the examples that are dependent on the unix environment, e.g.

moosh user-create user_{1..5}
Because Windows won't expand the {1 bit
However 
moosh user-create user_1 user_2 user_3
will work ok
Moosh is a truly awesome tool and I recommend it to anyone


Average of ratings: Useful (1)
In reply to Marcus Green

Re: about moosh

by Nadirshah Ferozepurwalla -

Hello,

I have to import 200 courses to moodle 1.9 for some reason

I have moodle 1.9 installed using xampp

from xammp shell i used your command

php c:\xampp\htdocs\moosh\moosh.php  - This gives no command used and gves a list of moosh commands perfect!


Now, I tried

php c:\xampp\htdocs\moosh\moosh.php auth-list

error comes "Could not find moodle installation"

Any help plz, hw to point moosh to my moodle

In reply to Nadirshah Ferozepurwalla

Re: about moosh

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
The answer is at the end of the help that is output (Global configurations).

You need the -p option with something like

php moosh.php -p c:\wamp64\www\moodle blablabla 



In reply to Marcus Green

Re: about moosh

by Nadirshah Ferozepurwalla -

Thankyou for the help

the p switch made the difference.

Now I need to restore some courses, I am using the below command but moosh doesnot seen to react. Moosh says that no command issued and displays a list of commands!

php c:\xampp\htdocs\moosh\moosh.php -p c:\xampp\htdocs\moodle course-restore

(other command such as plugin-list works fine)

please guide. Thankyou

Using

windows server 2008 R2, 

XAMPP Version: 5.6.28

Moodle 1.9.14 (Build: 20111010)

In reply to Nadirshah Ferozepurwalla

Re: about moosh

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
What is the exact error message given?
In reply to Marcus Green

Re: about moosh

by Nadirshah Ferozepurwalla -

On doing:

# php c:\xampp\htdocs\moosh\moosh.php -p c:\xampp\htdocs\moodle course-restore backup.mbz 1


When working with latest moodle version moosh gives following error:

The PHP POSIX extension is not installed - see http://php.net/manual/en/book.posix.php (on CentOS/RHEL the package php-process provides this extension)


When working with moodle 1.9.14 moosh just doesnot recognize the command its says:

moosh version 0.23

No command provided, possible commands: (and list of commands)



how to make it work for moodle19? 

In reply to Nadirshah Ferozepurwalla

Re: about moosh

by Janis Judrups -

Did you managed to deal with this problem? I have the same issue.

In reply to Janis Judrups

Re: about moosh

by Nadirshah Ferozepurwalla -
No searched a lot, tested several ways, it appears this tool has some secrets sad

You may try this

https://moodle.org/mod/forum/discuss.php?d=257341#p1355850

the n switch

Please do let me know, if you manage to make it work.


In reply to Larbi Baraka

Re: about moosh

by Michael Milette -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Hi Larbi,

Here is how to get it working in Windows...

1) Add PHP to your path environment variable. This can be done in Windows or you can add this to your batch file.

2) Here is the batch file I use. Be sure to modify the path to moosh in the line that starts with php:

---------------------------

@echo off

REM moosh.cmd by Michael Milette

php "c:\moosh\moosh.php" %*

---------------------------

3) Finally change to the root of your Moodle project and use the moosh command. 

I used to use %1 %2 etc. but kept running into problems when the number of parameters I specified on the command line didn't match the number of parameters in the batch file. The %* parameter seems to work better because it automatically adapts to the number of parameters.

I haven't used Moosh too much but do find it useful on occasion. Most of the commands I've tried seem to work but some have given me a hard time, especially the one related to generate a new plugin.

For example,

   moosh generate-block hello

...produces an error that \moodle\blocks\hello isn't a directory. However if I create the directory first, it then complains that the directory already exists. Same for the generate-module command and I would assume that it is likely a problem across the board for all of the generate-xxxx commands.

Like I said, the environment works for many of the commands but, in this case, I ended up installing Cygwin and running it from there to get around the problem.

Hope this helps.

Michael Milette

Average of ratings: Useful (3)
In reply to Michael Milette

Re: about moosh

by vinoth kannan -

Hi All,

When i used moosh to restore a backup of course from moodl 2.4 to another instance of moodle 2.4

I get this error

D:\Moodle\mod\moodle12>php e:\moosh\moosh.php course-restore "back\backup-moodle2-course-119-manage-20140529-1432-nu.mbz" 2668

Notice: Undefined index: HTTP_USER_AGENT in D:\Moodle\mod\moodle12\theme\bootstrap\config.php on lin
e 151

Notice: Undefined index: HTTP_USER_AGENT in D:\Moodle\mod\moodle12\theme\bootstrap\config.php on lin
e 151
++ Error: mdb->get_record() found more than one record! ++
* line 1394 of \lib\dml\moodle_database.php: call to debugging()
* line 1354 of \lib\dml\moodle_database.php: call to moodle_database->get_record_sql()
* line 1520 of \backup\util\dbops\restore_dbops.class.php: call to moodle_database->get_record_selec
t()
* line 1363 of \backup\moodle2\restore_stepslib.php: call to restore_dbops::calculate_course_names()

* line 131 of \backup\util\plan\restore_structure_step.class.php: call to restore_course_structure_s
tep->process_course()
* line 103 of \backup\util\helper\restore_structure_parser_processor.class.php: call to restore_stru
cture_step->process()
* line 139 of \backup\util\xml\parser\processors\grouped_parser_processor.class.php: call to restore
_structure_parser_processor->dispatch_chunk()
* line 91 of \backup\util\helper\restore_structure_parser_processor.class.php: call to grouped_parse
r_processor->postprocess_chunk()
* line 148 of \backup\util\xml\parser\processors\simplified_parser_processor.class.php: call to rest
ore_structure_parser_processor->postprocess_chunk()
* line 92 of \backup\util\xml\parser\processors\progressive_parser_processor.class.php: call to simp
lified_parser_processor->process_chunk()
* line 169 of \backup\util\xml\parser\progressive_parser.class.php: call to progressive_parser_proce
ssor->receive_chunk()
* line 212 of \backup\util\xml\parser\progressive_parser.class.php: call to progressive_parser->publ
ish()
* line ? of unknownfile: call to progressive_parser->start_tag()
* line 158 of \backup\util\xml\parser\progressive_parser.class.php: call to xml_parse()
* line 137 of \backup\util\xml\parser\progressive_parser.class.php: call to progressive_parser->pars
e()
* line 105 of \backup\util\plan\restore_structure_step.class.php: call to progressive_parser->proces
s()
* line 153 of \backup\util\plan\base_task.class.php: call to restore_structure_step->execute()
* line 163 of \backup\util\plan\base_plan.class.php: call to base_task->execute()
* line 157 of \backup\util\plan\restore_plan.class.php: call to base_plan->execute()
* line 315 of \backup\controller\restore_controller.class.php: call to restore_plan->execute()
* line 105 of E:\moosh\Moosh\Command\Moodle23\Course\CourseRestore.php: call to restore_controller->
execute_plan()
* line 213 of E:\moosh\moosh.php: call to Moosh\Command\Moodle23\Course\CourseRestore->execute()

Notice: Undefined index: HTTP_USER_AGENT in D:\Moodle\mod\moodle12\theme\bootstrap\config.php on lin
e 151

Notice: Undefined index: HTTP_USER_AGENT in D:\Moodle\mod\moodle12\theme\bootstrap\config.php on lin
e 151
++ Format plugin format_0 is not found. Using default format_weeks ++
* line 112 of \course\format\lib.php: call to debugging()
* line 173 of \course\format\lib.php: call to format_base::get_format_or_default()
* line 35 of \course\format\lib.php: call to format_base::instance()
* line 1409 of \backup\moodle2\restore_stepslib.php: call to course_get_format()
* line 131 of \backup\util\plan\restore_structure_step.class.php: call to restore_course_structure_s
tep->process_course()
* line 103 of \backup\util\helper\restore_structure_parser_processor.class.php: call to restore_stru
cture_step->process()
* line 139 of \backup\util\xml\parser\processors\grouped_parser_processor.class.php: call to restore
_structure_parser_processor->dispatch_chunk()
* line 91 of \backup\util\helper\restore_structure_parser_processor.class.php: call to grouped_parse
r_processor->postprocess_chunk()
* line 148 of \backup\util\xml\parser\processors\simplified_parser_processor.class.php: call to rest
ore_structure_parser_processor->postprocess_chunk()
* line 92 of \backup\util\xml\parser\processors\progressive_parser_processor.class.php: call to simp
lified_parser_processor->process_chunk()
* line 169 of \backup\util\xml\parser\progressive_parser.class.php: call to progressive_parser_proce
ssor->receive_chunk()
* line 212 of \backup\util\xml\parser\progressive_parser.class.php: call to progressive_parser->publ
ish()
* line ? of unknownfile: call to progressive_parser->start_tag()
* line 158 of \backup\util\xml\parser\progressive_parser.class.php: call to xml_parse()
* line 137 of \backup\util\xml\parser\progressive_parser.class.php: call to progressive_parser->pars
e()
* line 105 of \backup\util\plan\restore_structure_step.class.php: call to progressive_parser->proces
s()
* line 153 of \backup\util\plan\base_task.class.php: call to restore_structure_step->execute()
* line 163 of \backup\util\plan\base_plan.class.php: call to base_task->execute()
* line 157 of \backup\util\plan\restore_plan.class.php: call to base_plan->execute()
* line 315 of \backup\controller\restore_controller.class.php: call to restore_plan->execute()
* line 105 of E:\moosh\Moosh\Command\Moodle23\Course\CourseRestore.php: call to restore_controller->
execute_plan()
* line 213 of E:\moosh\moosh.php: call to Moosh\Command\Moodle23\Course\CourseRestore->execute()
New course ID: 4701

D:\Moodle\mod\moodle12>php e:\moosh\moosh.php course-restore "back\backup-moodle2-course-119-managin
g_risks_in_it_projects-20140529-1432-nu.mbz" 2668

Fatal error: Call to undefined method restore_controller_dbops::create_restore_temp_tables() in D:\M
oodle\mod\moodle12\backup\util\helper\restore_prechecks_helper.class.php on line 72

D:\Moodle\mod\moodle12>php e:\moosh\moosh.php course-restore "back\backup-moodle2-course-119-managin
g_risks_in_it_projects-20140529-1432-nu.mbz" 2668

Notice: Undefined index: HTTP_USER_AGENT in D:\Moodle\mod\moodle12\theme\bootstrap\config.php on lin
e 151

Notice: Undefined index: HTTP_USER_AGENT in D:\Moodle\mod\moodle12\theme\bootstrap\config.php on lin
e 151
++ Error: mdb->get_record() found more than one record! ++
* line 1394 of \lib\dml\moodle_database.php: call to debugging()
* line 1354 of \lib\dml\moodle_database.php: call to moodle_database->get_record_sql()
* line 1520 of \backup\util\dbops\restore_dbops.class.php: call to moodle_database->get_record_selec
t()
* line 1363 of \backup\moodle2\restore_stepslib.php: call to restore_dbops::calculate_course_names()

* line 131 of \backup\util\plan\restore_structure_step.class.php: call to restore_course_structure_s
tep->process_course()
* line 103 of \backup\util\helper\restore_structure_parser_processor.class.php: call to restore_stru
cture_step->process()
* line 139 of \backup\util\xml\parser\processors\grouped_parser_processor.class.php: call to restore
_structure_parser_processor->dispatch_chunk()
* line 91 of \backup\util\helper\restore_structure_parser_processor.class.php: call to grouped_parse
r_processor->postprocess_chunk()
* line 148 of \backup\util\xml\parser\processors\simplified_parser_processor.class.php: call to rest
ore_structure_parser_processor->postprocess_chunk()
* line 92 of \backup\util\xml\parser\processors\progressive_parser_processor.class.php: call to simp
lified_parser_processor->process_chunk()
* line 169 of \backup\util\xml\parser\progressive_parser.class.php: call to progressive_parser_proce
ssor->receive_chunk()
* line 212 of \backup\util\xml\parser\progressive_parser.class.php: call to progressive_parser->publ
ish()
* line ? of unknownfile: call to progressive_parser->start_tag()
* line 158 of \backup\util\xml\parser\progressive_parser.class.php: call to xml_parse()
* line 137 of \backup\util\xml\parser\progressive_parser.class.php: call to progressive_parser->pars
e()
* line 105 of \backup\util\plan\restore_structure_step.class.php: call to progressive_parser->proces
s()
* line 153 of \backup\util\plan\base_task.class.php: call to restore_structure_step->execute()
* line 163 of \backup\util\plan\base_plan.class.php: call to base_task->execute()
* line 157 of \backup\util\plan\restore_plan.class.php: call to base_plan->execute()
* line 315 of \backup\controller\restore_controller.class.php: call to restore_plan->execute()
* line 105 of E:\moosh\Moosh\Command\Moodle23\Course\CourseRestore.php: call to restore_controller->
execute_plan()
* line 213 of E:\moosh\moosh.php: call to Moosh\Command\Moodle23\Course\CourseRestore->execute()

Notice: Undefined index: HTTP_USER_AGENT in D:\Moodle\mod\moodle12\theme\bootstrap\config.php on lin
e 151

Notice: Undefined index: HTTP_USER_AGENT in D:\Moodle\mod\moodle12\theme\bootstrap\config.php on lin
e 151
++ Format plugin format_0 is not found. Using default format_weeks ++
* line 112 of \course\format\lib.php: call to debugging()
* line 173 of \course\format\lib.php: call to format_base::get_format_or_default()
* line 35 of \course\format\lib.php: call to format_base::instance()
* line 1409 of \backup\moodle2\restore_stepslib.php: call to course_get_format()
* line 131 of \backup\util\plan\restore_structure_step.class.php: call to restore_course_structure_s
tep->process_course()
* line 103 of \backup\util\helper\restore_structure_parser_processor.class.php: call to restore_stru
cture_step->process()
* line 139 of \backup\util\xml\parser\processors\grouped_parser_processor.class.php: call to restore
_structure_parser_processor->dispatch_chunk()
* line 91 of \backup\util\helper\restore_structure_parser_processor.class.php: call to grouped_parse
r_processor->postprocess_chunk()
* line 148 of \backup\util\xml\parser\processors\simplified_parser_processor.class.php: call to rest
ore_structure_parser_processor->postprocess_chunk()
* line 92 of \backup\util\xml\parser\processors\progressive_parser_processor.class.php: call to simp
lified_parser_processor->process_chunk()
* line 169 of \backup\util\xml\parser\progressive_parser.class.php: call to progressive_parser_proce
ssor->receive_chunk()
* line 212 of \backup\util\xml\parser\progressive_parser.class.php: call to progressive_parser->publ
ish()
* line ? of unknownfile: call to progressive_parser->start_tag()
* line 158 of \backup\util\xml\parser\progressive_parser.class.php: call to xml_parse()
* line 137 of \backup\util\xml\parser\progressive_parser.class.php: call to progressive_parser->pars
e()
* line 105 of \backup\util\plan\restore_structure_step.class.php: call to progressive_parser->proces
s()
* line 153 of \backup\util\plan\base_task.class.php: call to restore_structure_step->execute()
* line 163 of \backup\util\plan\base_plan.class.php: call to base_task->execute()
* line 157 of \backup\util\plan\restore_plan.class.php: call to base_plan->execute()
* line 315 of \backup\controller\restore_controller.class.php: call to restore_plan->execute()
* line 105 of E:\moosh\Moosh\Command\Moodle23\Course\CourseRestore.php: call to restore_controller->
execute_plan()
* line 213 of E:\moosh\moosh.php: call to Moosh\Command\Moodle23\Course\CourseRestore->execute()
New course ID: 4703

In reply to vinoth kannan

Re: about moosh

by David Mudrák -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators
Seems like the notice is thrown by the plugin you have installed - https://moodle.org/plugins/pluginversions.php?plugin=theme_bootstrap Looking at the bottom of https://github.com/bmbrands/theme_bootstrap/blob/bootstrap2_moodle24/config.php explains why you get the notice. The author of the theme has fixed it in recent versions. You may want to get in touch with them and discuss eventual backport.
In reply to Michael Milette

Re: about moosh

by Tomasz Muras -
Picture of Core developers Picture of Plugin developers Picture of Plugins guardians Picture of Translators

Thanks Michael, Marcus - I have updated the documentation.


Tomek

In reply to Tomasz Muras

Re: about moosh

by vinoth kannan -

Hi Tomasz,

Is there any way that in moosh can unzip the zipped files and set a particular file as Set Main file from a file resource in a course

Thanks

Vinoth

In reply to vinoth kannan

Re: about moosh

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

What do you mean as Set Main file?

In reply to Marcus Green

Re: about moosh

by vinoth kannan -

Hi Marcus,

We have about 5000 documents all are HTML files. HTML files has sub folders with the support files. I created courses and added file resource i zipped the HTML files and unzipped it in manual upload. When using the script i can able to upload the zip file and unzip it but i cannot set the .htm file as the Main file. Unzipped file in course points to file.xml in sub folder as main file.
Can you suggest that how could i set the .htm file as main file
Thanks
Vinoth

In reply to Michael Milette

Re: about moosh

by Fred Riley -

A batch file - that's a fun 'blast from the past' smile. It's sort of nice to see that even the latest Windoze needs batch files occasionally. 

To add to (1), about putting PHP into the PATH variable, there's a handy article "How do I set or change the PATH system variable?" describing setting PATH (or any other env var) in various versions of Windoze. If you're running off localhost with XAMPP, the PHP executable is in xampp/php so that needs putting into the PATH - see "how to access the command line for xampp on windows" on Stack Overflow.

Fred

Average of ratings: Useful (1)
In reply to Michael Milette

Re: about moosh

by Barbara Lawrence -

Hi,

Moosh looks like a fantastic tool and I would love to get it working our Windows environment (Moodle 2.7). However, I'm not having much success!

I created this command file 

php c:\moosh\moosh.php %1 %2 %3 %4 

and put it in my moodle root folder.

I've tried a few different moosh commands  eg moosh user-create user_moosh but I get this error: The PHP  POSIX extension is not installed...

The only command I've got to work so far is plugin-list, which lists plugins available in moodle. It's not looking at my moodle for that of course.

What am I doing wrong? I've tried changing the command file to

php c:\moosh\moosh.php %* but it makes no difference.  

I've looked at cygwin but I don't understand how I would run moosh from cygwin.  

Any help would be very gratefully received!

Average of ratings: Useful (1)
In reply to Barbara Lawrence

Re: about moosh

by Michael Aherne -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Have you tried using the --no-user-check option (-n for short)?  That bypasses the stuff that uses the POSIX extension, which is mostly concerned with checking directory permissions / ownership in Unix so shouldn't affect how it works in Windows.

Average of ratings: Useful (4)