I think this should be implemented too here https://github.com/owncloud/core/blob/master/lib/base.php#L402-L421