Added extra check to avoid deleting key folders

Whenever a delete operation is called twice in a row, it could happen
that the first call already deleted the file.

The second call would return an empty $ownerPath because the file does
not exist. That empty $ownerPath would run the key deletion operation on
the wrong path.

This fix adds checks in many places to make sure we don't use $ownerPath
when it's empty or null.

Fixes https://github.com/owncloud/core/issues/11183

Please review @schiesbn @LukasReschke @icewind1991 

Regression testing needed:
- [ ] reproduce original issue (see steps in ticket)
- [ ] versions delete + restore
- [ ] encryption share-keys delete + restore