function course_update_6121 in Course 6
Same name and namespace in other branches
- 7.2 course.install \course_update_6121()
- 7 course.install \course_update_6121()
Delete enrollments for users who don't exist anymore.
File
- ./
course.install, line 453 - course.install Install and update functions for Courses.
Code
function course_update_6121() {
$ret = array();
$sql = "DELETE ce.* FROM {course_enrolment} ce LEFT JOIN {users} u ON (ce.uid = u.uid) WHERE u.uid IS NULL";
$ret[] = update_sql($sql);
$ret[] = array(
'success' => TRUE,
'query' => db_affected_rows() . ' old enrollments deleted',
);
return $ret;
}