OCP event before file delete?

Hi.
I’d like to develop an app to prevent the deletion of some files, either via web or client. I was looking at preDelete hook but I read in the docs it’s being deprecated. Unfortunately I couldn’t find the corresponding event in OCP ones. Did I miss something or shall I stick with hooks?

Thanks

Hi @maxxer,

Try OCP\Files\Events\Node\BeforeNodeDeletedEvent . A lot of code is still using the deprecated hooks. Much work to migrate everything.

2 Likes

Yep, that’s the one. Apparently they are still not documented: https://github.com/nextcloud/server/pull/20597#event-3260601968