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