Merge pull request #370 from protich/feature/authentication-backends-revisited

Authentication backends revisited

Sorta-Reviewed-By: Jared Hancock <jared@osticket.com>
First stab at pluggable attachment storage
Retire attachment chunk orphan cleanup
Add better error handling for file storage backends
Migrate file metadata table

  * Include a `bk` column to store the storage backend
  * Include a `signature` column which represents a repeatable hash of the
    file contents
  * Rename `hash` to `key` since it isn't a real hash
Fix several issues from initial mockup
Fixup storage of email attachments

Fixes the rewriting of the `key` field in the ticket thread body. The
storage de-duplication system may replace the `key` value with an existing
one. The ticket thread system will use the `key` value assigned when the
file is committed to the database or the existing key of the duplicate file.

Also fixup installation issues with the attachment storage plugin
architecture
Rewrite %file table structure

Add `attrs` field for backend state information (multi-part migration,
multi-part upload, etc). Change `size` to be an integer rather than text
field. (Storage space will be about the same, but int makes more sense).
Size the `key` and `signature` for ~512 bits. The base64 encoding allows
6-bits per char. At 86 chars, we have 516 bits maximum space.