Fix broken media previews
Issue:
The error log is full of the warning "Warning: copy(public://media-icons/generic/generic.png)" and the media library shows no previews. This can happen when environments are set up based on a database dump and without properly transferring the files. The media icons are usually created during the installation of the media module, which will never happen in this scenario.
Solution:
Trigger the install hook of the Core Media module. It will take care of creating those files. Use the provided snippet.
See also https://www.drupal.org/project/drupal/issues/3060509