For unique values we should use our guid function - not the random function

This commit is contained in:
Michael Vogel 2015-08-14 00:40:36 +02:00
parent 4663df5b2b
commit a2d742ec91
3 changed files with 10 additions and 4 deletions

View file

@ -2968,7 +2968,7 @@ function item_is_remote_self($contact, &$datarray) {
if ($contact['network'] != NETWORK_FEED) { if ($contact['network'] != NETWORK_FEED) {
$datarray["guid"] = get_guid(32); $datarray["guid"] = get_guid(32);
unset($datarray["plink"]); unset($datarray["plink"]);
$datarray["uri"] = item_new_uri($a->get_hostname(),$contact['uid']); $datarray["uri"] = item_new_uri($a->get_hostname(),$contact['uid'], $datarray["guid"]);
$datarray["parent-uri"] = $datarray["uri"]; $datarray["parent-uri"] = $datarray["uri"];
$datarray["extid"] = $contact['network']; $datarray["extid"] = $contact['network'];
$urlpart = parse_url($datarray2['author-link']); $urlpart = parse_url($datarray2['author-link']);

View file

@ -470,11 +470,17 @@ if(! function_exists('item_new_uri')) {
* @param int $uid * @param int $uid
* @return string * @return string
*/ */
function item_new_uri($hostname,$uid) { function item_new_uri($hostname,$uid, $guid = "") {
do { do {
$dups = false; $dups = false;
$hash = random_string();
if ($guid == "")
$hash = get_guid(32);
else {
$hash = $guid;
$guid = "";
}
$uri = "urn:X-dfrn:" . $hostname . ':' . $uid . ':' . $hash; $uri = "urn:X-dfrn:" . $hostname . ':' . $uid . ':' . $hash;

View file

@ -674,7 +674,7 @@ function item_post(&$a) {
$notify_type = (($parent) ? 'comment-new' : 'wall-new' ); $notify_type = (($parent) ? 'comment-new' : 'wall-new' );
$uri = (($message_id) ? $message_id : item_new_uri($a->get_hostname(),$profile_uid)); $uri = (($message_id) ? $message_id : item_new_uri($a->get_hostname(),$profile_uid, $guid));
// Fallback so that we alway have a thr-parent // Fallback so that we alway have a thr-parent
if(!$thr_parent) if(!$thr_parent)