Moodle
  1. Moodle
  2. MDL-34711

Single discussion forums can not be added

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.4
    • Fix Version/s: 2.4
    • Component/s: Forum
    • Labels:
    • Testing Instructions:
      Hide
      1. As an admin or teacher go to a course
      2. As an admin or teacher create a forum instance with "Forum type" set as "A single simple discussion"
      3. You SHOULD be able to create the forum instance without any exceptions thrown
      Show
      As an admin or teacher go to a course As an admin or teacher create a forum instance with "Forum type" set as "A single simple discussion" You SHOULD be able to create the forum instance without any exceptions thrown
    • Affected Branches:
      MOODLE_24_STABLE
    • Fixed Branches:
      MOODLE_24_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-34711_master
    • Rank:
      43175

      Description

      When trying to add a forum instance with "single discussion" as forum type moodle throws a "Can not find data record in database table course_modules" exception. It seems a regression caused by MDL-32229

      The course module is not set until MODULENAME_add_instance() finishes. forum_trigger_content_uploaded_event() should only be called if there is a course module id

      Debug info: SELECT id,course FROM {course_modules} WHERE id IS NULL
      [array (
      )]
      Error code: invalidrecord
      Stack trace:
      line 1321 of /lib/dml/moodle_database.php: dml_missing_record_exception thrown
      line 1297 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
      line 6783 of /lib/accesslib.php: call to moodle_database->get_record()
      line 4572 of /mod/forum/lib.php: call to context_module::instance()
      line 4440 of /mod/forum/lib.php: call to forum_trigger_content_uploaded_event()
      line 96 of /mod/forum/lib.php: call to forum_add_discussion()
      line 447 of /course/modedit.php: call to forum_add_instance()
      Output buffer: Notice: Trying to get property of non-object in /home/davidm/Desktop/moodlecode/master/mod/forum/lib.php on line 4572 Call Stack: 0.0011 1025336 1. {main}() /home/davidm/Desktop/moodlecode/master/course/modedit.php:0 0.3279 54118680 2. forum_add_instance() /home/davidm/Desktop/moodlecode/master/course/modedit.php:447 0.5536 54207760 3. forum_add_discussion() /home/davidm/Desktop/moodlecode/master/mod/forum/lib.php:96 0.7051 54313000 4. forum_trigger_content_uploaded_event() /home/davidm/Desktop/moodlecode/master/mod/forum/lib.php:4440
      

        Issue Links

          Activity

          David Monllaó created issue -
          David Monllaó made changes -
          Field Original Value New Value
          Assignee moodle.com [ moodle.com ] David Monllaó [ davmon ]
          Hide
          David Monllaó added a comment -

          Adding pull branch, only master

          Show
          David Monllaó added a comment - Adding pull branch, only master
          David Monllaó made changes -
          Pull Master Diff URL https://github.com/dmonllao/moodle/compare/master...MDL-34711_master
          Pull Master Branch MDL-34711_master
          Testing Instructions # As an admin or teacher go to a course
          # As an admin or teacher create a forum instance with "Forum type" set as "A single simple discussion"
          # You SHOULD be able to create the forum instance without any exceptions thrown
          Pull from Repository git://github.com/dmonllao/moodle.git
          David Monllaó made changes -
          Link This issue is a regression caused by MDL-32229 [ MDL-32229 ]
          David Monllaó made changes -
          Description When trying to add a forum instance with "single discussion" as forum type moodle throws a "Can not find data record in database table course_modules" exception. It seems a regression caused by MDL-32229

          The course module is not set until MODULENAME_add_instance() finishes. forum_trigger_content_uploaded_event() should only be called if there is a course module id
          When trying to add a forum instance with "single discussion" as forum type moodle throws a "Can not find data record in database table course_modules" exception. It seems a regression caused by MDL-32229

          The course module is not set until MODULENAME_add_instance() finishes. forum_trigger_content_uploaded_event() should only be called if there is a course module id

          {noformat}
          Debug info: SELECT id,course FROM {course_modules} WHERE id IS NULL
          [array (
          )]
          Error code: invalidrecord
          Stack trace:
          line 1321 of /lib/dml/moodle_database.php: dml_missing_record_exception thrown
          line 1297 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
          line 6783 of /lib/accesslib.php: call to moodle_database->get_record()
          line 4572 of /mod/forum/lib.php: call to context_module::instance()
          line 4440 of /mod/forum/lib.php: call to forum_trigger_content_uploaded_event()
          line 96 of /mod/forum/lib.php: call to forum_add_discussion()
          line 447 of /course/modedit.php: call to forum_add_instance()
          Output buffer: Notice: Trying to get property of non-object in /home/davidm/Desktop/moodlecode/master/mod/forum/lib.php on line 4572 Call Stack: 0.0011 1025336 1. {main}() /home/davidm/Desktop/moodlecode/master/course/modedit.php:0 0.3279 54118680 2. forum_add_instance() /home/davidm/Desktop/moodlecode/master/course/modedit.php:447 0.5536 54207760 3. forum_add_discussion() /home/davidm/Desktop/moodlecode/master/mod/forum/lib.php:96 0.7051 54313000 4. forum_trigger_content_uploaded_event() /home/davidm/Desktop/moodlecode/master/mod/forum/lib.php:4440
          David Monllaó made changes -
          Description When trying to add a forum instance with "single discussion" as forum type moodle throws a "Can not find data record in database table course_modules" exception. It seems a regression caused by MDL-32229

          The course module is not set until MODULENAME_add_instance() finishes. forum_trigger_content_uploaded_event() should only be called if there is a course module id

          {noformat}
          Debug info: SELECT id,course FROM {course_modules} WHERE id IS NULL
          [array (
          )]
          Error code: invalidrecord
          Stack trace:
          line 1321 of /lib/dml/moodle_database.php: dml_missing_record_exception thrown
          line 1297 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
          line 6783 of /lib/accesslib.php: call to moodle_database->get_record()
          line 4572 of /mod/forum/lib.php: call to context_module::instance()
          line 4440 of /mod/forum/lib.php: call to forum_trigger_content_uploaded_event()
          line 96 of /mod/forum/lib.php: call to forum_add_discussion()
          line 447 of /course/modedit.php: call to forum_add_instance()
          Output buffer: Notice: Trying to get property of non-object in /home/davidm/Desktop/moodlecode/master/mod/forum/lib.php on line 4572 Call Stack: 0.0011 1025336 1. {main}() /home/davidm/Desktop/moodlecode/master/course/modedit.php:0 0.3279 54118680 2. forum_add_instance() /home/davidm/Desktop/moodlecode/master/course/modedit.php:447 0.5536 54207760 3. forum_add_discussion() /home/davidm/Desktop/moodlecode/master/mod/forum/lib.php:96 0.7051 54313000 4. forum_trigger_content_uploaded_event() /home/davidm/Desktop/moodlecode/master/mod/forum/lib.php:4440
          When trying to add a forum instance with "single discussion" as forum type moodle throws a "Can not find data record in database table course_modules" exception. It seems a regression caused by MDL-32229

          The course module is not set until MODULENAME_add_instance() finishes. forum_trigger_content_uploaded_event() should only be called if there is a course module id

          {noformat}
          Debug info: SELECT id,course FROM {course_modules} WHERE id IS NULL
          [array (
          )]
          Error code: invalidrecord
          Stack trace:
          line 1321 of /lib/dml/moodle_database.php: dml_missing_record_exception thrown
          line 1297 of /lib/dml/moodle_database.php: call to moodle_database->get_record_select()
          line 6783 of /lib/accesslib.php: call to moodle_database->get_record()
          line 4572 of /mod/forum/lib.php: call to context_module::instance()
          line 4440 of /mod/forum/lib.php: call to forum_trigger_content_uploaded_event()
          line 96 of /mod/forum/lib.php: call to forum_add_discussion()
          line 447 of /course/modedit.php: call to forum_add_instance()
          Output buffer: Notice: Trying to get property of non-object in /home/davidm/Desktop/moodlecode/master/mod/forum/lib.php on line 4572 Call Stack: 0.0011 1025336 1. {main}() /home/davidm/Desktop/moodlecode/master/course/modedit.php:0 0.3279 54118680 2. forum_add_instance() /home/davidm/Desktop/moodlecode/master/course/modedit.php:447 0.5536 54207760 3. forum_add_discussion() /home/davidm/Desktop/moodlecode/master/mod/forum/lib.php:96 0.7051 54313000 4. forum_trigger_content_uploaded_event() /home/davidm/Desktop/moodlecode/master/mod/forum/lib.php:4440
          {noformat}
          Michael de Raadt made changes -
          Fix Version/s STABLE Sprint 23 [ 12358 ]
          Priority Minor [ 4 ] Blocker [ 1 ]
          Labels patch triaged
          David Monllaó made changes -
          Status Open [ 1 ] Waiting for peer review [ 10012 ]
          Dan Poltawski made changes -
          Original Estimate 0 minutes [ 0 ]
          Remaining Estimate 0 minutes [ 0 ]
          Status Waiting for peer review [ 10012 ] Peer review in progress [ 10013 ]
          Peer reviewer poltawski
          Hide
          Dan Poltawski added a comment -

          Hi David,

          Your fix makes sense, but adding Dan Marsden here, because it makes me wonder if we added the plagarism check at the wrong place, or will this prevent the initial forum post from being checked when it should be?

          Show
          Dan Poltawski added a comment - Hi David, Your fix makes sense, but adding Dan Marsden here, because it makes me wonder if we added the plagarism check at the wrong place, or will this prevent the initial forum post from being checked when it should be?
          Dan Poltawski made changes -
          Status Peer review in progress [ 10013 ] Development in progress [ 3 ]
          Hide
          Dan Marsden added a comment -

          Thanks Dan/David - yeah that suggests we've got it in the wrong place... not sure how I missed that one... I'll take a look

          Show
          Dan Marsden added a comment - Thanks Dan/David - yeah that suggests we've got it in the wrong place... not sure how I missed that one... I'll take a look
          Hide
          Dan Marsden added a comment -

          ah - I see now, although I do see a TODO in that function:

          TODO: Fix the calling code so that there always is a $cm when this function is called.
          (and various other !empty($cm->id) checks in that same function.

          creation of a new forum isn't an event that should be handled by a plagiarism event so my +1 for Davids commit - thanks David.

          Show
          Dan Marsden added a comment - ah - I see now, although I do see a TODO in that function: TODO: Fix the calling code so that there always is a $cm when this function is called. (and various other !empty($cm->id) checks in that same function. creation of a new forum isn't an event that should be handled by a plagiarism event so my +1 for Davids commit - thanks David.
          Dan Marsden made changes -
          Status Development in progress [ 3 ] Waiting for integration review [ 10010 ]
          Sam Hemelryk made changes -
          Currently in integration Yes [ 10041 ]
          Eloy Lafuente (stronk7) made changes -
          Status Waiting for integration review [ 10010 ] Integration review in progress [ 10004 ]
          Integrator stronk7
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Integrated, thanks!

          Show
          Eloy Lafuente (stronk7) added a comment - Integrated, thanks!
          Eloy Lafuente (stronk7) made changes -
          Status Integration review in progress [ 10004 ] Waiting for testing [ 10005 ]
          Fix Version/s 2.4 [ 12255 ]
          Adrian Greeve made changes -
          Status Waiting for testing [ 10005 ] Testing in progress [ 10011 ]
          Tester abgreeve
          Hide
          Adrian Greeve added a comment -

          Tested in master.
          No problems found.
          Test passed.

          Show
          Adrian Greeve added a comment - Tested in master. No problems found. Test passed.
          Adrian Greeve made changes -
          Status Testing in progress [ 10011 ] Tested [ 10006 ]
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Fixed STOP Closed STOP Thanks STOP

          Yay, imagination! Ciao

          Show
          Eloy Lafuente (stronk7) added a comment - Fixed STOP Closed STOP Thanks STOP Yay, imagination! Ciao
          Eloy Lafuente (stronk7) made changes -
          Status Tested [ 10006 ] Closed [ 6 ]
          Resolution Fixed [ 1 ]
          Currently in integration Yes [ 10041 ]
          Integration date 09/Aug/12
          Eloy Lafuente (stronk7) made changes -
          Fix Version/s STABLE Sprint 23 Alpha [ 12358 ]

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: