Fix upgrade process when apps enabled for specific groups

Fix issue where the currently logged user was causing side-effects when
upgrading.
Now setting incognito mode (no user) on update to make sure the whole
apps list is taken into account with getEnabledApps() or isEnabled().
Added test for needUpgrade for core
Added unit tests for cache of enabled apps
Merge pull request #10818 from owncloud/enableappforgroupfix

Fix upgrade process when apps enabled for specific groups