Yet another cleanup
Fix PHPdoc in apps/files_sharing

using scrutinizer patch
Fix PHPdoc in OC\Share\Share and OCP\Share
Fix linkToPublic. Refs #8218
Also fix linkToAbsolute
Add tests for linkTo, linkToPublic, linkToRemote, linkToRemoteBase
Remove unused var
port database layer from appframework to core
fix scrutinizer issues
fix doc strings for db facade
remove unusued variable
remove unusued variable
move db into iservercontainer
remove useless import
Fix typo & add type
fix phpdoc for entities
Permit personal mount points to be used for sharing

An issue existed where `readData` used `OCP\User::getUser()` to get the user
for personal mount points, which worked in all situations apart from when a
personal mount point was used for sharing, so the return from `getUser()` is
not the user that owns the share. As such, any personal mount points would not
work correctly when shared.

`readData` and `writeData` have been changed from using a `$isPersonal`
boolean to using a `$user` string|null. `$isPersonal = false` can now be
written as `$user = NULL` (or left out in the case of `readData`), and
`$isPersonal = true` can be written as `$user = OCP\User::getUser()`.
dont update entity and dont run an update query if an entity wasnt changed at all
Add sorting to files list, trashbin and public files
Set default sort of trashbin to timestamp descending