This field follows suit with the 'auth' field on the 'user' table. enrol_student() and add_teacher() now take an extra parameter (which defaults to 'manual') for the enrolment.
Ideally, the process of loading valid enrolments and pruning invalid/old enrolments that the plugins perform should not prune enrolments of a different type.
This way, you can support users with a hybrid 'external+internal' enrolment usage, just like with authentication.
Of course, this is very experimental code, and discussion is welcome. Patches are even more welcome ;)
On a related note, I've created a separate script that can be called from cron. This is lazy, and certainly not ideal (we could do it from moodle's cron) but allows some extra flexibility, such as running it re-niced.
For a moodle-cron-based sync, it'd be better to do it at the base class level, and add a function call to the interface.
I am trying to have cron call a script, which in turns check some discussion related statistics in moddle database then make decision on sending email to the instructor. Could you please share the source code to show me how to do this? (the modified cron.php and the scripts that being called by cron (it doesn't matter what the scripts does, even authentication or backup)? if you think it is simple and no need to send source code, would you please explain the process a bit?