MDL-12450 - Matching up roles on the restore settings form is broken - this is basically a complete rewrite of these two functions. Merged from MOODLE_19_STABLE.
MDL-12450 - Matching up roles on the restore settings form is broken - this is basically a complete rewrite of these two functions. Merged from MOODLE_19_STABLE.

dilawar/moodle