I was called to clean a mess in data more than once in the recent times and thinking that the system administrator job is similar to a street sweeper. Now I feel confirmed. It explains why Beppo (of Momo fame) was a hero!
Seriously,
> When an H5P activity is viewed for the first time, Moodle automatically generates an export `.h5p` file and stores it in `mdl_files` with:
>
> - `component = core_h5p`
> - `filearea = export`
> - `contextlevel = 10` (system context)
>
> This is by design and functions correctly. The problem occurs when an H5P activity is
**deleted** — Moodle removes the activity record from `mdl_h5p` but does **not** delete the corresponding export file from `mdl_files` or from disk.
>
> - `component = core_h5p`
> - `filearea = export`
> - `contextlevel = 10` (system context)
>
> This is by design and functions correctly. The problem occurs when an H5P activity is
**deleted** — Moodle removes the activity record from `mdl_h5p` but does **not** delete the corresponding export file from `mdl_files` or from disk.
That is indeed a bug in the size of a mammoth.
> The scheduled task `\core\task\h5p_clean_orphaned_records_task` exists but does not handle cleanup of these orphaned export file records. This is the known gap described in MDL-70700.
There it is - since Moodle 3.x, not assigned to anybody, priority low. Must be dead, only a fossil now. We can put it to display together with the exploding PDFs and exponentially multiplying quiz questions.
Edit: Almost missed posting it. I thought "Save the changes" saved the post, whereas way, way down at the bottom of the page it was waiting with this, now well-known red-and-green flag:





