Some correction stuff for old entries in the global contacts

This commit is contained in:
Michael Vogel 2015-07-28 15:28:58 +02:00
parent ec161d798f
commit 9f073f2fd5
2 changed files with 31 additions and 4 deletions

View file

@ -87,8 +87,9 @@ function discover_users() {
$users = q("SELECT `url`, `created`, `updated`, `last_failure`, `last_contact`, `server_url` FROM `gcontact`
WHERE `last_contact` < UTC_TIMESTAMP - INTERVAL 1 MONTH AND
`last_failure` < UTC_TIMESTAMP - INTERVAL 1 MONTH AND
`network` IN ('%s', '%s', '%s') ORDER BY rand()",
dbesc(NETWORK_DFRN), dbesc(NETWORK_DIASPORA), dbesc(NETWORK_OSTATUS));
`network` IN ('%s', '%s', '%s', '%s', '') ORDER BY rand()",
dbesc(NETWORK_DFRN), dbesc(NETWORK_DIASPORA),
dbesc(NETWORK_OSTATUS), dbesc(NETWORK_FEED));
if (!$users)
return;

View file

@ -176,7 +176,7 @@ function poco_check($profile_url, $name, $network, $profile_photo, $about, $loca
if (!isset($urlparts["scheme"]))
return $gcid;
if (in_array($urlparts["host"], array("facebook.com", "twitter.com", "www.twitter-rss.com",
if (in_array($urlparts["host"], array("www.facebook.com", "facebook.com", "twitter.com",
"identi.ca", "alpha.app.net")))
return $gcid;
@ -434,15 +434,41 @@ function poco_last_updated($profile, $force = false) {
q("UPDATE `gcontact` SET `created` = '%s' WHERE `nurl` = '%s'",
dbesc(datetime_convert()), dbesc(normalise_link($profile)));
$urlparts = parse_url($profile);
if (!isset($urlparts["scheme"]))
return;
if (in_array($urlparts["host"], array("www.facebook.com", "facebook.com", "twitter.com",
"identi.ca", "alpha.app.net"))) {
q("UPDATE `gcontact` SET `network` = '%s' WHERE `nurl` = '%s'",
dbesc(NETWORK_PHANTOM), dbesc(normalise_link($profile)));
return;
}
if ($gcontacts[0]["server_url"] != "")
$server_url = $gcontacts[0]["server_url"];
else
$server_url = poco_detect_server($profile);
if ($server_url != "")
if ($server_url != "") {
if (!poco_check_server($server_url, $gcontacts[0]["network"]))
return false;
q("UPDATE `gcontact` SET `server_url` = '%s' WHERE `nurl` = '%s'",
dbesc($server_url), dbesc(normalise_link($profile)));
}
if (in_array($gcontacts[0]["network"], array("", NETWORK_FEED))) {
$server = q("SELECT `network` FROM `gserver` WHERE `nurl` = '%s' AND `network` != ''",
dbesc(normalise_link($server_url)));
if ($server)
q("UPDATE `gcontact` SET `network` = '%s' WHERE `nurl` = '%s'",
dbesc($server[0]["network"]), dbesc(normalise_link($profile)));
else
return;
}
// noscrape is really fast so we don't cache the call.
if (($gcontacts[0]["server_url"] != "") AND ($gcontacts[0]["nick"] != "")) {