Prevent loadApps on upgrade

Moved OC::needUpgrade() to OCP\Util::needUpgrade() to make it accessible
form the router.
Moved maintenance + upgrade check to the router.

Tentative fix for #8787