You are browsing the archive for Bug Fixes.

The importance of Moodle backups

December 14, 2011 in Bug Fixes, Featured, My ramblings

There is a phrase, or it may even be a brand slogan that says, “If it’s worth creating, it’s worth backing up“.  And from my experience this week, nothing could be closer to the truth.

As the size of the Leeds City College Moodle grows, so does the number of assignments, grades and feedback.  And as this grows, the critical importance of Moodle grows with it.  And ultimately it’s all my responsibility, sadly my salary doesn’t grow inline with it.

Last week we experienced a glitch that could have been catastrophic if it wasn’t for our regimented backup routines.
It was brought to my attention that a tutor on a course deleted a student assignment that had been uploaded in the wrong place.  The delete worked but it also deleted every other assignment in the course and every grade and feedback.

And that’s where the panic kicked in.

Over 335 assignments had gone, along with the tutors feedback.  This left me with 2 options;

  1. get each student to resubmit every piece of coursework from scratch and ask the tutor to re-grade them, or
  2. restore what I can from the backups

Option 1 was not possible, nor was it fair on the students or tutors.

Our Moodle database is backed up each day, the Moodle Data Directory is incrementally copied to a remote server so we can always roll back at least 24 hours.  Sometimes even further if required.

I couldn’t simply do a course restore as the course was in full time use, and since the disaster other students had submitted other assignments.  So to restore the course would lose even more data.

So I had to fix this “old school” .  By extracting the assignment submission entries from a database backup 24 hours before and then manually log in as each student and resubmit the original files.  By importing the submission data I was able to restore the feedback and grades.

And yes, there were over 335 to do, and this involved finding the file, saving it locally, logging on as the student, uploading the file, logging out and repeating the process each time.  Needless to say, it took me 3 days.  My eyes were strained, my wrist in tatters and my will to live in pieces but I got there in the end.  Luckily it was only 335, and not the 16,000 uploaded since September.

Had I not had a backup then we would have lost over 300 assignments, and the feedback, and this is all crucial to our students future and qualification grade.

If you take anything from this blog post, aside from sympathy for me…then please…devise and implement a solid backup plan…it could save your sanity and your job.

Now I  just have to figure out what caused the assignments to all disappear in the first place…

Bug in Database Module (1.9+)

January 1, 1970 in Bug Fixes

There appears to be a bug in the database module in Moodle.

This is only apparent if you upgrade from Moodle 1.8 to Moodle 1.9, like we did.
When a user searches the database the CPU on the server hits 100% and hangs. The only way to restore activity is to restart the MySQL and Apache processes.

I discovered that it was the pagination of results that was causing the problem and as a temporary fix I changed the select statement to select * rather than select count(*).
I no longer have pagination but results are returned within a seconds as opposed to 10 minutes which was happening with the bug.

The bug has been reported in the Moodle Tracker.

Full Screen Moodle FLV video

January 1, 1970 in Bug Fixes

At last! I found the time to fix this!

The fact that Moodle does not support full screen FLV playback is something that has troubled me since day one. The button is there and many staff and students complained that when clicked it did nothing. After sifting through the code I managed to gain a much deeper understanding of the player and noticed that the fullscreen attribute is not included in the standard Moodle distribution.

Since this discovery I have added the attribute and the fullscreen option now works beautifully. I am now able to define custom skins to the FLV player and even create my own skins using Flash.

Journal feedback stripslash inserts causing problems

January 1, 1970 in Bug Fixes

As many of you may know, journal feedback in Moodle is via a text box and not a WYSIWYG editor. So when a tutor leaves feedback containing an apostrophe, a stripslash (backslash) is inserted into the text. This is fine and I understand the (MySQL) reasons why, however… my tutors do not! Each time a tutor saves new feedback, an extra stripslash is added. After many edits the feedback is littered with stripslashes.

So as a temporary fix I have removed the stripslashes by modifying /mod/journal/report.php.

By replacing the line:

$entrybyuser[$entry->userid]->entrycomment = $vals['c'];


with

$entrybyuser[$entry->userid]->entrycomment = stripslashes($vals['c']);

I realise that this may create a rod for my back further down the line, especially when it comes to exporting or importing this table from MySQL but it will certainly save me lots of earache in the upcoming months, especially as the journals will be assessed and OFSTED will not be too happy wading through pages of stripslashes.