mozilla/affiliates — pull request #185 by Osmose (2014-04-08 04:04:30+00:00)
Title: Bug 976804: Upgrade banners

Re-implements upgrade banners, which are image banners that show a different image to users that are not on an up-to-date version of Firefox. It does this by generating an .htaccess file in the media directory that serves up a different image depending on the User-Agent.

In the previous version of the site, we used the same trick, but whereas here we have a special model and special image URLs for upgrade banner images, the old site just had normal image banners. We figured out the image filename that would be generated for he upgrade banner images beforehand, and then generated an .htaccess that swapped out the upgrade image if the User-Agent matched.

In order to keep supporting these old banners, what I've done is added a .gitignore to the media directory that ignores everything within it except for the currently existing upgrade images, and I've added those to the repo, along with a special segment in the .htaccess that supports these legacy images. Existing upgrade banners will look like image banners to users; we might consider some conversion to actual upgrade banners in the future, but for now this'll do.

- Also empties out the pre-populated product_details and forces you to run update_product_details as part of the site setup. Make sure to run it if the tests fail.