Only overwrite serverHost when in unit tests

The intention of the original commit 12f7cb87679453fa96c796df857b7e7193d4ee09
was to fix tests. But cron should always return a valid host not localhost.
Only calculate the WEBROOT from scriptName if it contains $SUBURI

If not we are most likely in CLI mode. However to be able to still
generate valid URLs, we need to use the overwrite webroot instead.

Fix #9490
Add comment to overwrite* configs about CLI/cron problems
Merge pull request #9494 from owncloud/issue/9490

[issues/9490] \OC::$WEBROOT is invalid when called from cron.php