$last_failure = $x[0]["last_failure"];
$server_url = $x[0]["server_url"];
$nick = $x[0]["nick"];
+
+ if ($updated > $last_contact)
+ $last_contact = $updated;
} else {
$created = "0000-00-00 00:00:00";
$last_contact = "0000-00-00 00:00:00";
if($x[0]['name'] != $name || $x[0]['photo'] != $profile_photo || $x[0]['updated'] < $updated) {
q("UPDATE `gcontact` SET `name` = '%s', `network` = '%s', `photo` = '%s', `connect` = '%s', `url` = '%s', `server_url` = '%s',
- `updated` = '%s', `location` = '%s', `about` = '%s', `keywords` = '%s', `gender` = '%s', `generation` = %d
+ `updated` = '%s', `last_contact` = '%s', `location` = '%s', `about` = '%s', `keywords` = '%s', `gender` = '%s', `generation` = %d
WHERE (`generation` >= %d OR `generation` = 0) AND `nurl` = '%s'",
dbesc($name),
dbesc($network),
dbesc($profile_url),
dbesc($server_url),
dbesc($updated),
+ dbesc($last_contact),
dbesc($location),
dbesc($about),
dbesc($keywords),
$update_limit = date("Y-m-d H:i:s",strtotime($_GET['updatedSince']));
if ($global) {
- $r = q("SELECT count(*) AS `total` FROM `gcontact` WHERE `updated` >= '%s' AND `last_contact` >= `last_failure` AND `network` IN ('%s')",
+ $r = q("SELECT count(*) AS `total` FROM `gcontact` WHERE `updated` >= '%s' AND ((`last_contact` >= `last_failure`) OR (`updated` > `last_failure`)) AND `network` IN ('%s')",
dbesc($update_limit),
dbesc(NETWORK_DFRN)
);