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