From cbd2fc1572028a4b7e6753d4abebb46995328145 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Thu, 23 Jul 2015 20:57:08 +0200 Subject: [PATCH] "last_contact" is now set automatically if it is lower than the update value. --- include/socgraph.php | 6 +++++- mod/poco.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/socgraph.php b/include/socgraph.php index 272fcea994..b9028724a2 100644 --- a/include/socgraph.php +++ b/include/socgraph.php @@ -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), diff --git a/mod/poco.php b/mod/poco.php index 0b62e93e38..250add179f 100644 --- a/mod/poco.php +++ b/mod/poco.php @@ -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) ); -- 2.39.5