Moodle
  1. Moodle
  2. MDL-28313

Database enrolment remote role field not being set during upgrade from 1.9 -> 2

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.3, 2.1
    • Fix Version/s: 2.0.4, 2.1.1, 2.2
    • Component/s: Enrolments
    • Labels:
    • Testing Instructions:
      Hide

      1/ install Moodle 1.9 and configure database enrolment
      2/ upgrade
      3/ verify the settings are the same - concentrate on the two role options

      Show
      1/ install Moodle 1.9 and configure database enrolment 2/ upgrade 3/ verify the settings are the same - concentrate on the two role options
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      w28_MDL-28313_m22_enroldb
    • Rank:
      17958

      Description

      I've been testing migrations of our Moodle installation and I've noticed each time that the role field for database enrolments (enrol_db_remoterolefield) isn't being mapped into the correct value upon upgrade (enrol_database | remoterolefield). I believe (but have not tested) that this is because:

      /enrol/database/db/install.php:77
      if (isset($CFG->enrol_remoterolefield)) {
          set_config('remoterolefield', $CFG->enrol_remoterolefield, 'enrol_database');
          unset_config('enrol_remoterolefield');
      }
      

      should be using $CFG->enrol_db_remoterolefield instead. I am using the most up-to-date version of the MOODLE_21_STABLE branch available on github. Please forgive me if this report is in error

      Replication instructions:

      • Upgrade a Moodle 1.9 installation using database enrolments with roles defined to Moodle 2.0
      • The remoterolefield is empty after upgrade.

        Activity

        Hide
        Michael de Raadt added a comment -

        Thanks for reporting this and suggesting a solution.

        I've put it on our backlog and we'll try to get to it as soon as we can.

        Show
        Michael de Raadt added a comment - Thanks for reporting this and suggesting a solution. I've put it on our backlog and we'll try to get to it as soon as we can.
        Hide
        Petr Škoda added a comment -

        Thanks for the report and proposed patch!

        Show
        Petr Škoda added a comment - Thanks for the report and proposed patch!
        Hide
        Sam Hemelryk added a comment -

        Good spotting guys, and thanks for the fix. This has been integrated now

        Show
        Sam Hemelryk added a comment - Good spotting guys, and thanks for the fix. This has been integrated now
        Hide
        David Mudrak added a comment -

        Test passed. The database enrolment setting preserved after the upgrade, including both role-related fields.

        Note: in 1.9 setting, I had "Default role" set to "Default". This became invalid option in 2.1 after the upgrade where one of the roles must be selected explicitly. Not sure if that is expected or not...

        Show
        David Mudrak added a comment - Test passed. The database enrolment setting preserved after the upgrade, including both role-related fields. Note: in 1.9 setting, I had "Default role" set to "Default". This became invalid option in 2.1 after the upgrade where one of the roles must be selected explicitly. Not sure if that is expected or not...

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: