Encapsulate require_once to avoid name space bleedind

The script required by require_once might use variable names like $app
which will conflict with the code that follows.

This fix encapsulates require_once into its own function to avoid such
issues.

Fixes https://github.com/owncloud/core/issues/11553

Please review/test @MorrisJobke @DeepDiver1975 @mmattel @kedanli