moodleou / moodle-mod_forumng

ForumNG forum module for Moodle
19 stars 20 forks source link

2.8 - New posts Email output #45

Closed aspark21 closed 9 years ago

aspark21 commented 9 years ago

Moodle 2.8.5+ Latest Stable branch ForumNG Latest master branch DB - MariaDB

If a student is subscribed & a new post is made, email notifications are not sent.

Email does work on the server & more generally - forwarding a post does work for example.

I would speculate it is due to the new Scheduled tasks causing this but cannot seem get any error logs for this.

aspark21 commented 9 years ago

@jason-platts @athompson697 Any ideas about this? I believe this is now also a problem on 2.7 latest Looks like it could be related to these commits Under 2.8 - https://github.com/moodleou/moodle-mod_forumng/commit/86025aba44dbb47187367e73c33d6d56060b06ae

Under 2.7 - https://github.com/moodleou/moodle-mod_forumng/commit/eddb72a9e845dd7dc77681d09d0c8af30736133c

jason-platts commented 9 years ago

No ideas I'm afraid that spring to mind. The change to scheduled tasks didn't really alter any of the functions that send the email so I'm not sure why it isn't working for you. Did you check the cron logs to see that the forumng email tasks were being run?

aspark21 commented 9 years ago

Took a bit of messing about to get this as this doesn't get logged by Moodle, so had to switch off cron and run it manually to get this:

Execute scheduled task: Forumng email sending job ... started 17:33:52. Current memory use 13.6MB. Email processing: Initial query: 0s Exception while getting subscribers for forum 5 exception 'coding_exception' with message 'Coding error detected, it must be fixed by a programmer: PHP catchable fatal error' in /path/to/moodle/lib/setuplib.php:393 Stack trace:

0 /path/to/moodle/availability/classes/info_module.php(45): default_error_handler(4096, 'Argument 1 pass...', '/path/to/moodle...', 45, Array)

1 /path/to/moodle/mod/forumng/mod_forumng.php(2177): core_availability\info_module->__construct(Object(stdClass))

2 /path/to/moodle/mod/forumng/mod_forumng.php(2239): mod_forumng->get_auto_subscribers(NULL)

3 /path/to/moodle/mod/forumng/mod_forumng_cron.php(193): mod_forumng->get_subscribers()

4 /path/to/moodle/mod/forumng/classes/task/email_normal.php(48): mod_forumng_cron::email_normal()

5 /path/to/moodle/lib/cronlib.php(74): mod_forumng\task\email_normal->execute()

6 /path/to/moodle/admin/cron.php(81): cron_run()

7 {main}

Marking processed posts: 0s. Email processing (1 new posts, 0 new emails) complete, total: 0.1s (mail sending 0s = 0%) ... used 11 dbqueries ... used 0.096912860870361 seconds Scheduled task complete: Forumng email sending job

jason-platts commented 9 years ago

Ah, so you are using auto subscribers... We don't use that option so there is potential for errors there to slip through the testing net. Saying that I can't see any immediately obvious problems looking at the code. Does 'View subscribers' page work in the forum as that calls the same code?

aspark21 commented 9 years ago

Yes the 'View Subscribers' page does load and the data is accurate - it's one of the first things I check now before an upgrade as it has been a blocker in the past.

That being said, we're not seeing any email going out wether the forum is auto / forced / opt-in so not sure it would be limited to that.

jason-platts commented 9 years ago

I can replicate this, so will have a look to see if I can fix...

villamizar commented 9 years ago

I am using Moodle 2.8.5 with a PostgreSQL database, I installed ForumNG (2015012700) and it is not working at all, should I be using a different version, or should I update some of this version's files to make it work properly? Please see the debugging information that I received from the system:

Debug info: ERROR: column cm.groupmembersonly does not exist LINE 4: ...ingid as cm_groupingid,cm.idnumber as cm_idnumber,cm.groupme... ^

SELECT f.id as f_id,f.course as f_course,f.name as f_name,f.type as f_type,f.intro as f_intro,f.ratingscale as f_ratingscale,f.ratingfrom as f_ratingfrom,f.ratinguntil as f_ratinguntil,f.grading as f_grading,f.attachmentmaxbytes as f_attachmentmaxbytes,f.reportingemail as f_reportingemail,f.subscription as f_subscription,f.feedtype as f_feedtype,f.feeditems as f_feeditems,f.maxpostsperiod as f_maxpostsperiod,f.maxpostsblock as f_maxpostsblock,f.postingfrom as f_postingfrom,f.postinguntil as f_postinguntil,f.typedata as f_typedata,f.magicnumber as f_magicnumber,f.originalcmid as f_originalcmid,f.shared as f_shared,f.canpostanon as f_canpostanon,f.tags as f_tags,f.enableratings as f_enableratings, cm.id as cm_id,cm.course as cm_course,cm.module as cm_module,cm.instance as cm_instance,cm.section as cm_section,cm.added as cm_added,cm.score as cm_score,cm.indent as cm_indent,cm.visible as cm_visible,cm.visibleold as cm_visibleold,cm.groupmode as cm_groupmode,cm.groupingid as cm_groupingid,cm.idnumber as cm_idnumber,cm.groupmembersonly as cm_groupmembersonly,cm.completion as cm_completion,cm.completiongradeitemnumber as cm_completiongradeitemnumber,cm.completionview as cm_completionview,cm.completionexpected as cm_completionexpected, c.id as c_id,c.shortname as c_shortname,c.fullname as c_fullname,c.format as c_format, (SELECT COUNT(1) FROM mdl_forumng_discussions cfd WHERE cfd.forumngid = f.id AND cfd.deleted = 0 AND ( ((cfd.timestart = 0 OR cfd.timestart <= $1) AND (cfd.timeend = 0 OR cfd.timeend > $2)) OR (cfd.forumngid = $3) ) ) AS f_numdiscussions, (EXISTS (SELECT 1 FROM (SELECT fd.id, fr.time, fd.forumngid FROM mdl_forumng_discussions fd INNER JOIN mdl_forumng_posts fplast ON fd.lastpostid = fplast.id INNER JOIN mdl_forumng_posts fpfirst ON fd.postid = fpfirst.id LEFT JOIN mdl_forumng_read fr ON fd.id = fr.discussionid AND fr.userid = $4 INNER JOIN mdl_course_modules cm2 ON cm2.instance = fd.forumngid AND cm2.module = (SELECT id FROM mdl_modules WHERE name = 'forumng') WHERE fplast.modified > $5 AND ( (fd.groupid IS NULL) OR ((1=0)) OR cm2.groupmode = 2 OR (fd.forumngid = $6) ) AND fd.deleted = 0 AND ( ((fd.timestart = 0 OR fd.timestart <= $7) AND (fd.timeend = 0 OR fd.timeend > $8)) OR (fd.forumngid = $9) ) AND ((fplast.edituserid IS NOT NULL AND fplast.edituserid <> $10) OR fplast.userid <> $11) AND (fr.time IS NULL OR fplast.modified > fr.time)

) discussions

WHERE discussions.forumngid = f.id ))AS f_hasunreaddiscussions FROM mdl_forumng f INNER JOIN mdl_course_modules cm ON cm.instance = f.id AND cm.module = (SELECT id from mdl_modules WHERE name = 'forumng') INNER JOIN mdl_course c ON c.id = f.course WHERE f.course = $12 AND cm.id = $13 ORDER BY LOWER(f.name) [array ( 0 => 1429720901, 1 => 1429720901, 2 => '2', 3 => '11', 4 => 1424536901, 5 => '2', 6 => 1429720901, 7 => 1429720901, 8 => '2', 9 => '11', 10 => '11', 11 => '12', 12 => '359', )] Error code: dmlreadexception Stack trace: line 443 of /lib/dml/moodle_database.php: dml_read_exception thrown line 244 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end() line 764 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end() line 3398 of /mod/forumng/mod_forumng.php: call to pgsql_native_moodle_database->get_records_sql() line 3102 of /mod/forumng/mod_forumng.php: call to mod_forumng::query_forums() line 436 of /mod/forumng/lib.php: call to mod_forumng::get_course_forums() line 2020 of /lib/modinfolib.php: call to mod_forumng_cm_info_view() line 2052 of /lib/modinfolib.php: call to cm_info->call_mod_function() line 1353 of /lib/modinfolib.php: call to cm_info->obtain_view_data() line 1165 of /lib/modinfolib.php: call to cm_info->get_after_link() line 993 of /course/renderer.php: call to cm_info->__get() line 916 of /course/renderer.php: call to core_course_renderer->course_section_cm() line 1085 of /course/renderer.php: call to core_course_renderer->course_section_cm_list_item() line 735 of /course/format/renderer.php: call to core_course_renderer->course_section_cm_list() line 49 of /course/format/weeks/format.php: call to format_section_renderer_base->print_multiple_section_page() line 285 of /course/view.php: call to require()

Thank you very much! Sam Villamizar

aspark21 commented 9 years ago

@jason-platts Thanks for looking into!

@villamizar This looks oddly similar to #41 but this was fixed - Are you definitely on the latest master branch - last commit 9b3cb967177ab337eb0a5bf04ae4a2c0fd0655dd

jason-platts commented 9 years ago

Cron error on mail send should now be fixed in this commit: 68cb6b2df8dea29167a08782b31c952d6893fc76