X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=include%2Fitems.php;h=4a68bd2864db118dc1a82314f16470b3b2d78e2d;hb=34815de99c548b61c94b6e6939edd485eca728d6;hp=0033deceaf8cb572e795766fa83fa0acb56d813c;hpb=58b2b1dbef0b5f9b914d861e32ee12ad8c52bdf4;p=friendica.git diff --git a/include/items.php b/include/items.php index 0033deceaf..4a68bd2864 100644 --- a/include/items.php +++ b/include/items.php @@ -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'])) : ''); @@ -1022,7 +1023,7 @@ function item_store($arr, $force_parent = false, $notify = false, $dontcache = f logger('Duplicated post occurred. uri = ' . $arr['uri'] . ' uid = ' . $arr['uid']); // Yes, we could do a rollback here - but we are having many users with MyISAM. - q("DELETE FROM `item` WHERE `id` = %d", intval($current_post)); + dba::delete('item', array('id' => $current_post)); dba::commit(); return 0; } elseif ($r[0]["entries"] == 0) { @@ -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;