Making missing old files not try to render a thumbnail
authorBrian Wolff <bawolff+wn@gmail.com>
Sun, 3 Aug 2014 04:10:01 +0000 (01:10 -0300)
committerBrian Wolff <bawolff+wn@gmail.com>
Sun, 3 Aug 2014 04:18:45 +0000 (01:18 -0300)
commit14c580577413106b98e307ad36ca6fe782d42f00
tree88d9b629a4852b2ebc6f7ad7140a01c137e0c1c0
parent33ea33f7b6ed196343a7934926a24a0055cb87b2
Making missing old files not try to render a thumbnail

Unfortunately there's a couple files on commons where the old
version of the file is missing. They can be found by looking for
an oi_archive_name of an empty string. In the case of such a file,
make sure that the exists method returns false (since it doesn't
exist on disk). Additionally make canRender() return false if the
file does not exist (Can't render what doesn't exist). Last of all
make ImagePage not link to the original file if exist() is false.

This will make pages like [[File:Resilient_Barnstar.png]],
[[File:GeorgeWBush.jpg]] etc not link to the old version if the
link would be broken, and not show a thumbnail (Sometimes this is
already the case, since lots of these broken files have a width
and height of 0). There are currently 12,895 broken old versions
of files on commons.

Bug: 22847
Change-Id: Ic376a9996d95a1218eee4da5800dac9ada7b7725
includes/filerepo/file/File.php
includes/filerepo/file/OldLocalFile.php
includes/page/ImagePage.php