Redmine #6611: Fix incorrect key extraction when upgrading from < 3.6.1

Versions before 3.6.1 don't have the appsettings.php secret key at
all, so we need to detect when our extraction has failed and delete
the key file so that we will generate a key instead. We do this by
matching the extracted key file against the regular expression and by
making sure it contains exactly one such line.
Merge pull request #14 from kacfengine/failed_extraction_fix

Redmine #6611: Fix incorrect key extraction when upgrading from < 3.6.1