Adding filter to toggle whether upgrades are run automatically

In some cases it is desirable to run the upgrade manually so the admin has more control over it, so this allows them to do that.

The default is to allow automatic upgrades, so that the current behavior is unchanged and normal users are unaffected.
Refactoring upgrade funtions to allow manual calls.

Previously the upgrade functionality was tightly coupled to being automatically ran when the user requests a page. These changes decouple it so that it can also be ran manually (e.g., by a wp-cli command).
Adding status information to upgrade routine

This will be useful when running the upgrade manually, because the caller will want to know if it succeeded or not.
Adding upgrade command for wp-cli
Merge branch 'manual_upgrade'