Delete the alternate OStatus profile url if present.

This commit is contained in:
Michael Vogel 2015-08-24 18:36:13 +02:00
parent 9ae4528d8b
commit 2fe6156d54
1 changed files with 12 additions and 1 deletions

View File

@ -237,6 +237,8 @@ function poco_check($profile_url, $name, $network, $profile_photo, $about, $loca
AND poco_reachable($profile_url, $server_url, $network, true)) { AND poco_reachable($profile_url, $server_url, $network, true)) {
$data = probe_url($profile_url); $data = probe_url($profile_url);
$orig_profile = $profile_url;
$network = $data["network"]; $network = $data["network"];
$name = $data["name"]; $name = $data["name"];
$nick = $data["nick"]; $nick = $data["nick"];
@ -244,8 +246,17 @@ function poco_check($profile_url, $name, $network, $profile_photo, $about, $loca
$profile_photo = $data["photo"]; $profile_photo = $data["photo"];
$server_url = $data["baseurl"]; $server_url = $data["baseurl"];
if ($alternate AND ($network == NETWORK_OSTATUS)) if ($alternate AND ($network == NETWORK_OSTATUS)) {
// Delete the old entry - if it exists
$r = q("SELECT `id` FROM `gcontact` WHERE `nurl` = '%s'", dbesc(normalise_link($orig_profile)));
if ($r) {
q("DELETE FROM `gcontact` WHERE `nurl` = '%s'", dbesc(normalise_link($orig_profile)));
q("DELETE FROM `glink` WHERE `gcid` = %d", intval($r[0]["id"]));
}
// possibly create a new entry
poco_check($profile_url, $name, $network, $profile_photo, $about, $location, $gender, $keywords, $connect_url, $updated, $generation, $cid, $uid, $zcid); poco_check($profile_url, $name, $network, $profile_photo, $about, $location, $gender, $keywords, $connect_url, $updated, $generation, $cid, $uid, $zcid);
}
} }
if ($alternate AND ($network == NETWORK_OSTATUS)) if ($alternate AND ($network == NETWORK_OSTATUS))