Permalink
Browse files

MDL-31623 Course: Course reset bypass modules, which are removed

  • Loading branch information...
1 parent d71c486 commit 303385394228ac13308d5c0148b3128d777b11aa Tim Lock committed with Rajesh Taneja Aug 20, 2012
Showing with 6 additions and 6 deletions.
  1. +3 −3 course/reset_form.php
  2. +3 −3 lib/moodlelib.php
View
@@ -61,13 +61,13 @@ function definition (){
if ($allmods = $DB->get_records('modules') ) {
foreach ($allmods as $mod) {
$modname = $mod->name;
- if (!$DB->count_records($modname, array('course'=>$COURSE->id))) {
- continue; // skip mods with no instances
- }
$modfile = $CFG->dirroot."/mod/$modname/lib.php";
$mod_reset_course_form_definition = $modname.'_reset_course_form_definition';
$mod_reset__userdata = $modname.'_reset_userdata';
if (file_exists($modfile)) {
+ if (!$DB->count_records($modname, array('course'=>$COURSE->id))) {
+ continue; // Skip mods with no instances
+ }
include_once($modfile);
if (function_exists($mod_reset_course_form_definition)) {
$mod_reset_course_form_definition($mform);
View
@@ -4982,12 +4982,12 @@ function reset_course_userdata($data) {
if ($allmods = $DB->get_records('modules') ) {
foreach ($allmods as $mod) {
$modname = $mod->name;
- if (!$DB->count_records($modname, array('course'=>$data->courseid))) {
- continue; // skip mods with no instances
- }
$modfile = $CFG->dirroot.'/mod/'. $modname.'/lib.php';
$moddeleteuserdata = $modname.'_reset_userdata'; // Function to delete user data
if (file_exists($modfile)) {
+ if (!$DB->count_records($modname, array('course'=>$data->courseid))) {
+ continue; // Skip mods with no instances
+ }
include_once($modfile);
if (function_exists($moddeleteuserdata)) {
$modstatus = $moddeleteuserdata($data);

0 comments on commit 3033853

Please sign in to comment.