]> git.mxchange.org Git - friendica.git/blob - include/notifier.php
26d6eeb9905160d7d8a4abb700344e3752c0d9d2
[friendica.git] / include / notifier.php
1 <?php
2
3 use Friendica\App;
4 use Friendica\Core\Config;
5 use Friendica\Core\Worker;
6 use Friendica\Network\Probe;
7 use Friendica\Protocol\Diaspora;
8
9 require_once 'include/queue_fn.php';
10 require_once 'include/html2plain.php';
11 require_once 'include/ostatus.php';
12 require_once 'include/salmon.php';
13
14 /*
15  * This file was at one time responsible for doing all deliveries, but this caused
16  * big problems when the process was killed or stalled during the delivery process.
17  * It now invokes separate queues that are delivering via delivery.php and pubsubpublish.php.
18  */
19
20 /*
21  * The notifier is typically called with:
22  *
23  *              Worker::add(PRIORITY_HIGH, "notifier", COMMAND, ITEM_ID);
24  *
25  * where COMMAND is one of the following:
26  *
27  *              activity                                (in diaspora.php, dfrn_confirm.php, profiles.php)
28  *              comment-import                  (in diaspora.php, items.php)
29  *              comment-new                             (in item.php)
30  *              drop                                    (in diaspora.php, items.php, photos.php)
31  *              edit_post                               (in item.php)
32  *              event                                   (in events.php)
33  *              expire                                  (in items.php)
34  *              like                                    (in like.php, poke.php)
35  *              mail                                    (in message.php)
36  *              suggest                                 (in fsuggest.php)
37  *              tag                                             (in photos.php, poke.php, tagger.php)
38  *              tgroup                                  (in items.php)
39  *              wall-new                                (in photos.php, item.php)
40  *              removeme                                (in Contact.php)
41  *              relocate                                (in uimport.php)
42  *
43  * and ITEM_ID is the id of the item in the database that needs to be sent to others.
44  */
45
46
47 function notifier_run(&$argv, &$argc){
48         global $a;
49
50         require_once 'include/datetime.php';
51         require_once 'include/items.php';
52         require_once 'include/bbcode.php';
53         require_once 'include/email.php';
54
55         if ($argc < 3) {
56                 return;
57         }
58
59         logger('notifier: invoked: ' . print_r($argv,true), LOGGER_DEBUG);
60
61         $cmd = $argv[1];
62
63         switch($cmd) {
64                 case 'mail':
65                 default:
66                         $item_id = intval($argv[2]);
67                         if (! $item_id) {
68                                 return;
69                         }
70                         break;
71         }
72
73         $expire = false;
74         $mail = false;
75         $fsuggest = false;
76         $relocate = false;
77         $top_level = false;
78         $recipients = array();
79         $url_recipients = array();
80
81         $normal_mode = true;
82
83         if ($cmd === 'mail') {
84                 $normal_mode = false;
85                 $mail = true;
86                 $message = q("SELECT * FROM `mail` WHERE `id` = %d LIMIT 1",
87                                 intval($item_id)
88                 );
89                 if (! count($message)) {
90                         return;
91                 }
92                 $uid = $message[0]['uid'];
93                 $recipients[] = $message[0]['contact-id'];
94                 $item = $message[0];
95
96         } elseif ($cmd === 'expire') {
97                 $normal_mode = false;
98                 $expire = true;
99                 $items = q("SELECT * FROM `item` WHERE `uid` = %d AND `wall` = 1
100                         AND `deleted` = 1 AND `changed` > UTC_TIMESTAMP() - INTERVAL 10 MINUTE",
101                         intval($item_id)
102                 );
103                 $uid = $item_id;
104                 $item_id = 0;
105                 if (! count($items)) {
106                         return;
107                 }
108         } elseif ($cmd === 'suggest') {
109                 $normal_mode = false;
110                 $fsuggest = true;
111
112                 $suggest = q("SELECT * FROM `fsuggest` WHERE `id` = %d LIMIT 1",
113                         intval($item_id)
114                 );
115                 if (! count($suggest)) {
116                         return;
117                 }
118                 $uid = $suggest[0]['uid'];
119                 $recipients[] = $suggest[0]['cid'];
120                 $item = $suggest[0];
121         } elseif ($cmd === 'removeme') {
122                 $r = q("SELECT `contact`.*, `user`.`pubkey` AS `upubkey`, `user`.`prvkey` AS `uprvkey`,
123                                 `user`.`timezone`, `user`.`nickname`, `user`.`sprvkey`, `user`.`spubkey`,
124                                 `user`.`page-flags`, `user`.`prvnets`, `user`.`account-type`, `user`.`guid`
125                         FROM `contact` INNER JOIN `user` ON `user`.`uid` = `contact`.`uid`
126                                 WHERE `contact`.`uid` = %d AND `contact`.`self` LIMIT 1",
127                                 intval($item_id));
128                 if (!$r)
129                         return;
130
131                 $user = $r[0];
132
133                 $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `self` LIMIT 1", intval($item_id));
134                 if (!$r)
135                         return;
136
137                 $self = $r[0];
138
139                 $r = q("SELECT * FROM `contact` WHERE NOT `self` AND `uid` = %d", intval($item_id));
140                 if (!$r) {
141                         return;
142                 }
143                 require_once 'include/Contact.php';
144                 foreach ($r as $contact) {
145                         terminate_friendship($user, $self, $contact);
146                 }
147                 return;
148         } elseif ($cmd === 'relocate') {
149                 $normal_mode = false;
150                 $relocate = true;
151                 $uid = $item_id;
152
153                 $recipients_relocate = q("SELECT * FROM `contact` WHERE `uid` = %d AND NOT `self` AND `network` IN ('%s', '%s')",
154                                         intval($uid), NETWORK_DFRN, NETWORK_DIASPORA);
155         } else {
156                 // find ancestors
157                 $r = q("SELECT * FROM `item` WHERE `id` = %d AND visible = 1 AND moderated = 0 LIMIT 1",
158                         intval($item_id)
159                 );
160
161                 if ((! dbm::is_result($r)) || (! intval($r[0]['parent']))) {
162                         return;
163                 }
164
165                 $target_item = $r[0];
166                 $parent_id = intval($r[0]['parent']);
167                 $uid = $r[0]['uid'];
168                 $updated = $r[0]['edited'];
169
170                 $items = q("SELECT `item`.*, `sign`.`signed_text`,`sign`.`signature`,`sign`.`signer`
171                         FROM `item` LEFT JOIN `sign` ON `sign`.`iid` = `item`.`id` WHERE `parent` = %d AND visible = 1 AND moderated = 0 ORDER BY `id` ASC",
172                         intval($parent_id)
173                 );
174
175                 if (! count($items)) {
176                         return;
177                 }
178
179                 // avoid race condition with deleting entries
180
181                 if ($items[0]['deleted']) {
182                         foreach ($items as $item) {
183                                 $item['deleted'] = 1;
184                         }
185                 }
186
187                 if ((count($items) == 1) && ($items[0]['id'] === $target_item['id']) && ($items[0]['uri'] === $items[0]['parent-uri'])) {
188                         logger('notifier: top level post');
189                         $top_level = true;
190                 }
191
192         }
193
194         $r = q("SELECT `contact`.*, `user`.`pubkey` AS `upubkey`, `user`.`prvkey` AS `uprvkey`,
195                 `user`.`timezone`, `user`.`nickname`, `user`.`sprvkey`, `user`.`spubkey`,
196                 `user`.`page-flags`, `user`.`prvnets`, `user`.`account-type`
197                 FROM `contact` INNER JOIN `user` ON `user`.`uid` = `contact`.`uid`
198                 WHERE `contact`.`uid` = %d AND `contact`.`self` = 1 LIMIT 1",
199                 intval($uid)
200         );
201
202         if (! dbm::is_result($r)) {
203                 return;
204         }
205
206         $owner = $r[0];
207
208         $walltowall = ((($top_level) && ($owner['id'] != $items[0]['contact-id'])) ? true : false);
209
210         // Should the post be transmitted to Diaspora?
211         $diaspora_delivery = true;
212
213         // If this is a public conversation, notify the feed hub
214         $public_message = true;
215
216         // Do a PuSH
217         $push_notify = false;
218
219         // Deliver directly to a forum, don't PuSH
220         $direct_forum_delivery = false;
221
222         // fill this in with a single salmon slap if applicable
223         $slap = '';
224
225         if (! ($mail || $fsuggest || $relocate)) {
226
227                 $slap = ostatus::salmon($target_item,$owner);
228
229                 require_once 'include/group.php';
230
231                 $parent = $items[0];
232
233                 $thr_parent = q("SELECT `network`, `author-link`, `owner-link` FROM `item` WHERE `uri` = '%s' AND `uid` = %d",
234                         dbesc($target_item["thr-parent"]), intval($target_item["uid"]));
235
236                 logger('GUID: '.$target_item["guid"].': Parent is '.$parent['network'].'. Thread parent is '.$thr_parent[0]['network'], LOGGER_DEBUG);
237
238                 // This is IMPORTANT!!!!
239
240                 // We will only send a "notify owner to relay" or followup message if the referenced post
241                 // originated on our system by virtue of having our hostname somewhere
242                 // in the URI, AND it was a comment (not top_level) AND the parent originated elsewhere.
243
244                 // if $parent['wall'] == 1 we will already have the parent message in our array
245                 // and we will relay the whole lot.
246
247                 // expire sends an entire group of expire messages and cannot be forwarded.
248                 // However the conversation owner will be a part of the conversation and will
249                 // be notified during this run.
250                 // Other DFRN conversation members will be alerted during polled updates.
251
252
253
254                 // Diaspora members currently are not notified of expirations, and other networks have
255                 // either limited or no ability to process deletions. We should at least fix Diaspora
256                 // by stringing togther an array of retractions and sending them onward.
257
258
259                 $localhost = str_replace('www.','',$a->get_hostname());
260                 if (strpos($localhost,':')) {
261                         $localhost = substr($localhost,0,strpos($localhost,':'));
262                 }
263                 /**
264                  *
265                  * Be VERY CAREFUL if you make any changes to the following several lines. Seemingly innocuous changes
266                  * have been known to cause runaway conditions which affected several servers, along with
267                  * permissions issues.
268                  *
269                  */
270
271                 $relay_to_owner = false;
272
273                 if (!$top_level && ($parent['wall'] == 0) && !$expire && (stristr($target_item['uri'],$localhost))) {
274                         $relay_to_owner = true;
275                 }
276
277
278                 if (($cmd === 'uplink') && (intval($parent['forum_mode']) == 1) && !$top_level) {
279                         $relay_to_owner = true;
280                 }
281
282                 // until the 'origin' flag has been in use for several months
283                 // we will just use it as a fallback test
284                 // later we will be able to use it as the primary test of whether or not to relay.
285
286                 if (! $target_item['origin']) {
287                         $relay_to_owner = false;
288                 }
289                 if ($parent['origin']) {
290                         $relay_to_owner = false;
291                 }
292
293                 // Special treatment for forum posts
294                 if (($target_item['author-link'] != $target_item['owner-link']) &&
295                         ($owner['id'] != $target_item['contact-id']) &&
296                         ($target_item['uri'] === $target_item['parent-uri'])) {
297
298                         $fields = array('forum', 'prv');
299                         $condition = array('id' => $target_item['contact-id']);
300                         $contact = dba::select('contact', $fields, $condition, array('limit' => 1));
301                         if (!dbm::is_result($contact)) {
302                                 // Should never happen
303                                 return false;
304                         }
305
306                         // Is the post from a forum?
307                         if ($contact['forum'] || $contact['prv']) {
308                                 $relay_to_owner = true;
309                                 $direct_forum_delivery = true;
310                         }
311                 }
312                 if ($relay_to_owner) {
313                         logger('notifier: followup '.$target_item["guid"], LOGGER_DEBUG);
314                         // local followup to remote post
315                         $followup = true;
316                         $public_message = false; // not public
317                         $conversant_str = dbesc($parent['contact-id']);
318                         $recipients = array($parent['contact-id']);
319                         $recipients_followup  = array($parent['contact-id']);
320
321                         //if (!$target_item['private'] && $target_item['wall'] &&
322                         if (!$target_item['private'] &&
323                                 (strlen($target_item['allow_cid'].$target_item['allow_gid'].
324                                         $target_item['deny_cid'].$target_item['deny_gid']) == 0))
325                                 $push_notify = true;
326
327                         if (($thr_parent && ($thr_parent[0]['network'] == NETWORK_OSTATUS)) || ($parent['network'] == NETWORK_OSTATUS)) {
328
329                                 $push_notify = true;
330
331                                 if ($parent["network"] == NETWORK_OSTATUS) {
332                                         // Distribute the message to the DFRN contacts as if this wasn't a followup since OStatus can't relay comments
333                                         // Currently it is work at progress
334                                         $r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `network` = '%s' AND NOT `blocked` AND NOT `pending` AND NOT `archive`",
335                                                 intval($uid),
336                                                 dbesc(NETWORK_DFRN)
337                                         );
338                                         if (dbm::is_result($r)) {
339                                                 foreach ($r as $rr) {
340                                                         $recipients_followup[] = $rr['id'];
341                                                 }
342                                         }
343                                 }
344                         }
345
346                         if ($direct_forum_delivery) {
347                                 $push_notify = false;
348                         }
349
350                         logger("Notify ".$target_item["guid"]." via PuSH: ".($push_notify?"Yes":"No"), LOGGER_DEBUG);
351                 } else {
352                         $followup = false;
353
354                         logger('Distributing directly '.$target_item["guid"], LOGGER_DEBUG);
355
356                         // don't send deletions onward for other people's stuff
357
358                         if ($target_item['deleted'] && (! intval($target_item['wall']))) {
359                                 logger('notifier: ignoring delete notification for non-wall item');
360                                 return;
361                         }
362
363                         if ((strlen($parent['allow_cid']))
364                                 || (strlen($parent['allow_gid']))
365                                 || (strlen($parent['deny_cid']))
366                                 || (strlen($parent['deny_gid']))) {
367                                 $public_message = false; // private recipients, not public
368                         }
369
370                         $allow_people = expand_acl($parent['allow_cid']);
371                         $allow_groups = expand_groups(expand_acl($parent['allow_gid']),true);
372                         $deny_people  = expand_acl($parent['deny_cid']);
373                         $deny_groups  = expand_groups(expand_acl($parent['deny_gid']));
374
375                         // if our parent is a public forum (forum_mode == 1), uplink to the origional author causing
376                         // a delivery fork. private groups (forum_mode == 2) do not uplink
377
378                         if ((intval($parent['forum_mode']) == 1) && (! $top_level) && ($cmd !== 'uplink')) {
379                                 Worker::add($a->queue['priority'], 'notifier', 'uplink', $item_id);
380                         }
381
382                         $conversants = array();
383
384                         foreach ($items as $item) {
385                                 $recipients[] = $item['contact-id'];
386                                 $conversants[] = $item['contact-id'];
387                                 // pull out additional tagged people to notify (if public message)
388                                 if ($public_message && strlen($item['inform'])) {
389                                         $people = explode(',',$item['inform']);
390                                         foreach ($people as $person) {
391                                                 if (substr($person,0,4) === 'cid:') {
392                                                         $recipients[] = intval(substr($person,4));
393                                                         $conversants[] = intval(substr($person,4));
394                                                 } else {
395                                                         $url_recipients[] = substr($person,4);
396                                                 }
397                                         }
398                                 }
399                         }
400
401                         if (count($url_recipients))
402                                 logger('notifier: '.$target_item["guid"].' url_recipients ' . print_r($url_recipients,true));
403
404                         $conversants = array_unique($conversants);
405
406
407                         $recipients = array_unique(array_merge($recipients,$allow_people,$allow_groups));
408                         $deny = array_unique(array_merge($deny_people,$deny_groups));
409                         $recipients = array_diff($recipients,$deny);
410
411                         $conversant_str = dbesc(implode(', ',$conversants));
412                 }
413
414                 // If the thread parent is OStatus then do some magic to distribute the messages.
415                 // We have not only to look at the parent, since it could be a Friendica thread.
416                 if (($thr_parent && ($thr_parent[0]['network'] == NETWORK_OSTATUS)) || ($parent['network'] == NETWORK_OSTATUS)) {
417
418                         $diaspora_delivery = false;
419
420                         logger('Some parent is OStatus for '.$target_item["guid"]." - Author: ".$thr_parent[0]['author-link']." - Owner: ".$thr_parent[0]['owner-link'], LOGGER_DEBUG);
421
422                         // Send a salmon to the parent author
423                         $r = q("SELECT `url`, `notify` FROM `contact` WHERE `nurl`='%s' AND `uid` IN (0, %d) AND `notify` != ''",
424                                 dbesc(normalise_link($thr_parent[0]['author-link'])),
425                                 intval($uid));
426                         if (dbm::is_result($r)) {
427                                 $probed_contact = $r[0];
428                         } else {
429                                 $probed_contact = Probe::uri($thr_parent[0]['author-link']);
430                         }
431
432                         if ($probed_contact["notify"] != "") {
433                                 logger('Notify parent author '.$probed_contact["url"].': '.$probed_contact["notify"]);
434                                 $url_recipients[$probed_contact["notify"]] = $probed_contact["notify"];
435                         }
436
437                         // Send a salmon to the parent owner
438                         $r = q("SELECT `url`, `notify` FROM `contact` WHERE `nurl`='%s' AND `uid` IN (0, %d) AND `notify` != ''",
439                                 dbesc(normalise_link($thr_parent[0]['owner-link'])),
440                                 intval($uid));
441                         if (dbm::is_result($r)) {
442                                 $probed_contact = $r[0];
443                         } else {
444                                 $probed_contact = Probe::uri($thr_parent[0]['owner-link']);
445                         }
446
447                         if ($probed_contact["notify"] != "") {
448                                 logger('Notify parent owner '.$probed_contact["url"].': '.$probed_contact["notify"]);
449                                 $url_recipients[$probed_contact["notify"]] = $probed_contact["notify"];
450                         }
451
452                         // Send a salmon notification to every person we mentioned in the post
453                         $arr = explode(',',$target_item['tag']);
454                         foreach ($arr as $x) {
455                                 //logger('Checking tag '.$x, LOGGER_DEBUG);
456                                 $matches = null;
457                                 if (preg_match('/@\[url=([^\]]*)\]/',$x,$matches)) {
458                                                 $probed_contact = Probe::uri($matches[1]);
459                                         if ($probed_contact["notify"] != "") {
460                                                 logger('Notify mentioned user '.$probed_contact["url"].': '.$probed_contact["notify"]);
461                                                 $url_recipients[$probed_contact["notify"]] = $probed_contact["notify"];
462                                         }
463                                 }
464                         }
465
466                         // It only makes sense to distribute answers to OStatus messages to Friendica and OStatus - but not Diaspora
467                         $sql_extra = " AND `network` IN ('".NETWORK_OSTATUS."', '".NETWORK_DFRN."')";
468                 } else {
469                         $sql_extra = " AND `network` IN ('".NETWORK_OSTATUS."', '".NETWORK_DFRN."', '".NETWORK_DIASPORA."', '".NETWORK_MAIL."', '".NETWORK_MAIL2."')";
470                 }
471         } else {
472                 $public_message = false;
473         }
474
475         // If this is a public message and pubmail is set on the parent, include all your email contacts
476
477         $mail_disabled = ((function_exists('imap_open') && (!Config::get('system','imap_disabled'))) ? 0 : 1);
478
479         if (! $mail_disabled) {
480                 if ((! strlen($target_item['allow_cid'])) && (! strlen($target_item['allow_gid']))
481                         && (! strlen($target_item['deny_cid'])) && (! strlen($target_item['deny_gid']))
482                         && (intval($target_item['pubmail']))) {
483                         $r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `network` = '%s'",
484                                 intval($uid),
485                                 dbesc(NETWORK_MAIL)
486                         );
487                         if (dbm::is_result($r)) {
488                                 foreach ($r as $rr) {
489                                         $recipients[] = $rr['id'];
490                                 }
491                         }
492                 }
493         }
494
495         if ($followup) {
496                 $recip_str = implode(', ', $recipients_followup);
497         } else {
498                 $recip_str = implode(', ', $recipients);
499         }
500         if ($relocate) {
501                 $r = $recipients_relocate;
502         } else {
503                 $r = q("SELECT `id`, `url`, `network`, `self` FROM `contact`
504                         WHERE `id` IN (%s) AND NOT `blocked` AND NOT `pending` AND NOT `archive`".$sql_extra,
505                         dbesc($recip_str)
506                 );
507         }
508
509         // delivery loop
510
511         if (dbm::is_result($r)) {
512                 foreach ($r as $contact) {
513                         if ($contact['self']) {
514                                 continue;
515                         }
516                         logger("Deliver ".$target_item["guid"]." to ".$contact['url']." via network ".$contact['network'], LOGGER_DEBUG);
517
518                         Worker::add(array('priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true),
519                                         'delivery', $cmd, $item_id, (int)$contact['id']);
520                 }
521         }
522
523         // send salmon slaps to mentioned remote tags (@foo@example.com) in OStatus posts
524         // They are especially used for notifications to OStatus users that don't follow us.
525
526         if ($slap && count($url_recipients) && ($public_message || $push_notify) && $normal_mode) {
527                 if (!Config::get('system','dfrn_only')) {
528                         foreach ($url_recipients as $url) {
529                                 if ($url) {
530                                         logger('notifier: urldelivery: ' . $url);
531                                         $deliver_status = slapper($owner,$url,$slap);
532                                         /// @TODO Redeliver/queue these items on failure, though there is no contact record
533                                 }
534                         }
535                 }
536         }
537
538
539         if ($public_message) {
540
541                 $r0 = array();
542                 $r1 = array();
543
544                 if ($diaspora_delivery) {
545                         if (!$followup) {
546                                 $r0 = Diaspora::relay_list();
547                         }
548
549                         $r1 = q("SELECT `batch`, ANY_VALUE(`id`) AS `id`, ANY_VALUE(`name`) AS `name`, ANY_VALUE(`network`) AS `network`
550                                 FROM `contact` WHERE `network` = '%s' AND `batch` != ''
551                                 AND `uid` = %d AND `rel` != %d AND NOT `blocked` AND NOT `pending` AND NOT `archive` GROUP BY `batch`",
552                                 dbesc(NETWORK_DIASPORA),
553                                 intval($owner['uid']),
554                                 intval(CONTACT_IS_SHARING)
555                         );
556                 }
557
558                 $r2 = q("SELECT `id`, `name`,`network` FROM `contact`
559                         WHERE `network` in ('%s', '%s') AND `uid` = %d AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND `rel` != %d",
560                         dbesc(NETWORK_DFRN),
561                         dbesc(NETWORK_MAIL2),
562                         intval($owner['uid']),
563                         intval(CONTACT_IS_SHARING)
564                 );
565
566                 $r = array_merge($r2,$r1,$r0);
567
568                 if (dbm::is_result($r)) {
569                         logger('pubdeliver '.$target_item["guid"].': '.print_r($r,true), LOGGER_DEBUG);
570
571                         foreach ($r as $rr) {
572
573                                 // except for Diaspora batch jobs
574                                 // Don't deliver to folks who have already been delivered to
575
576                                 if (($rr['network'] !== NETWORK_DIASPORA) && (in_array($rr['id'],$conversants))) {
577                                         logger('notifier: already delivered id=' . $rr['id']);
578                                         continue;
579                                 }
580
581                                 if ((! $mail) && (! $fsuggest) && (! $followup)) {
582                                         logger('notifier: delivery agent: '.$rr['name'].' '.$rr['id'].' '.$rr['network'].' '.$target_item["guid"]);
583                                         Worker::add(array('priority' => $a->queue['priority'], 'created' => $a->queue['created'], 'dont_fork' => true),
584                                                         'delivery', $cmd, $item_id, (int)$rr['id']);
585                                 }
586                         }
587                 }
588
589                 $push_notify = true;
590
591         }
592
593         // Notify PuSH subscribers (Used for OStatus distribution of regular posts)
594         if ($push_notify) {
595                 // Set push flag for PuSH subscribers to this topic,
596                 // they will be notified in queue.php
597                 q("UPDATE `push_subscriber` SET `push` = 1 ".
598                   "WHERE `nickname` = '%s' AND `push` = 0", dbesc($owner['nickname']));
599
600                 logger('Activating internal PuSH for item '.$item_id, LOGGER_DEBUG);
601
602                 // Handling the pubsubhubbub requests
603                 Worker::add(array('priority' => PRIORITY_HIGH, 'created' => $a->queue['created'], 'dont_fork' => true),
604                                 'pubsubpublish');
605         }
606
607         logger('notifier: calling hooks', LOGGER_DEBUG);
608
609         if ($normal_mode) {
610                 call_hooks('notifier_normal',$target_item);
611         }
612
613         call_hooks('notifier_end',$target_item);
614
615         return;
616 }