Last modified: 2014-05-23 21:15:08 UTC
MediaHandler::isMetadataInvalid() should return METADATA_BAD only when there is something wrong with the metadata, not when there is something wrong with the file. A file validation error should never cause isMetadataValid() to return false, since this causes upgradeRow() to be called every time the image is used in any way. The SVG and DjVu handlers get this wrong. This causes high DB master load, and also errors such as bug 27639. I would humbly point to OggHandler as a possible model for appropriate handling of invalid files: an invalid file causes an error message to be saved into the metadata array, and then getLongDesc() is overridden to display the error message to the user on the image description page. getWidth() etc. returns zero for an invalid file.
https://gerrit.wikimedia.org/r/#/c/35301/
Tim: Aaron's patch ("Store "bad metadata" placeholder metadata for SVGs") got merged in November 2012 - did this solve the problem, or is there more to do?
There is still DjVu
Change 134976 had a related patch set uploaded by Brian Wolff: Make sure DjVu files do not attempt metadata extraction repeatedly https://gerrit.wikimedia.org/r/134976
Doesn't really look like this is actually much of an issue though: MariaDB [commonswiki_p]> select count(*) from image where img_major_mime = 'image' and img_minor_mime = 'vnd.djvu' and img_media_type= 'BITMAP' and img_metadata in ( '', '0', 'a:0:{}' ); +----------+ | count(*) | +----------+ | 0 | +----------+
Change 134976 merged by jenkins-bot: Make sure DjVu files do not attempt metadata extraction repeatedly https://gerrit.wikimedia.org/r/134976