poco debugging cont.

This commit is contained in:
friendica 2013-01-25 15:36:18 -08:00
parent a8575199af
commit 318d75a86a
3 changed files with 24 additions and 8 deletions

View File

@ -4,6 +4,8 @@ require_once('boot.php');
require_once('include/cli_startup.php'); require_once('include/cli_startup.php');
require_once('include/zot.php'); require_once('include/zot.php');
require_once('include/socgraph.php'); require_once('include/socgraph.php');
require_once('include/Contact.php');
function onepoll_run($argv, $argc){ function onepoll_run($argv, $argc){
@ -68,7 +70,7 @@ function onepoll_run($argv, $argc){
logger("onepoll: poll: ({$contact['id']}) IMPORTER: {$importer['xchan_name']}, CONTACT: {$contact['xchan_name']}"); logger("onepoll: poll: ({$contact['id']}) IMPORTER: {$importer['xchan_name']}, CONTACT: {$contact['xchan_name']}");
$last_update = (($contact['last_update'] === '0000-00-00 00:00:00') $last_update = (($contact['abook_updated'] === '0000-00-00 00:00:00')
? datetime_convert('UTC','UTC','now - 7 days') ? datetime_convert('UTC','UTC','now - 7 days')
: datetime_convert('UTC','UTC',$contact['abook_updated']) : datetime_convert('UTC','UTC',$contact['abook_updated'])
); );
@ -77,20 +79,27 @@ function onepoll_run($argv, $argc){
$x = zot_refresh($contact,$importer); $x = zot_refresh($contact,$importer);
$responded = false;
if(! $x) { if(! $x) {
// mark for death // mark for death
} }
else { else {
q("update abook set abook_updated = '%s' where abook_id = %d limit 1", q("update abook set abook_updated = '%s', abook_connected = '%s' where abook_id = %d limit 1",
dbesc(datetime_convert()),
dbesc(datetime_convert()), dbesc(datetime_convert()),
intval($contact['abook_id']) intval($contact['abook_id'])
); );
$responded = true;
// if marked for death, reset // if marked for death, reset
} }
if(! $responded)
return;
if($contact['xchan_connurl']) { if($contact['xchan_connurl']) {
$feedurl = str_replace('/poco/','/zotfeed/',$channel['xchan_connurl']); $feedurl = str_replace('/poco/','/zotfeed/',$channel['xchan_connurl']);

View File

@ -31,8 +31,10 @@ function poco_load($xchan = null,$url = null) {
} }
} }
if(! $url) if(! $url) {
logger('poco_load: no url');
return; return;
}
$url = $url . '?fields=displayName,hash,urls,photos' ; $url = $url . '?fields=displayName,hash,urls,photos' ;
@ -41,17 +43,20 @@ function poco_load($xchan = null,$url = null) {
$s = z_fetch_url($url); $s = z_fetch_url($url);
logger('poco_load: returns ' . print_r($s,true), LOGGER_DATA);
if(! $s['success']) if(! $s['success']) {
logger('poco_load: returns ' . print_r($s,true));
return; return;
}
$j = json_decode($s['body'],true); $j = json_decode($s['body'],true);
logger('poco_load: ' . print_r($j,true),LOGGER_DATA); logger('poco_load: ' . print_r($j,true),LOGGER_DATA);
if(! x($j,'entry') && is_array($j['entry'])) if(! ((x($j,'entry')) && (is_array($j['entry'])))) {
logger('poco_load: no entries');
return; return;
}
$total = 0; $total = 0;
foreach($j['entry'] as $entry) { foreach($j['entry'] as $entry) {
@ -87,8 +92,10 @@ function poco_load($xchan = null,$url = null) {
} }
} }
if((! $name) || (! $profile_url) || (! $profile_photo) || (! $hash) || (! $address)) if((! $name) || (! $profile_url) || (! $profile_photo) || (! $hash) || (! $address)) {
logger('poco_load: missing data');
continue; continue;
}
$x = q("select xchan_hash from xchan where xchan_hash = '%s' limit 1", $x = q("select xchan_hash from xchan where xchan_hash = '%s' limit 1",
dbesc($hash) dbesc($hash)

View File

@ -1 +1 @@
2013-01-24.210 2013-01-25.211