X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fonepoll.php;h=09e7bb7638d85885f1f64ab87984f2ac0abb455f;hb=794ae669cefa8234da08718e81a5872832b79259;hp=722ebe846b56e4496bce873e9f9e0d69651100aa;hpb=9413900a9f9cb3c455ee4f0300224dec3a4a9f75;p=friendica.git diff --git a/include/onepoll.php b/include/onepoll.php index 722ebe846b..09e7bb7638 100644 --- a/include/onepoll.php +++ b/include/onepoll.php @@ -25,6 +25,7 @@ function onepoll_run($argv, $argc){ require_once('include/email.php'); require_once('include/socgraph.php'); require_once('include/pidfile.php'); + require_once('include/queue_fn.php'); load_config('config'); load_config('system'); @@ -35,11 +36,6 @@ function onepoll_run($argv, $argc){ logger('onepoll: start'); - $abandon_days = intval(get_config('system','account_abandon_days')); - if($abandon_days < 1) - $abandon_days = 0; - - $manual_id = 0; $generation = 0; $hub_update = false; @@ -53,6 +49,7 @@ function onepoll_run($argv, $argc){ logger('onepoll: no contact'); return; } + $d = datetime_convert(); @@ -60,11 +57,6 @@ function onepoll_run($argv, $argc){ // and which have a polling address and ignore Diaspora since // we are unable to match those posts with a Diaspora GUID and prevent duplicates. - $abandon_sql = (($abandon_days) - ? sprintf(" AND `user`.`login_date` > UTC_TIMESTAMP() - INTERVAL %d DAY ", intval($abandon_days)) - : '' - ); - $contacts = q("SELECT `contact`.* FROM `contact` WHERE ( `rel` = %d OR `rel` = %d ) AND `poll` != '' AND NOT `network` IN ( '%s', '%s' ) @@ -84,14 +76,13 @@ function onepoll_run($argv, $argc){ $contact = $contacts[0]; - $xml = false; $t = $contact['last-update']; if($contact['subhub']) { - $interval = get_config('system','pushpoll_frequency'); - $contact['priority'] = (($interval !== false) ? intval($interval) : 3); + $poll_interval = get_config('system','pushpoll_frequency'); + $contact['priority'] = (($poll_interval !== false) ? intval($poll_interval) : 3); $hub_update = false; if(datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 day")) @@ -135,15 +126,18 @@ function onepoll_run($argv, $argc){ . '&perm=' . $perm ; $handshake_xml = fetch_url($url); + $html_code = $a->get_curl_code(); logger('onepoll: handshake with url ' . $url . ' returns xml: ' . $handshake_xml, LOGGER_DATA); - if(! $handshake_xml) { + if((! strlen($handshake_xml)) || ($html_code >= 400) || (! $html_code)) { logger("poller: $url appears to be dead - marking for death "); + // dead connection - might be a transient event, or this might // mean the software was uninstalled or the domain expired. // Will keep trying for one month. + mark_for_death($contact); // set the last-update so we don't keep polling @@ -152,16 +146,19 @@ function onepoll_run($argv, $argc){ intval($contact['id']) ); - continue; + return; } if(! strstr($handshake_xml,'status) != 0) || (! strlen($res->challenge)) || (! strlen($res->dfrn_id))) - continue; + return; if(((float) $res->dfrn_version > 2.21) && ($contact['poco'] == '')) { q("update contact set poco = '%s' where id = %d limit 1", @@ -221,7 +218,7 @@ function onepoll_run($argv, $argc){ if($final_dfrn_id != $orig_id) { logger('poller: ID did not decode: ' . $contact['id'] . ' orig: ' . $orig_id . ' final: ' . $final_dfrn_id); // did not decode properly - cannot trust this site - continue; + return; } $postvars['dfrn_id'] = $idtosend; @@ -251,7 +248,7 @@ function onepoll_run($argv, $argc){ // Are we allowed to import from this person? if($contact['rel'] == CONTACT_IS_FOLLOWER || $contact['blocked'] || $contact['readonly']) - continue; + return; $xml = fetch_url($contact['poll']); } @@ -261,7 +258,7 @@ function onepoll_run($argv, $argc){ $mail_disabled = ((function_exists('imap_open') && (! get_config('system','imap_disabled'))) ? 0 : 1); if($mail_disabled) - continue; + return; logger("onepoll: Mail: Enabled", LOGGER_DEBUG); @@ -452,13 +449,13 @@ function onepoll_run($argv, $argc){ if($xml) { logger('poller: received xml : ' . $xml, LOGGER_DATA); - if(! strstr($xml,'