-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
After purging the backups, there are obsolete directory entries left in mdl_files.
You might want to add something like that after line https://github.com/UniversidadORT/moodle-tool_autobackups/blob/master/cli/purge_autobackups.php#L89:
$sql2 = 'select id, contextid, itemid, filepath, filename
from {files}
where component = \'backup\' and filearea = \'automated\' and filename = \'.\';';
$sth2 = $DB -> get_records_sql($sql2);
foreach ($sth2 as $id => $row) {
$file = $fs -> get_file($row -> contextid, 'backup', 'automated', $row -> itemid, $row -> filepath, $row -> filename);
if ($file) { // file found
if (array_key_exists('c', $options) || array_key_exists('x', $options)) {
// Delete directory
if ( $file -> delete() ) {
echo 'Directory sent to trash: ' . $file -> get_filename() . "\n";
} else {
echo 'Could not delete directory: ' . $file -> get_filename() . "\n";
}
}
}
}
Cheers,
Alex
Metadata
Metadata
Assignees
Labels
No labels