[sharing] fix performance issues

Fix performance issue when the user has folders with many files and want to share a new one.

https://github.com/owncloud/core/issues/10588
Also the PHPDoc of the interface is stating that this function can return false which is wrong now.