Fix issues enabling extensions containing copy/pasted settings.

When enabling an extension and installing its media, we work with a lock
to ensure that two processes aren't attempting to install media at the
same time. We then remove the lock file. This happens until the old
stored version in settings matches up with the current version of the
extension.

Where this falls apart is if an administrator copy/pastes a settings
dictionary from one server (say, a test server) into a disabled
extension's settings in the database editor, and then tries to enable
it. The versions will match up, but the extension won't be installed
yet, so we'll go through the locking phase. However, since the versions
match, we don't actually create a lock, and then we blow up trying to
remove it.

If the extension's data is not yet installed, its old version (if any)
is not to be trusted. Treat it like a fresh install.

Reviewed at https://reviews.reviewboard.org/r/6054/