Bug fixing week (Moodle 2)

This week I finally found some time to sit in front of my computer and address some of the niggly little glitches that have arisen since our Moodle 2 upgrade.

One of which was the sending of emails via the cron. For some unknown reason, Moodle 2 could not initiate the send mail function. After several hours debugging and trying various things I decided to put the path to the sendmail server directly into Moodle, as opposed to using the default PHP path. And sure enough it worked! Even though the paths are exactly the same and worked prior to the upgrade, this was the only way I could get around it.

The next problem I had was with external Database enrolments via ODBC . For some reason, our Moodle 2.0 installation was refusing to run the queries even though I could communicate directly with the external database. Eventually, after searching through countless PHP pages I decided to drop ODBC in favour of FreeTDS. This worked like a charm.

Lastly, our cron was falling over when trying to run the course completion function. This was due to a mismatch in database collations. For some reason, 3 of our tables were set to utf8_general_ci, instead of utf_unicode_ci. I changed these tables to unicode and the cron completed this action.

Then I encountered another problem. Again cron related Playtech Casinos. The process kept on terminating whilst completing meta enrol enrolments. This happened everytime and just by chance I happened to time how long the process would last until it terminated. It was exactly 60 seconds. So to fix this I changed the timeout in php.ini to a much longer time limit of 300 seconds and now the cron completes perfectly.

It is now the end of the week and although the above fixes are more work arounds as opposed to actual core fixes at least things are working again. I have submitted some of my findings to the Moodle Tracker and hopefully some of these issues will be resolved in future releases.

I finished the week by installing the Drag and Drop file uplaoder block by the brilliant Davo Smith. This is by far my favourite block of all time. For those that are unfamiliar with it check out: http://moodle.org/mod/forum/discuss.php?d=181988

The only hack I had to make was to make the block sticky on all courses. As it’s a course block its not possible to make it sticky in Moodle 2.0 on all course pages by default.

To do this find the line:

function applicable_formats() {
return array('course' => true);

And change to:

function applicable_formats() {
return array('all' => true);

Now you can add the block to the frontpage and set it to appear on all pages.
Once my workload settles down I’m looking forward to coding and developing again.