MDL-68909 h5p: upgrade step to remove files in editor filearea
[moodle.git] / lib / db / upgrade.php
index 5c2dcca..e9df47a 100644 (file)
@@ -2684,5 +2684,15 @@ function xmldb_main_upgrade($oldversion) {
         upgrade_main_savepoint(true, 2021052500.06);
     }
 
+    if ($oldversion < 2021052500.13) {
+        // Remove all the files with component='core_h5p' and filearea='editor' because they won't be used anymore.
+        $fs = get_file_storage();
+        $syscontext = context_system::instance();
+        $fs->delete_area_files($syscontext->id, 'core_h5p', 'editor');
+
+        // Main savepoint reached.
+        upgrade_main_savepoint(true, 2021052500.13);
+    }
+
     return true;
 }