moodleou / moodle-mod_oublog

Alternative blog module for Moodle 2 (including course blogs)
31 stars 27 forks source link

Error creating OU blog #121

Open penumbrante opened 2 years ago

penumbrante commented 2 years ago

Hi, I'm getting this messaje:

Duplicate column name 'firstnamephonetic' SELECT COUNT(1) FROM (SELECT c.id, c.postid, c.title, c.message, c.timeposted, a.id AS authorid, a.firstnamephonetic, a.lastnamephonetic, a.middlename, a.alternatename, a.firstname, a.lastname,pa.firstnamephonetic, pa.lastnamephonetic, pa.middlename, pa.alternatename, pa.firstname, pa.lastname, p.title AS posttitle, p.timeposted AS postdate FROM mdl_user a, mdl_oublog_comments c INNER JOIN mdl_oublog_posts p ON (c.postid = p.id) INNER JOIN mdl_oublog_instances bi ON (bi.id = p.oubloginstancesid) INNER JOIN mdl_user pa on bi.userid = pa.id WHERE bi.oublogid = ? AND a.id = bi.userid AND p.timedeleted IS NULL AND c.userid = ? AND c.timedeleted IS NULL) p [array ( 0 => '7', 1 => '453535', )] Error code: dmlreadexception

....

Duplicate column name 'firstnamephonetic' SELECT COUNT(1) FROM (SELECT c.id, c.postid, c.title, c.message, c.timeposted, a.id AS authorid, a.firstnamephonetic, a.lastnamephonetic, a.middlename, a.alternatename, a.firstname, a.lastname,pa.firstnamephonetic, pa.lastnamephonetic, pa.middlename, pa.alternatename, pa.firstname, pa.lastname, p.title AS posttitle, p.timeposted AS postdate FROM mdl_user a, mdl_oublog_comments c INNER JOIN mdl_oublog_posts p ON (c.postid = p.id) INNER JOIN mdl_oublog_instances bi ON (bi.id = p.oubloginstancesid) INNER JOIN mdl_user pa on bi.userid = pa.id WHERE bi.oublogid = ? AND a.id = bi.userid AND p.timedeleted IS NULL AND c.userid = ? AND c.timedeleted IS NULL) p [array ( 0 => '7', 1 => '453535', )] Error code: dmlreadexception

....

any idea what es causing this issue?

jason-platts commented 2 years ago

Sorry about this - it appears there is a bug in the recent code changes that we did not spot as it is OK on our infrastructure (postgres database). mod/oublog/locallib.php image

If you change line 3571 to:

$postauthornamefields = $userfieldsapi->get_sql('pa', false, 'poster', '', false)->selects;

It should fix the issue with any luck... thanks for reporting, and if there are similar errors elsewhere please update here and I can advise of a fix.

GirlieNinja commented 2 years ago

Can you fix this in the code and push it out to moodle.org?

jstilwell commented 2 years ago

Hi Jason, we're also seeing this issue on our platform. Do you just need a pull request for the proposed change in order to push up the fixed version to moodle.org?

jason-platts commented 2 years ago

There is a new version with this fix on moodle.org now...

michaelwayneharris87 commented 2 years ago

Hi @jason-platts, I'm having trouble finding the git commit for the current version that is on moodle.org. We like to keep track of updates by pulling the repo. It looks like the tip of MOODLE_311_STABLE still points to 2020091401. Can you point me in the right direction?

jason-platts commented 2 years ago

Note there is no git version of the fix mentioned in this issue.... due to our git release strategy it won't turn up in github till March.

(Also the versioning on moodle.org is artificial. I had to manually increment the version as it doesn't allow you to update the download without a new version number)

michaelwayneharris87 commented 2 years ago

Ah got it — thanks!

nrosenquist commented 2 years ago

Hi @jason-platts, outside of forking and editing a new repo to use for a few weeks, is there any way to pull code with this fix included via git before March? My team clones from this repo directly for our Moodle builds and this is currently a breaking issue for some clients. TY!

michaelwayneharris87 commented 2 years ago

I second what @nrosenquist is suggesting — It would be very helpful if the code on github was up-to-date. As it is, we've had to stop cloning the github repo for our projects, which adds overhead to our workflows.

jason-platts commented 2 years ago

I've updated github with our latest code early - hopefully this will resolve the issues you are seeing.