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

i have a row in course_module for a deleted forum

    XMLWordPrintable

Details

    • MySQL
    • MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • MOODLE_21_STABLE, MOODLE_22_STABLE
    • wip-mdl-25432
    • 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.

    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.

      Attachments

        1. duplicatedcontent.jpg
          duplicatedcontent.jpg
          22 kB
        2. fixbackups.zip
          2 kB
        3. fixbackups_2.zip
          2 kB

        Issue Links

          Activity

            People

              rajeshtaneja Rajesh Taneja
              andyjdavis Andrew Davis
              Ankit Agarwal Ankit Agarwal
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Gerard Caulfield Gerard Caulfield
              Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Stevani Andolo, Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Sujith Haridasan
              Votes:
              24 Vote for this issue
              Watchers:
              25 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                12/Mar/12