Moodle Script to refresh all courses with default sections

Script to refresh all sections for all courses in Moodle system

$courses = get_courses();
foreach ($courses as $course){ 
course_create_sections_if_missing($course->id, [0,1,2,3,4,5,6,7,8,9,10,11,12]); 
rebuild_course_cache($course->id, true);

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.