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.
I should have actually, but ``i`` case insensitivity operator will work as well, and the test round trip is quite long, so I'll leave it as it is for now.