Switch database connections from TCP to Unix sockets at SeanieB's suggestion.
Swapped out the old way to check if an image is good with just getting a list of all good images and using that; this reduces the amount of database hits per page access from somewhere in the thousands to just a few, and speeds up the front page dramatically. This is not a clean fix; the old way's code is still ther eand there's some more cleanup that can be done, but I need to fix some discrepancies due to some image tag templates on Sega Retro itself that have not been migrated to Template:ScanImageTag so the new stats can equal the old stats first.