various bugs

- Re-fix issue #95 (user-agent sort order)
 * When we switched to the INI file in most places it was fixed
   as the order of the file is used, but when quering the run_client
   table in JobAction, it is ordered by useragent_id then then
   we have the same thing with IE|10 < IE|6.

   Using natksort() on the resulting array.

- If a test is complete with no errors, but with failures it
  was showing a green background but the failure count inside.

  Caused by a regression in the write, accidentally typed ->error
  where it should be ->fail

- SaverunAction deletes run_client rows of the same run where
  client_id != $clientID and status != passing.

  That looks good, except that it also nukes run_client rows
  of other runs of the same run but for a different useragent_id.
  Adding (back) the useragent_id check.

- WiperunAction was only removing the run_client row of the
  latest known client to run the run.

  This resulted in weird behavior where if a run failed 'max' times,
  triggering wipe run would only delete one and the table cell would
  still be red (but a different run_client shining through), and
  would require 'max' number of times to wipe them all,
  This should instead wipe all runs by user agent with a join
  to clients table.
  (regression in fd24b5e8cce17331c3e3dca3060a8231a5818a9f where
  the user agent filter was incidentally removed from the query).
Move swarmGetVersion into TestSwarmContext as getVersion

- Also added a way to bypass the cache for maintenance scripts,
  for issue #142.

- Renamed 1.0.0-pre to 1.0.0-alpha so that it works with
  version_compare. This also matches the guidelines of SemVer
  (updated README, http://semver.org/ )
Add several methods to Database class

- Needed in the update script (issue #142)

- Moving around methods in a more logical order

- Added:

 * `tableExists`, `fieldInfo`, `fieldExists`
   Get info about the database. To be used in the update script.

 * `batchQueryFromFile`
   Given the contents of a (potentially large) .sql file, executes
   it in batches. Also strips out comments. Giving the contents
   to query() directly fails (tried it several times, it doesn't
   handle comments very well).

 * `addIdentifierQuotes`, `strEncode`
   wrapper around mysql_real_escape_string, but passing
   the current connection instead of falling back to the last opened
   connection. And also adding in a ping() so that escaping does
   not fail if the connection has gone to sleep in the mean time.

   Without this calls to mysql_real_escape_string could fail and
   should not be relied on always doing its thing (especially when
   called before the connection is opened, mysql_real_escape_string
   doesn't (and can't) do anything.

 * `ping`
   Wake up the connection or (re-)open it otherwise.

 * `freeResult`
   Wrapper for mysql_free_result, added call in getRows but not in
   other places. Afaik it can increase memory usage when called on
   a resource that was not fetched completely. So only use it on the
   resources where it is used for multiple rows and all rows have
   been fetched.

 * `ignoreErrors`
   When checking table existence, don't throw exceptions if the
   query returned an error.

- Lock system.

  If ./cache/database.lock exists, then Context won't create an
  instance of Database and throws an exception instead which
  index.php and api.php already handle well. This way pages won't
  look broken but are handled naturally (api.php will respond
  with a descriptive error in a valid response format and index.php
  will show a Error500Page).

- Misc.:
 * Added DerivativeWebRequest to init.php, forgotten in
   28b6595054d517ad1e8b0de28caf1352227cc6e8. Wasn't an issue since
   it is in the same file as WebRequest, so it is already loaded in
   most cases, but when a maintenance script uses
   DerivativeWebRequest directly it would fail.