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

i have a row in course_module for a deleted forum

    Details

    • Database:
      MySQL
    • Testing Instructions:
      Hide

      Note: You need database access to test this.

      1. Log in as admin
      2. Add a wiki activity to course
      3. Go back to course and move mouse over wiki and note module id (in my case 58)
      4. In course_module table look for id (58) and note instance id (in my case 21)
      5. In wiki table delete record with id = instance id (21)
      6. Backup this course (Settings-> Course administration-> Backup) and keep and eye on error log.
      7. Error should be logged in error logs
      8. Go though the whole process and make sure you can backup a course.
      9. Try backing up another (normal) course.
      Show
      Note: You need database access to test this. Log in as admin Add a wiki activity to course Go back to course and move mouse over wiki and note module id (in my case 58) In course_module table look for id (58) and note instance id (in my case 21) In wiki table delete record with id = instance id (21) Backup this course (Settings-> Course administration-> Backup) and keep and eye on error log. Error should be logged in error logs Go though the whole process and make sure you can backup a course. Try backing up another (normal) course.
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE
    • Pull Master Branch:
      wip-mdl-25432

      Description

      If I go into a course and go to course administration -> backup I get the following error.

      error/activity_task_coursemodule_not_found

      More information about this error
      Stack trace:

      • line 104 of /backup/util/factories/backup_factory.class.php: backup_task_exception thrown
      • line 120 of /backup/moodle2/backup_plan_builder.class.php: call to backup_factory::get_backup_activity_task()
      • line 144 of /backup/moodle2/backup_plan_builder.class.php: call to backup_plan_builder::build_activity_plan()
      • line 165 of /backup/moodle2/backup_plan_builder.class.php: call to backup_plan_builder::build_section_plan()
      • line 89 of /backup/moodle2/backup_plan_builder.class.php: call to backup_plan_builder::build_course_plan()
      • line 163 of /backup/util/factories/backup_factory.class.php: call to backup_plan_builder::build_plan()
      • line 61 of /backup/util/plan/backup_plan.class.php: call to backup_factory::build_plan()
      • line 333 of /backup/controller/backup_controller.class.php: call to backup_plan->build()
      • line 126 of /backup/controller/backup_controller.class.php: call to backup_controller->load_plan()
      • line 82 of /backup/backup.php: call to backup_controller->__construct()

      The query that is failing to get a row is in get_coursemodule_from_id():
      SELECT cm.*, m.name, md.name AS modname
      FROM mdl_course_modules cm
      JOIN mdl_modules md ON md.id = cm.module
      JOIN mdl_forum m ON m.id = cm.instance
      WHERE cm.id = 1119 AND md.name = 'forum'

      I rewrote the query to find out that cm.instance == 247 but there is no forum with that ID. There are higher IDs indicating that the forum did exist but was deleted. Petr has suggested this may be caused by double clicking the link to add a forum.

      Im now not able to backup my course. Ideally we'd prevent this occurring in the first place but at a minimum we need to be able to recover from this once it occurs.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  24 Vote for this issue
                  Watchers:
                  26 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    12/Mar/12