moodleou / moodle-mod_forumng

ForumNG forum module for Moodle
19 stars 20 forks source link

Moodle 2.7 Issue - course content cannot be displayed #27

Closed aspark21 closed 10 years ago

aspark21 commented 10 years ago

This seems to be preventing the content of a course from being loaded in Moodle 2.7 if a ForumNG forum has unread posts. Also prevents My Home from loading (this also displays unread posts).

Running Moodle 2.7 & current master branch of forumng

Debug info below:

cm_info::get_custom_data() is deprecated, please use the property cm_info->customdata instead. line 1156 of /lib/modinfolib.php: call to debugging() line 389 of /mod/forumng/mod_forumng.php: call to cm_info->call() line 389 of /mod/forumng/mod_forumng.php: call to cm_info->get_custom_data() line 3145 of /mod/forumng/mod_forumng.php: call to mod_forumng::get_type_from_modinfo_info() line 2989 of /mod/forumng/mod_forumng.php: call to mod_forumng::query_forums() line 443 of /mod/forumng/lib.php: call to mod_forumng::get_course_forums() line 1977 of /lib/modinfolib.php: call to mod_forumng_cm_info_view() line 2009 of /lib/modinfolib.php: call to cm_info->call_mod_function() line 1356 of /lib/modinfolib.php: call to cm_info->obtain_view_data() line 1176 of /lib/modinfolib.php: call to cm_info->get_after_link() line 996 of /course/renderer.php: call to cm_info->get() line 919 of /course/renderer.php: call to core_course_renderer->course_section_cm() line 1088 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 56 of /course/format/topics/format.php: call to format_section_renderer_base->print_multiple_section_page() line 279 of /course/view.php: call to require()

Debug info: Unknown column 'cm.availablefrom' in 'field list'

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, 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,cm.availablefrom as cm_availablefrom,cm.availableuntil as cm_availableuntil,cm.showavailability as cm_showavailability, 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 <= ?) AND (cfd.timeend = 0 OR cfd.timeend > ?)) OR (cfd.forumngid = ?) ) ) AS f_numdiscussions, (EXISTS (SELECT 1 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 = ? WHERE fd.forumngid = f.id AND fplast.modified>? AND ( (fd.groupid IS NULL) OR ((1=0)) OR cm.groupmode = 2 OR (fd.forumngid = ?) ) AND fd.deleted = 0 AND ( ((fd.timestart = 0 OR fd.timestart <= ?) AND (fd.timeend = 0 OR fd.timeend > ?)) OR (fd.forumngid = ?) ) AND ((fplast.edituserid IS NOT NULL AND fplast.edituserid<>?) OR fplast.userid<>?) AND (fr.time IS NULL OR fplast.modified>fr.time) ))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 = ? AND cm.id = ? ORDER BY LOWER(f.name) [array ( 0 => 1400616012, 1 => 1400616012, 2 => '2', 3 => '9', 4 => 1395432012, 5 => '2', 6 => 1400616012, 7 => 1400616012, 8 => '2', 9 => '9', 10 => '9', 11 => '11', 12 => '118', )] Error code: dmlreadexception Stack trace: line 443 of /lib/dml/moodle_database.php: dml_read_exception thrown line 1014 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end() line 3263 of /mod/forumng/mod_forumng.php: call to mysqli_native_moodle_database->get_records_sql() line 2989 of /mod/forumng/mod_forumng.php: call to mod_forumng::query_forums() line 443 of /mod/forumng/lib.php: call to mod_forumng::get_course_forums() line 1977 of /lib/modinfolib.php: call to mod_forumng_cm_info_view() line 2009 of /lib/modinfolib.php: call to cm_info->call_mod_function() line 1356 of /lib/modinfolib.php: call to cm_info->obtain_view_data() line 1176 of /lib/modinfolib.php: call to cm_info->get_after_link() line 996 of /course/renderer.php: call to cm_info->__get() line 919 of /course/renderer.php: call to core_course_renderer->course_section_cm() line 1088 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 56 of /course/format/topics/format.php: call to format_section_renderer_base->print_multiple_section_page() line 279 of /course/view.php: call to require()

sammarshallou commented 10 years ago

Thanks for reporting!

I happen to be familiar with this issue (since it was me who removed the availablefrom field). This needs fixing, but our master branch is still relating to Moodle 2.6 until some point in September, so we can't make this change in our codebase for a while. (There's an explanation of our release schedule in my blog from last year: http://learn1.open.ac.uk/mod/oublog/viewpost.php?post=0&u=sm449&time=1369232093 )


sam marshall Leading Technical Developer Information Technology Berrill Level 2

(01908) 655673 Study with the OU :: www.open.ac.uk

-----Original Message----- From: aspark21 [mailto:notifications@github.com] Sent: 20 May 2014 21:09 To: moodleou/moodle-mod_forumng Subject: [moodle-mod_forumng] Moodle 2.7 Issue - course content cannot be displayed (#27)

This seems to be preventing the content of a course from being loaded in Moodle 2.7 if a ForumNG forum has unread posts. Also prevents My Home from loading (this also displays unread posts).

Running Moodle 2.7 & current master branch of forumng

Debug info below:

cm_info::get_custom_data() is deprecated, please use the property cm_info->customdata instead. line 1156 of /lib/modinfolib.php: call to debugging() line 389 of /mod/forumng/mod_forumng.php: call to cm_info->__call() line 389 of /mod/forumng/mod_forumng.php: call to cm_info-

get_custom_data() line 3145 of /mod/forumng/mod_forumng.php: call to mod_forumng::get_type_from_modinfo_info() line 2989 of /mod/forumng/mod_forumng.php: call to mod_forumng::query_forums() line 443 of /mod/forumng/lib.php: call to mod_forumng::get_course_forums() line 1977 of /lib/modinfolib.php: call to mod_forumng_cm_info_view() line 2009 of /lib/modinfolib.php: call to cm_info->call_mod_function() line 1356 of /lib/modinfolib.php: call to cm_info->obtain_view_data() line 1176 of /lib/modinfolib.php: call to cm_info->get_after_link() line 996 of /course/renderer.php: call to cm_info->__get() line 919 of /course/renderer.php: call to core_course_renderer- course_section_cm() line 1088 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 56 of /course/format/topics/format.php: call to format_section_renderer_base->print_multiple_section_page() line 279 of /course/view.php: call to require()

Debug info: Unknown column 'cm.availablefrom' in 'field list'

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, 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,cm.availablefrom as cm_availablefrom,cm.availableuntil as cm_availableuntil,cm.showavailability as cm_showavailability, 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 <= ?) AND (cfd.timeend = 0 OR cfd.timeend > ?)) OR (cfd.forumngid = ?) ) ) AS f_numdiscussions, (EXISTS (SELECT 1 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 = ? WHERE fd.forumngid = f.id AND fplast.modified>? AND ( (fd.groupid IS NULL) OR ((1=0)) OR cm.groupmode = 2 OR (fd.forumngid = ?) ) AND fd.deleted = 0 AND ( ((fd.timestart = 0 OR fd.timestart <= ?) AND (fd.timeend = 0 OR fd.timeend > ?)) OR (fd.forumngid = ?) ) AND ((fplast.edituserid IS NOT NULL AND fplast.edituserid<>?) OR fplast.userid<>?) AND (fr.time IS NULL OR fplast.modified>fr.time) ))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 = ? AND cm.id = ? ORDER BY LOWER(f.name) [array ( 0 => 1400616012, 1 => 1400616012, 2 => '2', 3 => '9', 4 => 1395432012, 5 => '2', 6 => 1400616012, 7 => 1400616012, 8 => '2', 9 => '9', 10 => '9', 11 => '11', 12 => '118', )] Error code: dmlreadexception Stack trace: line 443 of /lib/dml/moodle_database.php: dml_read_exception thrown line 1014 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end() line 3263 of /mod/forumng/mod_forumng.php: call to mysqli_native_moodle_database->get_records_sql() line 2989 of /mod/forumng/mod_forumng.php: call to mod_forumng::query_forums() line 443 of /mod/forumng/lib.php: call to mod_forumng::get_course_forums() line 1977 of /lib/modinfolib.php: call to mod_forumng_cm_info_view() line 2009 of /lib/modinfolib.php: call to cm_info->call_mod_function() line 1356 of /lib/modinfolib.php: call to cm_info->obtain_view_data() line 1176 of /lib/modinfolib.php: call to cm_info->get_after_link() line 996 of /course/renderer.php: call to cm_info->__get() line 919 of /course/renderer.php: call to core_course_renderer-

course_section_cm() line 1088 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 56 of /course/format/topics/format.php: call to format_section_renderer_base->print_multiple_section_page() line 279 of /course/view.php: call to require()

— Reply to this email directly or view it on GitHub https://github.com/moodleou/moodle-mod_forumng/issues/27 . https://github.com/notifications/beacon/68663__eyJzY29wZSI6Ik5ld3NpZX M6QmVhY29uIiwiZXhwaXJlcyI6MTcxNjIzNTc0MCwiZGF0YSI6eyJpZCI6MzI2O DM5Mzl9fQ==--15a6bf323c45cb57ea840438b4ca740e35190265.gif

-- The Open University is incorporated by Royal Charter (RC 000391), an exempt charity in England & Wales and a charity registered in Scotland (SC 038302). The Open University is authorised and regulated by the Financial Conduct Authority.

aspark21 commented 10 years ago

OK dokes. Fair enough. Just thought I'd report this anyway & if anyone else considers using this on 2.7 they will be able to know about this. :)

sammarshallou commented 10 years ago

Yes I didn't mean that you shouldn't report it, that's very useful, thanks! Just explaining why we can't fix it in our codebase for a bit.

--sam


sam marshall Leading Technical Developer Information Technology Berrill Level 2

(01908) 655673 Study with the OU :: www.open.ac.uk

-----Original Message----- From: aspark21 [mailto:notifications@github.com] Sent: 21 May 2014 18:25 To: moodleou/moodle-mod_forumng Cc: sam marshall Subject: Re: [moodle-mod_forumng] Moodle 2.7 Issue - course content cannot be displayed (#27)

OK dokes. Fair enough. Just thought I'd report this anyway & if anyone else considers using this on 2.7 they will be able to know about this. :)

— Reply to this email directly or view it on GitHub https://github.com/moodleou/moodle- mod_forumng/issues/27#issuecomment-43788153 . https://github.com/notifications/beacon/68663__eyJzY29wZSI6Ik5ld3NpZX M6QmVhY29uIiwiZXhwaXJlcyI6MTcxNjMxMjI4NywiZGF0YSI6eyJpZCI6MzI2O DM5Mzl9fQ==--53a9d75454de2754088cf8b5555cd5437532ed42.gif

-- The Open University is incorporated by Royal Charter (RC 000391), an exempt charity in England & Wales and a charity registered in Scotland (SC 038302). The Open University is authorised and regulated by the Financial Conduct Authority.

sammarshallou commented 10 years ago

Hi Colin,

Under the admin menu, Plugins/Activity modules - you should be able to click the eye icon next to ForumNG to turn it off, that might work.

--sam


sam marshall Leading Technical Developer Information Technology Berrill Level 2

(01908) 655673 Study with the OU :: www.open.ac.uk

-----Original Message----- From: colinmackinlay [mailto:notifications@github.com] Sent: 09 June 2014 00:59 To: moodleou/moodle-mod_forumng Cc: sam marshall Subject: Re: [moodle-mod_forumng] Moodle 2.7 Issue - course content cannot be displayed (#27)

All understood. Shame I didn't know that before I upgraded my moodle to 2.7!

Anybody know how to remove forumng from all the courses which now can't display?! Of course the normal way is to turn editing on and just use the option to remove but that isn't displayed because of the errors. Any ideas much appreciated!

— Reply to this email directly or view it on GitHub https://github.com/moodleou/moodle- mod_forumng/issues/27#issuecomment-45452508 . https://github.com/notifications/beacon/68663__eyJzY29wZSI6Ik5ld3NpZX M6QmVhY29uIiwiZXhwaXJlcyI6MTcxNzg5MTEyNiwiZGF0YSI6eyJpZCI6MzI2O DM5Mzl9fQ==--1f8badd6db7a9470ebd1d62e6fe0f0fad34c38ad.gif

-- The Open University is incorporated by Royal Charter (RC 000391), an exempt charity in England & Wales and a charity registered in Scotland (SC 038302). The Open University is authorised and regulated by the Financial Conduct Authority.

colinmackinlay commented 10 years ago

Sam,

Many thanks for taking the time to answer. I removed my post because I found a solution fairly soon afterwards and didn’t want to trouble you. A bit of a sledgehammer but I just removed the forumng folder from the mods folder on my server for the moment! I’ll look at your solution though as that would be a bit more elegant and less likely to lead to problems.

Thanks again for taking the time to reply!

Colin

From: sam marshall [mailto:notifications@github.com] Sent: 09 June 2014 10:23 To: moodleou/moodle-mod_forumng Cc: Colin Mackinlay Subject: Re: [moodle-mod_forumng] Moodle 2.7 Issue - course content cannot be displayed (#27)

Hi Colin,

Under the admin menu, Plugins/Activity modules - you should be able to click the eye icon next to ForumNG to turn it off, that might work.

--sam


sam marshall Leading Technical Developer Information Technology Berrill Level 2

(01908) 655673 Study with the OU :: www.open.ac.uk

-----Original Message----- From: colinmackinlay [mailto:notifications@github.com] Sent: 09 June 2014 00:59 To: moodleou/moodle-mod_forumng Cc: sam marshall Subject: Re: [moodle-mod_forumng] Moodle 2.7 Issue - course content cannot be displayed (#27)

All understood. Shame I didn't know that before I upgraded my moodle to 2.7!

Anybody know how to remove forumng from all the courses which now can't display?! Of course the normal way is to turn editing on and just use the option to remove but that isn't displayed because of the errors. Any ideas much appreciated!

— Reply to this email directly or view it on GitHub https://github.com/moodleou/moodle- mod_forumng/issues/27#issuecomment-45452508 . https://github.com/notifications/beacon/68663__eyJzY29wZSI6Ik5ld3NpZX M6QmVhY29uIiwiZXhwaXJlcyI6MTcxNzg5MTEyNiwiZGF0YSI6eyJpZCI6MzI2O DM5Mzl9fQ==--1f8badd6db7a9470ebd1d62e6fe0f0fad34c38ad.gif

-- The Open University is incorporated by Royal Charter (RC 000391), an exempt charity in England & Wales and a charity registered in Scotland (SC 038302). The Open University is authorised and regulated by the Financial Conduct Authority.

— Reply to this email directly or view it on GitHubhttps://github.com/moodleou/moodle-mod_forumng/issues/27#issuecomment-45474044.

nadavkav commented 10 years ago

Just saw this one too, on Moodle 2.7 API release notes it was noted that it was deprecated: http://git.moodle.org/gw?p=moodle.git;a=blob;f=lib/upgrade.txt;hb=master#l76

So to workaround it (seems like I lost some functionality, until Sam fixes it) I removed the relevant course_modules fields - 'availablefrom', 'availableuntil', 'showavailability' from the list and left with the following: mod/forumng/mod_forumng_utils.php

public static function select_course_module_fields($alias) {
        $fields = array('id', 'course', 'module', 'instance', 'section',
            'added', 'score', 'indent', 'visible', 'visibleold', 'groupmode',
            'groupingid', 'idnumber', 'groupmembersonly', 'completion',
              'completiongradeitemnumber', 'completionview',
              'completionexpected');

        return self::select_fields($fields, $alias);
    }

Everything is working now :smile:
(except deprecated calls to mdl_log)

jason-platts commented 10 years ago

Should now be working in master branch code https://github.com/moodleou/moodle-mod_forumng/commit/da9765c5d43d23ab4e120ac70d60d09f68310964

aspark21 commented 10 years ago

Awesome! Thanks!

nadavkav commented 10 years ago

Bless you :smile_cat: