[Owncloud] Mail Notification

Thomas Tanghus thomas at tanghus.net
Wed Dec 12 15:33:55 UTC 2012


On Wednesday 12 December 2012 11:07 Jascha Burmeister wrote:
> Thank you for the fast response Thomas.
> But your posted notify app works in another way.
> 
> My problem:
> 
> I'm hooking this:
> OC_HOOK::connect('OC_Filesystem', 'post_write', 'OC_MailNotify_Hooks',
> 'notify');
> 
> The notify() function contains my mail sending script which works well.
> But notify() gets called more then one time if I upload one file.
> 
> Any advice for a solution?

git grep -n post_write|grep emit
lib/filecache.php:49: OC_Hook::emit('OC_Filesystem', 'post_write', array('path'=>$path));
lib/filecache/update.php:91: OC_Hook::emit('OC_Filesystem', 'post_write', array('path'=>$file));
lib/filecache/update.php:104: OC_Hook::emit('OC_Filesystem', 'post_write', array('path'=>$path));

It looks like the signal gets emitted once for the file, and once
for the folder it's in. You could test if it's a file or folder in the hook.
But I don't know much about the filesystem, so I could very well be wrong.

> J. Burmeister
-- 
Med venlig hilsen / Best Regards

Thomas Tanghus



More information about the Owncloud mailing list