I’ve been tinkering with both postCreate and postWrite. Each of these seems to trigger multiple times per upload, and though I’ve yet to confirm it they even seem to trigger when the app is enabled from the admin panel.
How do I run code just once, after a file appears? Can anyone point me towards documentation or code examples?
I need to have access to its oc_filecache id, filename, mimetype, and parent folder.
I did look through every post that had the keyword “hook”. Unfortunately, for some reason it’s firing 3-5 times every time on postCreate. I suspect that I have some misconception about what it’s supposed to do, but since there is little documentation and even less activity here, I may never know the real reason.
I’ve decided to move on and attempt to not use hooks. I can pull from oc_filecache directly, assuming I can figure out how to filter those files I do not want (entries show up nearly instantly in there anyway).
I can’t figure out which files are available to which user though, and it doesn’t seem trivial in sql.
since there is little documentation and even less activity here, I may never know the real reason.
And this is the biggest problem Nextcloud has. Without proper documentation the amount of apps will stay the same, because devs can’t find information and will quit working on the app.
I’ve had several moments when i was thinking to stop developing for Nextcloud because of this.
They should place a bounty on the docs orso, so it’s much more attractive to write docs.
Let’s be honest: I’ve had several ‘things’ which were missing on the docs, so i took a dive into the code and found the solution, but i didn’t update the docs. Why? Because it’s not my job to write proper docs, and i would spend more time on writing docs than writing code, which is something i don’t prefer.