Issue Details (XML | Word | Printable)

Key: MDL-20635
Type: Sub-task Sub-task
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Sam Hemelryk
Reporter: Sam Hemelryk
Votes: 0
Watchers: 1
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle
MDL-14589

Clean up files associated with a context when the context is deleted

Created: 26/Oct/09 04:43 PM   Updated: 23/Dec/09 09:49 AM
Component/s: Files API
Affects Version/s: 2.0
Fix Version/s: 2.0

File Attachments: 1. Text File accesslib.20091028.patch (1 kB)
2. Text File MDL-20635.20091211.patch (2 kB)

Issue Links:
Relates
 

Participants: Martin Dougiamas, Petr Skoda (frankenstein) and Sam Hemelryk
Security Level: None
Difficulty: Easy
Resolved date: 23/Dec/09
Affected Branches: MOODLE_20_STABLE
Fixed Branches: MOODLE_20_STABLE


 Description  « Hide
Clean up files associated with a context when the context is deleted

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Sam Hemelryk added a comment - 28/Oct/09 03:55 PM
Tiny patch that does uses delete_area_files as you suggested Petr,
Could you please have a quick check and if it's ok either commit it yourself or let me know and I'll check it in.
Cheers
Sam

Martin Dougiamas added a comment - 30/Oct/09 03:36 PM
Which one is better:

1) Delete the files at the time the context is deleted
2) Leave the files, and add a cron job to clean up all orphaned files

I'm tending towards (2) simply because it fixes any cases where things get out of sync, and also allows context deletions to proceed quite fast.


Martin Dougiamas added a comment - 02/Dec/09 01:16 AM
Sam, can you implement the cron solution in head? It would just be a small bit of code in admin/cron.php to call a function in filelib.php.

Sam Hemelryk added a comment - 11/Dec/09 02:32 PM
Hi guys,
I have attached a patch that cleans up files that are associated with a context that no longer exists.
Could you please have a look at it and let me know what you think, I'm not sure this is the best way around the
task as it essentially requires the a file have a reference to a contextid that does not exist?
Cheers
Sam

Petr Skoda (frankenstein) added a comment - 21/Dec/09 05:28 PM
+1 for commit

Sam Hemelryk added a comment - 22/Dec/09 09:15 AM
Will commit this on Wednesday as it is QA day today

Sam Hemelryk added a comment - 23/Dec/09 09:49 AM
Has been commit now