mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
MDL-67062 core_h5p: delete cache assets when removing libraries
The cache assets linked to a library have to be removed also when a library is deleted, in order to rebuild them again next time they are required.
This commit is contained in:
parent
37b2ee3f64
commit
2b8d97326d
@ -1138,6 +1138,8 @@ class framework implements \H5PFrameworkInterface {
|
||||
$fs = new \core_h5p\file_storage();
|
||||
// Delete the library from the file system.
|
||||
$fs->delete_library(array('libraryId' => $library->id));
|
||||
// Delete also the cache assets to rebuild them next time.
|
||||
$this->deleteCachedAssets($library->id);
|
||||
|
||||
// Remove library data from database.
|
||||
$DB->delete_records('h5p_library_dependencies', array('libraryid' => $library->id));
|
||||
@ -1451,6 +1453,10 @@ class framework implements \H5PFrameworkInterface {
|
||||
list($sql, $params) = $DB->get_in_or_equal($hashes, SQL_PARAMS_NAMED);
|
||||
// Remove all invalid keys.
|
||||
$DB->delete_records_select('h5p_libraries_cachedassets', 'hash ' . $sql, $params);
|
||||
|
||||
// Remove also the cachedassets files.
|
||||
$fs = new file_storage();
|
||||
$fs->deleteCachedAssets($hashes);
|
||||
}
|
||||
|
||||
return $hashes;
|
||||
|
Loading…
x
Reference in New Issue
Block a user