Moodle
  1. Moodle
  2. MDL-25659

Enrol/database has multiple issues

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0.1
    • Component/s: Enrolments
    • Labels:
      None
    • Environment:
      WAMP, MySQL 5.051b, PHP 5.2.11
    • Database:
      MySQL
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE
    • Rank:
      15774

      Description

      Enrol/database/cli/sync.php crashes with a PHP code error when run. This is due to a variable overwrite occurring in lib.php during second and subsequent loops through $fields in line ~322 and following. Renaming $fields in those lines to $sqlfields or similar solves the issue.

      Once running, script functioned for only some random amount of courses until line 277 of lib.php was removed. "JOIN

      {enrol}

      e ON (e.courseid = c.id AND e.enrol = 'database')";"

      (For reference on the above, see http://moodle.org/mod/forum/discuss.php?d=162854#p713781)

      Finally, we now have the following:

      1. Sync enrollments from MySQL table. All courses populate normally.
      2. Post to a subscribed forum in a course.
      3. Run admin/cron.php
      4. All database enrollments for courses with pending mails are removed or suspended (depending on enrol_database | unenrolaction). If users are still enrolled then e-mails are sent normally. This ONLY effects courses with pending e-mails to be sent. I'm baffled.
      5. Sync CLI restores enrollments normally.

      Obviously step 4 is where we expect normal e-mails to be sent and enrollments to be left alone. Traces on cron.php seem to indicate the removal is occurring before the system attempts to send e-mails.

        Activity

        Hide
        Petr Škoda added a comment -

        Hello, should be all fixed now, thanks for the report!
        Please test and report any problems found.

        Petr

        Show
        Petr Škoda added a comment - Hello, should be all fixed now, thanks for the report! Please test and report any problems found. Petr
        Hide
        Bill Johnson added a comment -

        I'm still hitting the issue where a course with a pending e-mail sees all database enrollments removed when the cron.php is run.

        Show
        Bill Johnson added a comment - I'm still hitting the issue where a course with a pending e-mail sees all database enrollments removed when the cron.php is run.
        Hide
        Petr Škoda added a comment -

        Could you please file a separate issue for the email trouble. I did not see any email related code that might unenrol the users, I will try to find out where it is happening later this week. Thanks for the cooperation!

        Petr

        Show
        Petr Škoda added a comment - Could you please file a separate issue for the email trouble. I did not see any email related code that might unenrol the users, I will try to find out where it is happening later this week. Thanks for the cooperation! Petr

          People

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

            Dates

            • Created:
              Updated:
              Resolved: