mirror of
https://github.com/moodle/moodle.git
synced 2025-04-22 00:42:54 +02:00
Merge branch 'wip-MDL-37757-master' of git://github.com/abgreeve/moodle
This commit is contained in:
commit
ebe2fafa8b
@ -2004,6 +2004,8 @@ abstract class repository implements cacheable_object {
|
||||
global $DB;
|
||||
if ($downloadcontents) {
|
||||
$this->convert_references_to_local();
|
||||
} else {
|
||||
$this->remove_files();
|
||||
}
|
||||
cache::make('core', 'repositories')->purge();
|
||||
try {
|
||||
@ -2668,6 +2670,17 @@ abstract class repository implements cacheable_object {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find all external files linked to this repository and delete them.
|
||||
*/
|
||||
public function remove_files() {
|
||||
$fs = get_file_storage();
|
||||
$files = $fs->get_external_files($this->id);
|
||||
foreach ($files as $storedfile) {
|
||||
$storedfile->delete();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Function repository::reset_caches() is deprecated, cache is handled by MUC now.
|
||||
* @deprecated since Moodle 2.6 MDL-42016 - please do not use this function any more.
|
||||
|
Loading…
x
Reference in New Issue
Block a user