1
0
Fork 0

Check not only for the last contact but also for the last update for the sanity check.

This commit is contained in:
Michael Vogel 2015-07-23 22:21:22 +02:00
commit 880f486044
3 changed files with 8 additions and 6 deletions

View file

@ -93,11 +93,12 @@ function discover_directory($search) {
if(count($j->results))
foreach($j->results as $jj) {
// Check if the contact already exists
$exists = q("SELECT `id`, `last_contact`, `last_failure` FROM `gcontact` WHERE `nurl` = '%s'", normalise_link($jj->url));
$exists = q("SELECT `id`, `last_contact`, `last_failure`, `updated` FROM `gcontact` WHERE `nurl` = '%s'", normalise_link($jj->url));
if ($exists) {
logger("Profile ".$jj->url." already exists (".$search.")", LOGGER_DEBUG);
if ($exists[0]["last_contact"] < $exists[0]["last_failure"])
if (($exists[0]["last_contact"] < $exists[0]["last_failure"]) AND
($exists[0]["updated"] < $exists[0]["last_failure"]))
continue;
// Update the contact