Upgrade blocks to moodle 2.0 (from 1.9.xx)

Upgrade blocks to moodle 2.0 (from 1.9.xx)

by Vijay N -
Number of replies: 5

This is more of a development related question but I am looking for resources on upgrading the contributed blocks to 2.0 from 1.9. Which areas of the codes (block_name.php) needs to be changed, I also understand that the function handling needs to be changed as well...how do I do this....

Average of ratings: -
In reply to Vijay N

Re: Upgrade blocks to moodle 2.0 (from 1.9.xx)

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

I don't think anyone has written out all the steps yet. The changes you need to make fall into two cateogories:

A. Changes you need make for blocks in Moodle 2.0:

  1. Replace the old config.html form (if your block has one) with a Moodle form class.
  2. Replace config_global.html with a settings.php file (if necessary).
  3. Replace the old version method with a version.php file (like for other plugins)

B. Then there are the changes that need to be made to all Moodle code for 2.0:

  1. Changes to any place you access the database, to use the new $DB global.
  2. Changes to any place where you handle uploaded files, to use the new files API.
  3. Changes to any CSS or JavaScript to fit in with the new theme system and $PAGE->requires instead of require_js.
  4. Changes to backup and restore.

The B changes are documented. See the links at the bottom of the Moodle 2.0 release notes.

The A changes are not really documented yet. Look at the changes in some of the blocks in the standard Moodle distribution.

Average of ratings: Useful (1)
In reply to Tim Hunt

Re: Upgrade blocks to moodle 2.0 (from 1.9.xx)

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

As Tim says, failing a complete "how-to" documentation, the best way to go at the moment is to compare file by file the contents of a 1.9 standard moodle block and its 2.0 version, using e.g. the excellent Winmerge tool.

Joseph

In reply to Joseph Rézeau

Re: Upgrade blocks to moodle 2.0 (from 1.9.xx)

by SVI eSolutions -

Hi there,

I'm in the process of upgrading an activity module from 1.9 to 2.0 and I was wondering if the html forms need to be converted into the new $mform format or if it will work anyways.

At the minute it doesn't work but it could be a small error. Thanks for your help!

In reply to SVI eSolutions

Re: Upgrade blocks to moodle 2.0 (from 1.9.xx)

by Anthony Borrow -
Picture of Core developers Picture of Plugin developers Picture of Testers

Here are a couple of general links that may help you. Feel free to let me know if you have any particular questions. If you are using a Git repository just send me the link to it and I'll be happy to have a look and make suggestions. Peace - Anthony

Migrating CONTRIB Code to 2.0

Migrating to 2.0 checklist

Development:Deprecated_functions_in_2.0

Average of ratings: Useful (1)
In reply to Anthony Borrow

Re: Upgrade blocks to moodle 2.0 (from 1.9.xx)

by Chaim Schendowich -

I have attached a table with general information about necessary changes to be done when upgrading blocks. I have tried to put together as much as possible though it probably still is very incomplete ... smile

I would be pleased to recieve your feedback.

Chaim.

Average of ratings: Useful (2)