Backport Use context instead of static access
Merge pull request #330 from owncloud/fix-327

Backport Use context instead of static access