Downloading add-on modules

Downloading add-on modules

by Hans de Zwart -
Number of replies: 10
I have just installed and configured my first Linux server ever. And I must say that I love the possibility of having a cron job getting the latest Moodle Nightly for me every night. big grin
This give me way more opportunities for testing... but will also make more demanding. wink

Here is the problem. When I downloaded Petr Skoda's new book module it was zipped in a way that I could download it in the moodle home directory and unzip it there. It had the language files included.
The modules on the modules and add on page are not zipped like that. They need to be saved in the /mod directory and unzipped there. You will then just need to have a recent language pack. I tried downloading the scheduler module (which I know I like a lot for planning parent talks) but it had no language file, I then downloaded the latest english language pack, but it didn't have scheduler.php sad

Is it a good idea to change the way the ZIP's on the modules and add-on page are made? Here are my ideas:
  • Use the home directory as the place to save
  • Build the zip in stages:
    • First get the latest module code from CVS
    • Then get the latest language code from the module from CVS (standard en pack)
    • If the language file doesn't exist get it from somewhere else
I think this will make downloading and installing new modules much easier. I am interested to know what others are thinking.
Average of ratings: -
In reply to Hans de Zwart

Re: Downloading add-on modules

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I totally agree and it isn't any harder to do! To my mind a module should be zipped (as you say) like this...

cd .../moodle
zip -r mymod.zip mod/mymod
zip mymod.zip lang/en/mymod.php
zip -r mymod.zip lang/en/help/mymod
...and so on until all the files are included

One would write a script to do this of course.

...which of course makes installation trivial, *and* easy for newbies, *and* less error prone. We can only keep complaining about it big grin
In reply to Hans de Zwart

Re: Downloading add-on modules

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
No, unpacking raw archives in Moodle's root is a bad idea for two reasons:

  1. It makes all the more likely that a module could accidentally overwrite something important ... you don't know what's in the archive until you unpack it. A "naughty" archive could even update other files such as important Moodle libraries and cause all sorts of grief.

  2. Depending on how you unpack the archive, it may unpack within a directory of it's own or not. For example, some zip programs put the whole archive in a folder with the same name as the zip file. So it's not all that reliable anyway.

What I will do however, is add a step to the translation-finding functions that will (as a last resort) check for the language file in mod/xxxxx/lang/en/xxxxx.php. It'll be slightly less efficient than a file in the main 'en' pack but it will at least avoid those missingstrings.

The best way to go in future I think is to have a script in Moodle that downloads (or accepts) a standard zip file and then performs the install process itself. This way some security can be built in to the process, and it also makes upgrading a point and click process.
In reply to Martin Dougiamas

Re: Downloading add-on modules

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
And you called *me* a zealot big grin

Point taken, but the way it is at the moment would mean that an inexperienced user could easily break things - the more comands you have to type and the more 'thinking' you have to do, the greater the chance of screwing up.

The other point you make is interesting - never mind last resort, are there not grounds for making modules totally self contained, ie, they have their own language files - not sure.
In reply to Howard Miller

Re: Downloading add-on modules

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
It would be much harder on translators (who after all are the people doing the hard work there)
In reply to Martin Dougiamas

Re: Downloading add-on modules

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Yes, you are right...again.... sigh! big grin
In reply to Howard Miller

Re: Downloading add-on modules

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Never mind.  This code I mentioned is in now, so inexperienced or lazy people can still get away with not copying over the language files.  smile
In reply to Martin Dougiamas

Re: Downloading add-on modules

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Cool.. so is everybody happy about what a module file *should* look like, or is a bit of documentation needed?
In reply to Martin Dougiamas

Re: Downloading add-on modules

by Hans de Zwart -
Yes, these sound like good ideas to me. I never unzip a file without looking inside and seeing the directory structure. Also when I make a zip file I am carefull that I have the correct structure. Will this mean that all modules have their own language directory? Also for other languages than English?
In reply to Hans de Zwart

Re: Downloading add-on modules

by Hans de Zwart -
Another question:
If I do a CVS update (using the old documented way: cvs update -dP or something, probably getting the development version), do I then automatically have the most recent language packs of all languages?