File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -572,4 +572,28 @@ public function get_compcatname_for_flavor(string $flavorname): string {
572
572
}
573
573
return $ compcatname ?? '' ;
574
574
}
575
+
576
+ /**
577
+ * This function deletes all data from the plugin tables and from the filesystem.
578
+ * Use with caution!
579
+ */
580
+ public function wipe (): void {
581
+ global $ DB ;
582
+ $ DB ->delete_records (constants::TABLES ['compcat ' ]);
583
+ $ DB ->delete_records (constants::TABLES ['component ' ]);
584
+ $ DB ->delete_records (constants::TABLES ['flavor ' ]);
585
+ $ DB ->delete_records (constants::TABLES ['variant ' ]);
586
+ $ DB ->delete_records (constants::TABLES ['comp_flavor ' ]);
587
+ $ DB ->delete_records (constants::TABLES ['comp_variant ' ]);
588
+
589
+ $ fs = get_file_storage ();
590
+ $ fs ->delete_area_files ($ this ->contextid , 'tiny_elements ' , 'images ' );
591
+ $ fs ->delete_area_files ($ this ->contextid , 'tiny_elements ' , 'export ' );
592
+
593
+ // Purge CSS and JS cache.
594
+ \tiny_elements \local \utils::purge_css_cache ();
595
+ \tiny_elements \local \utils::rebuild_css_cache ();
596
+ \tiny_elements \local \utils::purge_js_cache ();
597
+ \tiny_elements \local \utils::rebuild_js_cache ();
598
+ }
575
599
}
You can’t perform that action at this time.
0 commit comments