Just some improvements ...
This commit is contained in:
parent
7136a39f9e
commit
e5bf7bae7b
2 changed files with 18 additions and 5 deletions
|
@ -83,19 +83,32 @@ function discover_poco_run(&$argv, &$argc){
|
||||||
|
|
||||||
function discover_users() {
|
function discover_users() {
|
||||||
// To-Do: Maybe we should check old contact as well.
|
// To-Do: Maybe we should check old contact as well.
|
||||||
$users = q("SELECT `url`, `created`, `updated`, `last_failure`, `last_contact` FROM `gcontact`
|
$users = q("SELECT `url`, `created`, `updated`, `last_failure`, `last_contact`, `server_url` FROM `gcontact`
|
||||||
WHERE `updated` = '0000-00-00 00:00:00' AND `last_contact` = '0000-00-00 00:00:00' AND
|
WHERE `updated` = '0000-00-00 00:00:00' AND `last_contact` = '0000-00-00 00:00:00' AND
|
||||||
`last_failure` = '0000-00-00 00:00:00' AND `network` IN ('%s', '%s', '%s')
|
`last_failure` = '0000-00-00 00:00:00' AND `network` IN ('%s', '%s', '%s')
|
||||||
ORDER BY rand() LIMIT 100",
|
ORDER BY rand()",
|
||||||
dbesc(NETWORK_DFRN), dbesc(NETWORK_DIASPORA), dbesc(NETWORK_OSTATUS));
|
dbesc(NETWORK_DFRN), dbesc(NETWORK_DIASPORA), dbesc(NETWORK_OSTATUS));
|
||||||
|
|
||||||
if (!$users)
|
if (!$users)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
$checked = 0;
|
||||||
|
|
||||||
foreach ($users AS $user) {
|
foreach ($users AS $user) {
|
||||||
if (poco_do_update($user["created"], $user["updated"], $user["last_failure"], $user["last_contact"])) {
|
if (poco_do_update($user["created"], $user["updated"], $user["last_failure"], $user["last_contact"])) {
|
||||||
logger('Check user '.$user["url"]);
|
|
||||||
poco_last_updated($user["url"]);
|
if ($user[0]["server_url"] != "")
|
||||||
|
$server_url = $user[0]["server_url"];
|
||||||
|
else
|
||||||
|
$server_url = poco_detect_server($user["url"]);
|
||||||
|
|
||||||
|
if (poco_check_server($server_url, $gcontacts[0]["network"])) {
|
||||||
|
logger('Check user '.$user["url"]);
|
||||||
|
poco_last_updated($user["url"]);
|
||||||
|
|
||||||
|
if (++$checked > 100)
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -440,7 +440,7 @@ function poco_last_updated($profile) {
|
||||||
$server_url = poco_detect_server($profile);
|
$server_url = poco_detect_server($profile);
|
||||||
|
|
||||||
if ($server_url != "")
|
if ($server_url != "")
|
||||||
if (!poco_check_server($pserver_url, $gcontacts[0]["network"]))
|
if (!poco_check_server($server_url, $gcontacts[0]["network"]))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// noscrape is really fast so we don't cache the call.
|
// noscrape is really fast so we don't cache the call.
|
||||||
|
|
Loading…
Reference in a new issue