Optical adjustments for contacts/set "last_failure" when inaccessible

This commit is contained in:
Michael Vogel 2015-11-06 09:15:20 +01:00
parent 721e7e410c
commit 0f563525bd
4 changed files with 23 additions and 6 deletions

View File

@ -204,7 +204,8 @@ function get_contact_details_by_url($url, $uid = -1) {
if ($r) { if ($r) {
$profile = $r[0]; $profile = $r[0];
if ($profile["addr"] == "") if ((($profile["addr"] == "") OR ($profile["name"] == "")) AND
in_array($profile["network"], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS)))
proc_run('php',"include/update_gcontact.php", $profile["gid"]); proc_run('php',"include/update_gcontact.php", $profile["gid"]);
} else { } else {

View File

@ -1047,8 +1047,9 @@ function count_common_friends($uid,$cid) {
$r = q("SELECT count(*) as `total` $r = q("SELECT count(*) as `total`
FROM `glink` INNER JOIN `gcontact` on `glink`.`gcid` = `gcontact`.`id` FROM `glink` INNER JOIN `gcontact` on `glink`.`gcid` = `gcontact`.`id`
where `glink`.`cid` = %d and `glink`.`uid` = %d WHERE `glink`.`cid` = %d AND `glink`.`uid` = %d AND
and `gcontact`.`nurl` in (select nurl from contact where uid = %d and self = 0 and blocked = 0 and hidden = 0 and id != %d ) ", ((`gcontact`.`last_contact` >= `gcontact`.`last_failure`) OR (`gcontact`.`updated` >= `gcontact`.`last_failure`))
AND `gcontact`.`nurl` IN (select nurl from contact where uid = %d and self = 0 and blocked = 0 and hidden = 0 and id != %d ) ",
intval($cid), intval($cid),
intval($uid), intval($uid),
intval($uid), intval($uid),
@ -1077,6 +1078,7 @@ function common_friends($uid,$cid,$start = 0,$limit=9999,$shuffle = false) {
WHERE `glink`.`cid` = %d and `glink`.`uid` = %d WHERE `glink`.`cid` = %d and `glink`.`uid` = %d
AND `contact`.`uid` = %d AND `contact`.`self` = 0 AND `contact`.`blocked` = 0 AND `contact`.`uid` = %d AND `contact`.`self` = 0 AND `contact`.`blocked` = 0
AND `contact`.`hidden` = 0 AND `contact`.`id` != %d AND `contact`.`hidden` = 0 AND `contact`.`id` != %d
AND ((`gcontact`.`last_contact` >= `gcontact`.`last_failure`) OR (`gcontact`.`updated` >= `gcontact`.`last_failure`))
$sql_extra LIMIT %d, %d", $sql_extra LIMIT %d, %d",
intval($cid), intval($cid),
intval($uid), intval($uid),
@ -1134,7 +1136,8 @@ function count_all_friends($uid,$cid) {
$r = q("SELECT count(*) as `total` $r = q("SELECT count(*) as `total`
FROM `glink` INNER JOIN `gcontact` on `glink`.`gcid` = `gcontact`.`id` FROM `glink` INNER JOIN `gcontact` on `glink`.`gcid` = `gcontact`.`id`
where `glink`.`cid` = %d and `glink`.`uid` = %d ", where `glink`.`cid` = %d and `glink`.`uid` = %d AND
((`gcontact`.`last_contact` >= `gcontact`.`last_failure`) OR (`gcontact`.`updated` >= `gcontact`.`last_failure`))",
intval($cid), intval($cid),
intval($uid) intval($uid)
); );
@ -1152,7 +1155,8 @@ function all_friends($uid,$cid,$start = 0, $limit = 80) {
FROM `glink` FROM `glink`
INNER JOIN `gcontact` on `glink`.`gcid` = `gcontact`.`id` INNER JOIN `gcontact` on `glink`.`gcid` = `gcontact`.`id`
LEFT JOIN `contact` ON `contact`.`nurl` = `gcontact`.`nurl` AND `contact`.`uid` = %d LEFT JOIN `contact` ON `contact`.`nurl` = `gcontact`.`nurl` AND `contact`.`uid` = %d
WHERE `glink`.`cid` = %d AND `glink`.`uid` = %d WHERE `glink`.`cid` = %d AND `glink`.`uid` = %d AND
((`gcontact`.`last_contact` >= `gcontact`.`last_failure`) OR (`gcontact`.`updated` >= `gcontact`.`last_failure`))
ORDER BY `gcontact`.`name` ASC LIMIT %d, %d ", ORDER BY `gcontact`.`name` ASC LIMIT %d, %d ",
intval($uid), intval($uid),
intval($cid), intval($cid),

View File

@ -18,6 +18,7 @@ function update_gcontact_run(&$argv, &$argc){
require_once('include/pidfile.php'); require_once('include/pidfile.php');
require_once('include/Scrape.php'); require_once('include/Scrape.php');
require_once("include/socgraph.php");
load_config('config'); load_config('config');
load_config('system'); load_config('system');
@ -54,10 +55,19 @@ function update_gcontact_run(&$argv, &$argc){
if (!$r) if (!$r)
return; return;
if (!in_array($r[0]["network"], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS)))
return;
$data = probe_url($r[0]["url"]); $data = probe_url($r[0]["url"]);
if (!in_array($data["network"], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS))) if (!in_array($data["network"], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS))) {
if ($r[0]["server_url"] != "")
poco_check_server($r[0]["server_url"], $r[0]["network"]);
q("UPDATE `gcontact` SET `last_failure` = '%s' WHERE `id` = %d",
dbesc(datetime_convert()), intval($contact_id));
return; return;
}
if (($data["name"] == "") AND ($r[0]['name'] != "")) if (($data["name"] == "") AND ($r[0]['name'] != ""))
$data["name"] = $r[0]['name']; $data["name"] = $r[0]['name'];

View File

@ -2301,6 +2301,8 @@ aside #id_password {
.contact-entry-wrapper .contact-entry-photo-wrapper { .contact-entry-wrapper .contact-entry-photo-wrapper {
float: left; float: left;
margin-right: 10px; margin-right: 10px;
width: 80px;
height: 80px;
} }
.contact-entry-photo-wrapper { .contact-entry-photo-wrapper {
position: relative; position: relative;