Scenario 1: Delete cache assets when removing a library.
Login as an admin.
Go to Course1.
Add a new Label and use Atto Editor to "Insert H5P" in the Label text.
Add the chart-7143.h5p attached in the issue.
Save and return to the course.
Go to the DataBase and run this query
SELECT * FROM `mdl_h5p_libraries_cachedassets`
Confirm you should see only one row. Please, copy the value of the hash column in the notepad.
Now, in the DataBase, you should run this other query and you have to substitute in the query the HASHVALUECOPIEDBEFORE tag with the value previously copied in the notepad.
SELECT * FROM `mdl_files` WHERE `filename` LIKE 'HASHVALUECOPIEDBEFORE%'
Confirm you should see two rows where the filename columns contain these values, HASHVALUECOPIEDBEFORE.js and HASHVALUECOPIEDBEFORE.css
Now, go to the Site Administration / H5P / Manage H5P content types
Confirm you could see in the Installed H5P libraries tab, H5PEditor.ColorSelector library with 1.2.5 version.
Upload the chart-new-library-1-2-6-740633.h5p attached file in the H5P content type field.
Expected result: You could see this message 'H5P content types uploaded successfully 'in background green. Also, you could see in in the Installed H5P libraries tab, H5PEditor.ColorSelector library with 1.2.6 version.
Go to the DataBase and you should run the same query in Step 5.
Expected result: you shouldn't see any row.
Now, in the DataBase, you should run the same query in Step 6.
Setup
Moodle Site with one course named course1.
Acces as admin in the Moodle Site.
Acces to the DataBase to do some SQL queries.
Scenario 1: Delete cache assets when removing a library.
Login as an admin.
Go to Course1.
Add a new Label and use Atto Editor to "Insert H5P" in the Label text.
Add the chart-7143.h5p attached in the issue.
Save and return to the course.
Go to the DataBase and run this query
SELECT * FROM `mdl_h5p_libraries_cachedassets`
Confirm you should see only one row. Please, copy the value of the hash column in the notepad.
Now, in the DataBase, you should run this other query and you have to substitute in the query the HASHVALUECOPIEDBEFORE tag with the value previously copied in the notepad.
SELECT * FROM `mdl_files` WHERE `filename` LIKE 'HASHVALUECOPIEDBEFORE%'
Confirm you should see two rows where the filename columns contain these values, HASHVALUECOPIEDBEFORE.js and HASHVALUECOPIEDBEFORE.css
Now, go to the Site Administration / H5P / Manage H5P content types
Confirm you could see in the Installed H5P libraries tab, H5PEditor.ColorSelector library with 1.2.5 version.
Upload the chart-new-library-1-2-6-740633.h5p attached file in the H5P content type field.
Expected result: You could see this message 'H5P content types uploaded successfully 'in background green. Also, you could see in in the Installed H5P libraries tab, H5PEditor.ColorSelector library with 1.2.6 version.
Go to the DataBase and you should run the same query in Step 5.
Expected result: you shouldn't see any row.
Now, in the DataBase, you should run the same query in Step 6.
Expected result: you shouldn't see any row.
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.
It has been fixed in MDL-67062 but the patch should be backported to 3.8.