Earlier today, I ran across the following response to the Moodle 2.0 related question (Reuben Rowntree) of  how do you delete a file you have uploaded as part of an HTML description or on a page?

Here’s the response from David Mudrak:

This is the key point of the new File API. To remove the embedded file from the page, just remove the image from the HTML editor. After re-save, it will be unlinked from the page. After some time, the garbage collector process shall find all stored files that are not referenced from any place for a long time and will trash them physically. But you can be never sure that the file is not referenced from an other place so you do not have the option to remove it on your own. Consider this mechanism as so called hard links known in common file systems.

The way I understand this is that there is a process–“garbage collector process”–that filters through and removes orphan files not linked anywhere. I’m not sure I like this kind of process…it seems like the process you have when you trash your web-based email and then after 30 days, the email is discarded (although it really isn’t, right?). Here’s a bit of description:

The image save operation is implemented using the new File API. The idea is that textareas have draft file areas which holds files attached to them. Thelib/paintweb/ext/moodle/imagesave20.php script saves the image in the draft file area of the textarea where the user edits the article. The client-side PaintWeb scripts determine the context ID and the draft item ID associated to the textarea. When the image save action is invoked, the script receives them, and uses them to save the image. The URL of the draft file is generated by the Moodle File API, and returned to the client-side code, which updates the image URL.

Moodle should handle the garbage collection (automatic deletion of obsolete files). Once the user submits the form containing the textarea, all the image URLs are updated to point to a permanent file area – they are moved out of the temporary/draft file area.

What happens if you want to delete stuff manually?

PingIt! pingthis();
Delicious Bookmark this on Delicious
Subscribe to Around the Corner-MGuhlin.org

Everything posted on Miguel Guhlin’s blogs/wikis are his personal opinion and do not necessarily represent the views of his employer(s) or its clients. Read Full Disclosure