*** moodlelib_ORIG.php Mon Mar 18 15:19:13 2013 --- moodlelib.php Mon Mar 18 15:22:13 2013 *************** *** 4567,4572 **** --- 4567,4573 ---- * $options: * - 'keep_roles_and_enrolments' - false by default * - 'keep_groups_and_groupings' - false by default + * - 'keep_course_logs' - false by default * * @param int $courseid The id of the course that is being deleted * @param bool $showfeedback Whether to display notifications of each action the function performs. *************** *** 4759,4769 **** // Delete all related records in other core tables that may have a courseid // This array stores the tables that need to be cleared, as // table_name => column_name that contains the course id. ! $tablestoclear = array( ! 'log' => 'course', // Course logs (NOTE: this might be changed in the future) ! 'backup_courses' => 'courseid', // Scheduled backup stuff ! 'user_lastaccess' => 'courseid', // User access info ! ); foreach ($tablestoclear as $table => $col) { $DB->delete_records($table, array($col=>$course->id)); } --- 4760,4777 ---- // Delete all related records in other core tables that may have a courseid // This array stores the tables that need to be cleared, as // table_name => column_name that contains the course id. ! if (empty($options['keep_course_logs'])) { ! $tablestoclear = array( ! 'log' => 'course', // Course logs (NOTE: this might be changed in the future) ! 'backup_courses' => 'courseid', // Scheduled backup stuff ! 'user_lastaccess' => 'courseid', // User access info ! ); ! } else { ! $tablestoclear = array( ! 'backup_courses' => 'courseid', // Scheduled backup stuff ! 'user_lastaccess' => 'courseid', // User access info ! ); ! } foreach ($tablestoclear as $table => $col) { $DB->delete_records($table, array($col=>$course->id)); }