"last_contact" is now set automatically if it is lower than the update value.

This commit is contained in:
Michael Vogel 2015-07-23 20:57:08 +02:00
parent 201d95a855
commit cbd2fc1572
2 changed files with 6 additions and 2 deletions

View file

@ -223,6 +223,9 @@ function poco_check($profile_url, $name, $network, $profile_photo, $about, $loca
$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";
@ -294,7 +297,7 @@ function poco_check($profile_url, $name, $network, $profile_photo, $about, $loca
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),
@ -303,6 +306,7 @@ function poco_check($profile_url, $name, $network, $profile_photo, $about, $loca
dbesc($profile_url),
dbesc($server_url),
dbesc($updated),
dbesc($last_contact),
dbesc($location),
dbesc($about),
dbesc($keywords),

View file

@ -61,7 +61,7 @@ function poco_init(&$a) {
$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)
);