use preDelete instead of postDelete hook

:warning::warning::warning: DO NOT MERGE YET :warning::warning::warning:

use preDelete instead of postDelete hook.
based on https://github.com/owncloud/core/pull/7668 and https://github.com/owncloud/core/pull/7669