open-lms-open-source / moodle-mod_lightboxgallery

Lightbox Gallery resource module for Moodle 2.0
GNU General Public License v3.0
30 stars 37 forks source link

Error message thrown only in unique circs #74

Closed peteratkjt closed 7 years ago

peteratkjt commented 7 years ago

Moodle 3.1, Lightbox Gallery 2.8.0.9. Was running fine, certainly before upgrade to 3.1 from 3.0. Now, if I try to add a new Lightbox resource to a course, I get the error message "Error writing to database" which, when clicking through for more info, leads to the dmlwriteexception page https://docs.moodle.org/31/en/error/moodle/dmlwriteexception.

I've had trouble before when my web hosts have upgraded Moodle for me, but it's always boiled down to file permissions. I checked these (as did the hosts) and they all look correctly set with folders 0755 and php files 0644.

But there's more. I checked an existing Gallery in another course, and it's working fine. Can view, edit, move - and duplicate (ie create a new resource). So my workaround is to duplicate the resource, import it into my new course and then do a total edit of rubrics and content. Works a treat. But makes the mystery more curious as to why I get an error when trying to do it the 'proper' way.

Anyone got any ideas please?

aolley commented 7 years ago

I don't suppose you have access to the php error logs on your webhost to get more detail about the error?

I've just done a quick test of the 2.8.0.9 lbg code on M3.1 and haven't been able to replicate the problem.

peteratkjt commented 7 years ago

Adam, so grateful for your assistance. The error log (via cPanel on my host's system) says:

[Mon Jan 30 08:19:29.648459 2017] [core:alert] [pid 5331] [client 77.104.129.20:40696] /home/equipfor/public_html/uploaddata/.htaccess: AllowOverride not allowed here [Mon Jan 30 08:19:29.646788 2017] [core:alert] [pid 17789] [client 77.104.129.20:40692] /home/equipfor/public_html/uploaddata/.htaccess: AllowOverride not allowed here [Mon Jan 30 08:19:29.645824 2017] [core:alert] [pid 17907] [client 77.104.129.20:40688] /home/equipfor/public_html/uploaddata/.htaccess: AllowOverride not allowed here

when I just tried to add a new lightbox gallery.

I also turned on advanced debugging and the attached pdf shows what Moodle threw back at me.

Hope that helps,

Peter Nicholls

Adam Olley wrote:

I don't suppose you have access to the php error logs on your webhost to get more detail about the error?

I've just done a quick test of the 2.8.0.9 lbg code on M3.1 and haven't been able to replicate the problem.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/netspotau/moodle-mod_lightboxgallery/issues/74#issuecomment-275954758, or mute the thread https://github.com/notifications/unsubscribe-auth/AYM4ICxGnAn98lJOAmJ9-EJADeXb4YXqks5rXR6EgaJpZM4LvQNZ.

aolley commented 7 years ago

Those errors dont look related to this. Also, github didn't appear to keep your attached file when you responded.

Goto: Site administration / ► Development / ► Debugging

And set debug messages to Developer and turn on "display debug messages" and try again. That should cause more detail to be displayed on the page when the issue happens (turn those settings back to what they were when you're done).

peteratkjt commented 7 years ago

HI again, this is what I did last time, in fact, but I suspect the info you need was in the attachment that was suppressed. Here's a cut and paste of the error message I just got from Moodle:

Debug info: Field 'perrow' doesn't have a default value INSERT INTO mdl_lightboxgallery (name,perpage,captionfull,captionpos,autoresize,comments,ispublic,extinfo,course,intro,introformat,timemodified,rss) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?) [array ( 0 => 'test', 1 => '0', 2 => '0', 3 => '0', 4 => '1', 5 => '0', 6 => '0', 7 => '0', 8 => '34', 9 => '

eflm;lwf

', 10 => '1', 11 => 1485858165, 12 => 0, )] Error code: dmlwriteexception

×Stack trace: line 477 of /lib/dml/moodle_database.php: dml_write_exception thrown line 1172 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end() line 1218 of /lib/dml/mysqli_native_moodle_database.php: call to mysqli_native_moodle_database->insert_record_raw() line 81 of /mod/lightboxgallery/lib.php: call to mysqli_native_moodle_database->insert_record() line 121 of /course/modlib.php: call to lightboxgallery_add_instance() line 275 of /course/modedit.php: call to add_moduleinfo()

The error log at the host end says:

[Tue Jan 31 10:21:21.380075 2017] [core:alert] [pid 26098] [client 77.104.129.20:54468] /home/equipfor/public_html/uploaddata/.htaccess: AllowOverride not allowed here [Tue Jan 31 10:21:21.378453 2017] [core:alert] [pid 26107] [client 77.104.129.20:54464] /home/equipfor/public_html/uploaddata/.htaccess: AllowOverride not allowed here [Tue Jan 31 10:21:21.377430 2017] [core:alert] [pid 26042] [client 77.104.129.20:54460] /home/equipfor/public_html/uploaddata/.htaccess: AllowOverride not allowed here

and I think this is associated with my attempt to add a lightbox gallery to the Moodle course, but no matter if it doesn't tell you anything.

Hope this helps,

Peter

Adam Olley wrote:

Those errors dont look related to this. Also, github didn't appear to keep your attached file when you responded.

Goto: Site administration / ► Development / ► Debugging

And set debug messages to Developer and turn on "display debug messages" and try again. That should cause more detail to be displayed on the page when the issue happens (turn those settings back to what they were when you're done).

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/netspotau/moodle-mod_lightboxgallery/issues/74#issuecomment-276229930, or mute the thread https://github.com/notifications/unsubscribe-auth/AYM4IORcFzCc94IxkRQP9WWX8FFGLkkXks5rXnd8gaJpZM4LvQNZ.

-- Peter Nicholls, King John's Thorn, Hethel NR14 8HE (01508 570557)

aolley commented 7 years ago

"Debug info: Field 'perrow' doesn't have a default value" So that's the problem right there, and that's weird because that column has always had a default from what I'm aware.

Do you have access to the database? This query should fix that for you: ALTER TABLE mdl_lightboxgallery ALTER perrow SET DEFAULT 0;

peteratkjt commented 7 years ago

Thanks so much. I asked my host to run that query and Lightbox, on a quick check, is working fine now.

The only way I could think of fixing it myself was to uninstall then reinstall afresh, hoping that this would fix any corruption there might be. But that would have wiped out loads of images I'd uploaded into 7 or more instances of LBG.

Glad you were able to diagnose, and I hope this might contribute to the wonderful pool of shared knowledge that is Moodle.

Best regards,

Peter Nicholls

Adam Olley wrote:

"Debug info: Field 'perrow' doesn't have a default value" So that's the problem right there, and that's weird because that column has always had a default from what I'm aware.

Do you have access to the database? This query should fix that for you: |ALTER TABLE mdl_lightboxgallery ALTER perrow SET DEFAULT 0;|

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/netspotau/moodle-mod_lightboxgallery/issues/74#issuecomment-276841516, or mute the thread https://github.com/notifications/unsubscribe-auth/AYM4IMRGokTywwDZh7scYenmttKtla_-ks5rYTS5gaJpZM4LvQNZ.

aolley commented 7 years ago

Glad to hear it, happy Moodling!