A hunt through the database saves the day

I'm currently in the process of cleaning out old and disused moodle courses from the College system in preparation of the move to Moodle 2.  I went to a meeting and talked through a lot of courses, and I was told it was alright to delete a particular course as the teacher had left and no students had used it for ages.  So I went ahead and did it.  Then the problem happened.

On Monday the Manager of that area came to see me "I need that course" he said.  "I've deleted it" I replied, but he was adament that he needed that course.  Now luckily we back up all courses to a seperate server in the event that we ever need to get anything back and his course was in there somewhere.  But with nearly 2000 courses filed as the courseID it would be a nightmare to try and find it.  This is where I had a large stroke of luck.

As I was looking through the Moodle Database I came across the mdl_course_display table.  I'm not sure what it is for, but when you delete a course, it seems that it doesn't delete the course entry in this table.  So now I have the userID of the teacher and all the courseID's of what she is still a teacher on.  Taking a simple SELECT query on this table showing all courseIDs for the user I was amazed to find that although she was only listed on the VLE as having 9 courses, there were 15 distinct entries coming back.  

Great!!  So now all I have to do is look at the 6 courses on the backup to find that one course that I need.  Result!!!

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
2011 © Copyright Kieran Briggs