Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

  • Loading branch information...
commit 91de7cb26e6b2911fe2bcb6541f6cca094402c80 1 parent 4ff0f02
Tim Lock authored rajeshtaneja committed
Showing with 6 additions and 6 deletions.
  1. +3 −3 course/reset_form.php
  2. +3 −3 lib/moodlelib.php
View
6 course/reset_form.php
@@ -58,13 +58,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
6 lib/moodlelib.php
@@ -4857,12 +4857,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);
Please sign in to comment.
Something went wrong with that request. Please try again.