Moodle 1.9 -> 2 code converter tool

Moodle 1.9 -> 2 code converter tool

by Simon Coggins -
Number of replies: 4

I realise we're a bit late to the party here, but we've recently been porting lots of code to the moodle 2 codebase and we wrote a tool to make the job a bit easier. Since there's still a few 1.9 modules that need converting we thought we'd make it available in case it's helpful for others too.

It was original based on the check_db_syntax script here, but we've extended it significantly, adding support for a wider range of issues, automatically fixing some common issues and a web interface. It also has some support for moving and updating language strings, help files, etc.

It's designed to be extendable, so although we haven't got rules for fixing everything yet, feel free to add more and send us pull requests to be merged.

Here it is:

https://github.com/totara/moodle2_code_converter

and here's a typical screenshot:

Moodle 2 converter tool screenshot

 

Enjoy!

Simon and the TotaraLMS team.

Average of ratings: -
In reply to Simon Coggins

Re: Moodle 1.9 -> 2 code converter tool

by Frankie Kam -
Picture of Plugin developers

Hi Simon!

That's the ticket! Just what the doctor ordered! I can't wait to try it out. I bet its translation power is getting better and better. Imagine what happens if it covers all translation issues.....more M1.9 plugins can be ported over to M2.x at a much faster rate. Thanks a bunch for this.

Frankie Kam
Wannabe Developer 

In reply to Simon Coggins

Re: Moodle 1.9 -> 2 code converter tool

by Rosario Carcò -

What are you meaning by code converter or translation? I have two blocks, myCourses and siteNavigation which need a lot of logic. And there has been a lot of redesing in logic in Moodle 2.x so I wonder what would be the fastest way to rewrite my blocks or even my uploadusersandcourses.php

Rosario

In reply to Rosario Carcò

Re: Moodle 1.9 -> 2 code converter tool

by Alastair Munro -

Hi Rosario,

This tool translates a lot of the Moodle 1.9 function calls to the equivalent Moodle 2 versions. It can't re-write any logic that needs to be fixed but it does help by automating many of the tedious task such as updating display functions to use $OUTPUT and updating database functions to use $DB and new structure.

Cheers,
Alastair