-
Bug
-
Resolution: Fixed
-
Critical
-
2.0
-
None
-
WAMP, MySQL 5.051b, PHP 5.2.11
-
MySQL
-
MOODLE_20_STABLE
-
MOODLE_20_STABLE
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.