mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
MDL-23897 adding miissing cleanup of draft areas
This commit is contained in:
parent
7eba1da072
commit
2e69ea4a17
1 changed files with 12 additions and 2 deletions
|
@ -1148,9 +1148,19 @@ class file_storage {
|
||||||
*/
|
*/
|
||||||
public function cron() {
|
public function cron() {
|
||||||
global $CFG, $DB;
|
global $CFG, $DB;
|
||||||
//TODO: find out all stale draft areas (older than 1 day) and purge them
|
|
||||||
// those are identified by time stamp of the /. root dir
|
|
||||||
|
|
||||||
|
// find out all stale draft areas (older than 4 days) and purge them
|
||||||
|
// those are identified by time stamp of the /. root dir
|
||||||
|
mtrace('Deleting old draft files... ', '');
|
||||||
|
$old = time() - 60*60*24*4;
|
||||||
|
$sql = "SELECT *
|
||||||
|
FROM {files}
|
||||||
|
WHERE component = 'user' AND filearea = 'draft' AND filepath = '/' AND filename = '.'
|
||||||
|
AND timecreated < :old";
|
||||||
|
$rs = $DB->get_recordset_sql($sql, array('old'=>$old));
|
||||||
|
foreach ($rs as $dir) {
|
||||||
|
$this->delete_area_files($dir->contextid, $dir->component, $dir->filearea, $dir->itemid);
|
||||||
|
}
|
||||||
|
|
||||||
// remove trash pool files once a day
|
// remove trash pool files once a day
|
||||||
// if you want to disable purging of trash put $CFG->fileslastcleanup=time(); into config.php
|
// if you want to disable purging of trash put $CFG->fileslastcleanup=time(); into config.php
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue