Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-23701

Deleting course contents always causing debugging messages because activity has been already deleted

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0
    • Fix Version/s: 2.0
    • Labels:
      None
    • Database:
      Any
    • Difficulty:
      Moderate
    • Affected Branches:
      MOODLE_20_STABLE
    • Fixed Branches:
      MOODLE_20_STABLE

      Description

      Was trying backup & restore with activity grade items. To do that I continuously execute remove_course_contents() to start a new restore into empty course.

      It made me crazy to get this debugging output for each of the grade items in my course, until I discovered it wasn't a bug in my restore code (using wrong activities->id or so), but something in the process of deleting grade_items/grade_grades/completion stuff.

      Here it's the trace:

      Couldn't find course-module for module 'forum', instance '934', course '34'
      line 801 of /lib/grade/grade_grade.php: call to debugging()
      line 256 of /lib/grade/grade_object.php: call to grade_grade->notify_changed()
      line 352 of /lib/grade/grade_item.php: call to grade_object->delete()
      line 336 of /lib/grade/grade_item.php: call to grade_item->delete_all_grades()
      line 95 of /lib/gradelib.php: call to grade_item->delete()
      line 1575 of /mod/forum/lib.php: call to grade_update()
      line 262 of /mod/forum/lib.php: call to forum_grade_item_delete()
      line 4036 of /lib/moodlelib.php: call to forum_delete_instance()
      line 15 of /testrestore.php: call to remove_course_contents()

      The problem is that grade_grade->notify_changed() calls to get_coursemodule_from_instance() and, unluckly, the instance has been already deleted (first step on each xxxx_delete_instance() function).

      It seems that grade items are perfectly deleted and it's only when completion tries to do its job when the problem appears. Perhaps you should try to get the same information straight from course_modules instead or something like that. But current order causes the debugging message to happen always.

      Ciao

        Attachments

          Activity

            People

            • Assignee:
              quen Sam Marshall
              Reporter:
              stronk7 Eloy Lafuente (stronk7)
              Tester:
              Nobody
              Participants:
              Component watchers:
              Sam Marshall, Amaia Anabitarte, Bas Brands, Carlos Escobedo, Sara Arjona (@sarjona), Víctor Déniz Falcón, Jake Dallimore, Jun Pataleta, Ryan Wyllie
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                24/Nov/10