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 e24b125a3a0d164ad15fc2aadfc0c9c3fd398c29 1 parent bac15e5
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
@@ -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
6 lib/moodlelib.php
@@ -4961,12 +4961,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.