X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=include%2Fpoller.php;h=d9e5282f2dd7bdab9b34a23e49f6acb8841e521c;hb=72dd6457b014e504c79dbe494ac6095cadd9b942;hp=89a3408ec90efcf04deca6aa7f5e1dd00afecee2;hpb=60e0f79b9f9e94b19cc412eac41e5d8f8fec2383;p=friendica.git diff --git a/include/poller.php b/include/poller.php index 89a3408ec9..d9e5282f2d 100644 --- a/include/poller.php +++ b/include/poller.php @@ -24,6 +24,7 @@ function poller_run($argv, $argc){ require_once('include/items.php'); require_once('include/Contact.php'); require_once('include/email.php'); + require_once('include/socgraph.php'); load_config('config'); load_config('system'); @@ -50,19 +51,21 @@ function poller_run($argv, $argc){ - // once daily run expire in background + // once daily run birthday_updates and then expire in background $d1 = get_config('system','last_expire_day'); $d2 = intval(datetime_convert('UTC','UTC','now','d')); if($d2 != intval($d1)) { + + update_contact_birthdays(); + set_config('system','last_expire_day',$d2); proc_run('php','include/expire.php'); } // clear old cache - q("DELETE FROM `cache` WHERE `updated` < '%s'", - dbesc(datetime_convert('UTC','UTC',"now - 30 days"))); + Cache::clear(); $manual_id = 0; $generation = 0; @@ -105,13 +108,14 @@ function poller_run($argv, $argc){ $contacts = q("SELECT `contact`.`id` FROM `contact` LEFT JOIN `user` ON `user`.`uid` = `contact`.`uid` WHERE ( `rel` = %d OR `rel` = %d ) AND `poll` != '' - AND `network` != '%s' + AND NOT `network` IN ( '%s', '%s' ) $sql_extra AND `self` = 0 AND `contact`.`blocked` = 0 AND `contact`.`readonly` = 0 AND `user`.`account_expired` = 0 $abandon_sql ORDER BY RAND()", intval(CONTACT_IS_SHARING), intval(CONTACT_IS_FRIEND), - dbesc(NETWORK_DIASPORA) + dbesc(NETWORK_DIASPORA), + dbesc(NETWORK_FACEBOOK) ); if(! count($contacts)) { @@ -134,6 +138,9 @@ function poller_run($argv, $argc){ if($manual_id) $contact['last-update'] = '0000-00-00 00:00:00'; + if($contact['network'] === NETWORK_DFRN) + $contact['priority'] = 2; + if($contact['priority'] || $contact['subhub']) { $hub_update = true; @@ -215,7 +222,7 @@ function poller_run($argv, $argc){ $importer = $r[0]; - logger("poller: poll: IMPORTER: {$importer['name']}, CONTACT: {$contact['name']}"); + logger("poller: poll: ({$contact['id']}) IMPORTER: {$importer['name']}, CONTACT: {$contact['name']}"); $last_update = (($contact['last-update'] === '0000-00-00 00:00:00') ? datetime_convert('UTC','UTC','now - 30 days', ATOM_TIME) @@ -296,6 +303,13 @@ function poller_run($argv, $argc){ if((intval($res->status) != 0) || (! strlen($res->challenge)) || (! strlen($res->dfrn_id))) continue; + if(((float) $res->dfrn_version > 2.21) && ($contact['poco'] == '')) { + q("update contact set poco = '%s' where id = %d limit 1", + dbesc(str_replace('/profile/','/poco/', $contact['url'])), + intval($contact['id']) + ); + } + $postvars = array(); $sent_dfrn_id = hex2bin((string) $res->dfrn_id); @@ -486,11 +500,11 @@ function poller_run($argv, $argc){ } - consume_feed($xml,$importer,$contact,$hub,1, true); + consume_feed($xml,$importer,$contact,$hub,1,1); // do it twice. Ensures that children of parents which may be later in the stream aren't tossed - consume_feed($xml,$importer,$contact,$hub,1); + consume_feed($xml,$importer,$contact,$hub,1,2); $hubmode = 'subscribe'; if($contact['network'] === NETWORK_DFRN || $contact['blocked'] || $contact['readonly']) @@ -519,6 +533,21 @@ function poller_run($argv, $argc){ intval($contact['id']) ); + + // load current friends if possible. + + if($contact['poco']) { + $r = q("SELECT count(*) as total from glink + where `cid` = %d and updated > UTC_TIMESTAMP() - INTERVAL 1 DAY", + intval($contact['id']) + ); + } + if(count($r)) { + if(! $r[0]['total']) { + poco_load($contact['id'],$importer_uid,$contact['poco']); + } + } + // loop - next contact } }