From 2b44c5fc72ac1a76b0a711d459ddcb52ed6666dc Mon Sep 17 00:00:00 2001 From: friendica Date: Fri, 27 Feb 2015 13:43:12 -0800 Subject: Fix a couple of places where we weren't checking for dead hublocs. Add a function to mark a hubloc dead. --- include/hubloc.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'include/hubloc.php') diff --git a/include/hubloc.php b/include/hubloc.php index b5a3d47c5..94f1dc985 100644 --- a/include/hubloc.php +++ b/include/hubloc.php @@ -170,7 +170,16 @@ function hubloc_change_primary($hubloc) { return true; } - + +// We use the post url to distinguish between http and https hublocs. +// The https might be alive, and the http dead. + +function hubloc_mark_as_down($posturl) { + $r = q("update hubloc set hubloc_status = ( hubloc_status | %d ) where hubloc_posturl = '%s'", + intval(HUBLOC_OFFLINE) + ); +} + function xchan_store($arr) { -- cgit v1.2.3 From ba7bdd79b720dcb58dfd88a38f43444eb4da06f4 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 1 Mar 2015 15:55:27 -0800 Subject: queue management actions. Still needs further work such as indication of last successful connection or indication that the hub was marked offline, but these are potentially expensive queries. --- include/hubloc.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'include/hubloc.php') diff --git a/include/hubloc.php b/include/hubloc.php index 94f1dc985..98c1a21f3 100644 --- a/include/hubloc.php +++ b/include/hubloc.php @@ -175,8 +175,9 @@ function hubloc_change_primary($hubloc) { // The https might be alive, and the http dead. function hubloc_mark_as_down($posturl) { - $r = q("update hubloc set hubloc_status = ( hubloc_status | %d ) where hubloc_posturl = '%s'", - intval(HUBLOC_OFFLINE) + $r = q("update hubloc set hubloc_status = ( hubloc_status | %d ) where hubloc_callback = '%s'", + intval(HUBLOC_OFFLINE), + dbesc($posturl) ); } -- cgit v1.2.3 From 62b2fa6ac7ee85c8572eb868eb30dc2e20cf3040 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 22 Mar 2015 20:30:23 -0700 Subject: operation snakebite, cont. --- include/hubloc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/hubloc.php') diff --git a/include/hubloc.php b/include/hubloc.php index 98c1a21f3..ece7bd21a 100644 --- a/include/hubloc.php +++ b/include/hubloc.php @@ -256,12 +256,12 @@ function xchan_fetch($arr) { if(! $key) return false; - $r = q("select * from xchan where $key = '$v'"); + $r = q("select * from xchan where $key = '$v' limit 1"); if(! $r) return false; $ret = array(); - foreach($r as $k => $v) { + foreach($r[0] as $k => $v) { if($k === 'xchan_addr') $ret['address'] = $v; else -- cgit v1.2.3 From f2127d4ba717484140530e17eb8ae495cab349d7 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 23 Mar 2015 15:36:17 -0700 Subject: limit notification detail queries for items and events --- include/hubloc.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include/hubloc.php') diff --git a/include/hubloc.php b/include/hubloc.php index ece7bd21a..a4efe1c75 100644 --- a/include/hubloc.php +++ b/include/hubloc.php @@ -184,6 +184,8 @@ function hubloc_mark_as_down($posturl) { function xchan_store($arr) { + logger('xchan_store: ' . print_r($arr,true)); + if(! $arr['hash']) $arr['hash'] = $arr['guid']; if(! $arr['hash']) @@ -202,7 +204,7 @@ function xchan_store($arr) { if(! $arr['url']) $arr['url'] = z_root(); if(! $arr['photo']) - $arr['photo'] = get_default_profile_photo(); + $arr['photo'] = z_root() . '/' . get_default_profile_photo(); $r = q("insert into xchan ( xchan_hash, xchan_guid, xchan_guid_sig, xchan_pubkey, xchan_addr, xchan_url, xchan_connurl, xchan_follow, xchan_connpage, xchan_name, xchan_network, xchan_instance_url, xchan_flags, xchan_name_date ) values ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s','%s','%s','%s',%d,'%s') ", dbesc($arr['hash']), -- cgit v1.2.3