]> git.mxchange.org Git - friendica.git/blobdiff - include/items.php
Changed documentation
[friendica.git] / include / items.php
index 820c79e13d6bc22ec7c5fcf1579d7ca3f3a3012d..4a68bd2864db118dc1a82314f16470b3b2d78e2d 100644 (file)
@@ -501,6 +501,20 @@ function item_store($arr, $force_parent = false, $notify = false, $dontcache = f
                }
        }
 
+       if ($notify) {
+               $guid_prefix = "";
+       } elseif ((trim($arr['guid']) == "") AND (trim($arr['plink']) != "")) {
+               $arr['guid'] = uri_to_guid($arr['plink']);
+       } elseif ((trim($arr['guid']) == "") AND (trim($arr['uri']) != "")) {
+               $arr['guid'] = uri_to_guid($arr['uri']);
+       } else {
+               $parsed = parse_url($arr["author-link"]);
+               $guid_prefix = hash("crc32", $parsed["host"]);
+       }
+
+       $arr['guid']          = ((x($arr, 'guid'))          ? notags(trim($arr['guid']))          : get_guid(32, $guid_prefix));
+       $arr['uri']           = ((x($arr, 'uri'))           ? notags(trim($arr['uri']))           : item_new_uri($a->get_hostname(), $uid, $arr['guid']));
+
        // Store conversation data
        $arr = store_conversation($arr);
 
@@ -585,20 +599,7 @@ function item_store($arr, $force_parent = false, $notify = false, $dontcache = f
 
        item_add_language_opt($arr);
 
-       if ($notify) {
-               $guid_prefix = "";
-       } elseif ((trim($arr['guid']) == "") AND (trim($arr['plink']) != "")) {
-               $arr['guid'] = uri_to_guid($arr['plink']);
-       } elseif ((trim($arr['guid']) == "") AND (trim($arr['uri']) != "")) {
-               $arr['guid'] = uri_to_guid($arr['uri']);
-       } else {
-               $parsed = parse_url($arr["author-link"]);
-               $guid_prefix = hash("crc32", $parsed["host"]);
-       }
-
        $arr['wall']          = ((x($arr, 'wall'))          ? intval($arr['wall'])                : 0);
-       $arr['guid']          = ((x($arr, 'guid'))          ? notags(trim($arr['guid']))          : get_guid(32, $guid_prefix));
-       $arr['uri']           = ((x($arr, 'uri'))           ? notags(trim($arr['uri']))           : item_new_uri($a->get_hostname(), $uid, $arr['guid']));
        $arr['extid']         = ((x($arr, 'extid'))         ? notags(trim($arr['extid']))         : '');
        $arr['author-name']   = ((x($arr, 'author-name'))   ? trim($arr['author-name'])   : '');
        $arr['author-link']   = ((x($arr, 'author-link'))   ? notags(trim($arr['author-link']))   : '');
@@ -2075,7 +2076,7 @@ function item_expire($uid, $days, $network = "", $force = false) {
                drop_item($item['id'], false);
        }
 
-       proc_run(PRIORITY_HIGH, "include/notifier.php", "expire", $uid);
+       proc_run(PRIORITY_LOW, "include/notifier.php", "expire", $uid);
 
 }
 
@@ -2098,7 +2099,7 @@ function drop_items($items) {
        // multiple threads may have been deleted, send an expire notification
 
        if ($uid) {
-               proc_run(PRIORITY_HIGH, "include/notifier.php", "expire", $uid);
+               proc_run(PRIORITY_LOW, "include/notifier.php", "expire", $uid);
        }
 }
 
@@ -2289,11 +2290,12 @@ function drop_item($id, $interactive = true) {
                        }
                }
 
+               // send the notification upstream/downstream
+               // The priority depends on how the deletion is done.
                $drop_id = intval($item['id']);
+               $priority = ($interactive ? PRIORITY_HIGH : PRIORITY_LOW);
 
-               // send the notification upstream/downstream as the case may be
-
-               proc_run(PRIORITY_HIGH, "include/notifier.php", "drop", $drop_id);
+               proc_run($priority, "include/notifier.php", "drop", $drop_id);
 
                if (! $interactive) {
                        return $owner;