Recover a student task in Chamilo LMS 1.9.*

In Chamilo LMS 1.9.* (meaning 1.9.0 up to 1.9.10), deleting some files from the web interface don't always delete them on disk. While this means that, sadly, you don't get to get space back when cleaning up your courses, you can at least recover them (or your administrator can) if you deleted them by mistake. That is with the default configuration (there is a platform configuration setting that sets the The procedure is not very easy to go through, but considering it can save you from serious issues with parents, I thought defining it here might probably help a few people.

Understanding Chamilo

So first thing first: you might be better at this if you understand what Chamilo does when you delete an assignment (or task, or work, depending on how you call it).
  • it identifies the numerical ID of the current course (SELECT id FROM course WHERE code = 'YOURCOURSECODEHERE')
  • it locates the task in the c_student_publication table (SELECT c_id, id FROM c_student_publication WHERE title = 'name_of_file.docx'; -- for example)
  • it changes the "active" field of that file from "1" to "2"
  • it then goes into the c_item_property table and changes the "lastedit_type" action from "DocumentAdded" to "DocumentDeleted" (ref = the id in c_student_publication above)
  • finally, it marks the file as deleted, by renaming it to [original_hash]_DELETED_[the_work_id].

Reverting the deletion

So, to revert that deletion, all you have to do is basically revert all 3 changes made to delete it:
  • change the "active" field in c_student_publication from "2" to "1"
  • change the c_item_property.lastedit_type field from "DocumentDeleted" to "DocumentAdded"
  • rename the file by removing everything after the hash (starting with the first underscore)
This should have the immediate effect of showing back the file inside the works tool of your course! And if you need the professional help of a specialist, you can always contact us.