Hello Moodle community !
My users used the same - big - image in almost all their courses, as course image. That's leading into an important loading time on pages showing many courses.
I'm trying to find a way to replace in bulk this image by a resized one. I think the best approach is to change the reference directly on the database. I found a way to do it, but I would make sure I will not break anything by manipulating the database like that.
So, I started to upload the resized image as a Course Image on an existing course. So I can retrieve all its parameters on the database.
Now, looking into `mdl_files` tables, I can retrieve the original image several times, and the new one 1 time.
My plan is to update all entries matching the original contenthash, and replace by the new one data. Here is the query:
SET contenthash='<new hash>', filename='<new filename>', filesize='<new filesize>'
WHERE contenthash='<old hash>', component='course', filearea='overviewfiles'
Is this update safe ? Is there a better way to do it ?
Thank you !