Conversion tool (plugins 1.9 to 2.0)

Conversion tool (plugins 1.9 to 2.0)

by Juan Leyva -
Number of replies: 3
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Hello,

is there any conversion tool for helping to migrate a 1.9 plugin to 2.0?

This script is very usefull, I'm thinking in add some hacks to convert the get_record* functions to $DB->get_record*

http://cvs.moodle.org/contrib/tools/check_db_syntax/README.txt?revision=1.2&view=markup

Regards

Average of ratings: -
In reply to Juan Leyva

Re: Conversion tool (plugins 1.9 to 2.0)

by sam marshall -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

I don't think this is something that can usefully be done automatically.

While the database stuff seems quite trivial, you may need to make associated changes to do with how slashes are handled and the way database queries are constructed (first, variables in code never have slashes now; you shouldn't construct SQL queries by manually adding in variables but by using ? instead; if you still use the add-in-variable approach this will be a security hole; second, there may be manual addslashes calls you need to remove). Basically you need to review all the code even if the changes themselves are fairly obvious.

The other changes (files api) are not really automatable.

Best thing would be an 'advisor' script... like the one Eloy has done. smile

Just imo.

--sam

In reply to sam marshall

Re: Conversion tool (plugins 1.9 to 2.0)

by Juan Leyva -
Picture of Core developers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

Yep, it's true, looking deeper it will be very complex.

But there are some functions that can be easily changed (get_record(), get_records(), insert_record(), update_record(), get_field(), set_field())

And also the output renderer functions... so I'll try to do something.


Regards

Average of ratings: Useful (1)