Add alternate IP address for redirected by GDS
Merge pull request #395 from rjc123/patch-1

Add alternate IP address for redirected by GDS
Fix choosing a date from category hits graph pages

If you were viewing the hits in a category, for example:

/sites/businesslink/hits/category?category=errors

The code was overwriting the querystring and so omitting the category
parameter. Following that link would trigger a 5xx error because category was
empty when it shouldn't be.

Using the URI library, we can add or overwrite just the relevant part of the
querystring.
Merge pull request #397 from alphagov/fix_hits_graph_period_selection_from_category_pages

Fix choosing a date from category hits graph pages
Store path relative to Rails.root when tracking hits files

We use timestamped directories for releases in production. This
means that on every deploy the absolute filenames for hits files
change, even if the hits files in transition-stats and pre-transition-stats
haven't changed. All hits files are therefore re-imported after every
deploy, which is unnecessary and takes a long time.

To fix this, this stores the filename relative to Rails.root, thereby
excluding the part of the path which changes on deploy. @rgarner thought
he had a reason for not doing this originally, but can't remember it now.

It would be good to avoid this in production, but in preview it is
even more important at the moment. Preview is deployed to more frequently
than production, and the overnight data sync from production also
causes timestamp mismatches. We're trying to compare performance of
the hits import between MySQL and Postgres at the moment, and that
is very hard when the import mostly takes much longer than it needs to,
and longer than it would be in production.
Delete absolute filename ImportedHitsFiles

Each actual hits file will have many records in this table because the
filenames were being stored as absolute paths, including a timestamped
directory per deploy. This cleans those old records up so that we will
have only one row per real hits file with a relative path filename.

This will delete only rows with an absolute filename, in case someone
wants to rollback in dev and then migrate forwards through this again
without losing any relative-filename tracking.
Add third GDS TLD IP address
Merge pull request #399 from rjc123/patch-3

Add third GDS TLD IP address
Merge pull request #398 from alphagov/store_relative_filename_for_tracking_hits

Store relative filename for tracking hits
MappingsController index can render a CSV
Link to mappings CSV export, for admins only

We don't want to encourage use of spreadsheets, but we do occasionally get
asked to provide them. Let's make life easy on ourselves by giving us a means
to provide the spreadsheet easily. It also enables advanced users to search and
filter in ways we don't intend to support (eg look for mappings matching a
regex).
Only allow admins to export as CSV
Merge pull request #392 from alphagov/mappings_csv_export

Mappings CSV export
Really test that the jump to mapping dialog finds a site

- Before, this was only testing for the presence of "www.bis.gov.uk" in
  any form, which would have matched on the error page's <p> tag and
  passed. We don't want it to match an error page, we want to know that
  the site has been found, so test for the site URL in header text.
- Add a test for the "Unknown site" error page case.