Moodle
  1. Moodle
  2. MDL-16043

Enrolment sync need to be cross-db

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.8.6, 1.9.2, 2.0
    • Fix Version/s: 1.8.7, 1.9.3
    • Component/s: Enrolments
    • Labels:
      None
    • Environment:
      LAMP
      external database Oracle
    • Database:
      MySQL, Oracle
    • Affected Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE, MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE
    • Rank:
      31206

      Description

      enrolment sync doesn't work if external database is Oracle because database field names are UPPERCASE by default on oracle. We need to convert all retrieved fieldnames from the database into lowercase (all the enrolment code considers that database fieldnames are in lowercase)

      QA


      In order to retest:

      • use Oracle and MySQL as external database
      • if could you retest with PHP4, it would be great
      • activate course>enrolment>external database plugin
      • help yourself with the moodle docs: http://docs.moodle.org/en/External_database
      • check that it works

        Issue Links

          Activity

          Hide
          Jérôme Mouneyrac added a comment -

          tested on 1.8 and 1.9 with external Oracle database and PHP5. fixed.
          I'm writing a new issue for 2.0 as enrolment sync doesn't work anyway.

          Show
          Jérôme Mouneyrac added a comment - tested on 1.8 and 1.9 with external Oracle database and PHP5. fixed. I'm writing a new issue for 2.0 as enrolment sync doesn't work anyway.
          Hide
          Tim Hunt added a comment -

          Actually, I don't know how to test this. I have reviewed the code, and it looks OK, but I think it needs to be tested before it is closed.

          Show
          Tim Hunt added a comment - Actually, I don't know how to test this. I have reviewed the code, and it looks OK, but I think it needs to be tested before it is closed.
          Hide
          Mathieu Petit-Clair added a comment -

          Tested this with Jérôme - it is partially working. Field need to be in lower case (doesn't work in upper case, though Oracle displays the fields in upper case).

          Empty courses are created when the synchronisation partially fails. This is not good, as repeated (like with cron) calls can create a huge number of bad courses quite quickly.

          I had a lot of problems with authentication, but it seems to work now. Could be a case issue as well.. needs more testing.

          Show
          Mathieu Petit-Clair added a comment - Tested this with Jérôme - it is partially working. Field need to be in lower case (doesn't work in upper case, though Oracle displays the fields in upper case). Empty courses are created when the synchronisation partially fails. This is not good, as repeated (like with cron) calls can create a huge number of bad courses quite quickly. I had a lot of problems with authentication, but it seems to work now. Could be a case issue as well.. needs more testing.
          Hide
          Jérôme Mouneyrac added a comment -

          my bad, it effectively partially fixed. New patch coming.

          Show
          Jérôme Mouneyrac added a comment - my bad, it effectively partially fixed. New patch coming.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          I guess that both enrol and auth (MDL-15175) should use the same solution, correct? i.e. this hack is going to be used in both to guarantee lowercase filednames both auth and enrol:

          $fields_obj = (object)array_change_key_case((array)$fields_obj , CASE_LOWER);

          That apart from both auth and enrol not working in HEAD right now (that require two new bugs, hopefully subtasks of MDL-14679.

          Ciao

          Show
          Eloy Lafuente (stronk7) added a comment - I guess that both enrol and auth ( MDL-15175 ) should use the same solution, correct? i.e. this hack is going to be used in both to guarantee lowercase filednames both auth and enrol: $fields_obj = (object)array_change_key_case((array)$fields_obj , CASE_LOWER); That apart from both auth and enrol not working in HEAD right now (that require two new bugs, hopefully subtasks of MDL-14679 . Ciao
          Hide
          Jérôme Mouneyrac added a comment -

          in fact the fields coming from the admin form need to be converted in lowercase as well:

          $extcourse = $extcourse_obj->{$CFG->enrol_remotecoursefield}; // if enrol_remotecoursefield has been set in UPPERCASE by Moodle Administrator, the fix will not work anymore.

          We probably need to lowercase $CFG->enrol_remotecoursefield.
          I have a better look to that.

          Show
          Jérôme Mouneyrac added a comment - in fact the fields coming from the admin form need to be converted in lowercase as well: $extcourse = $extcourse_obj->{$CFG->enrol_remotecoursefield}; // if enrol_remotecoursefield has been set in UPPERCASE by Moodle Administrator, the fix will not work anymore. We probably need to lowercase $CFG->enrol_remotecoursefield. I have a better look to that.
          Hide
          Jérôme Mouneyrac added a comment -

          ok mat you can retest, it should work.

          Show
          Jérôme Mouneyrac added a comment - ok mat you can retest, it should work.

            People

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

              Dates

              • Created:
                Updated:
                Resolved: