X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fonepoll.php;h=72c1d65c007694e0bb7132746691190ed59769ac;hb=57c47a8e3660b8b968b36ff7b379f51aa398a684;hp=f5c253803b64257dde136ad9a49a57074befb160;hpb=27895b3744d98854d167ba9e3c27f98867a7d754;p=friendica.git diff --git a/include/onepoll.php b/include/onepoll.php index f5c253803b..72c1d65c00 100644 --- a/include/onepoll.php +++ b/include/onepoll.php @@ -15,7 +15,7 @@ function onepoll_run(&$argv, &$argc){ if(is_null($a)) { $a = new App; } - + if(is_null($db)) { @include(".htconfig.php"); require_once("include/dba.php"); @@ -57,28 +57,30 @@ function onepoll_run(&$argv, &$argc){ return; } - // Test $lockpath = get_lockpath(); if ($lockpath != '') { $pidfile = new pidfile($lockpath, 'onepoll'.$contact_id); - if($pidfile->is_already_running()) { + if ($pidfile->is_already_running()) { logger("onepoll: Already running for contact ".$contact_id); + if ($pidfile->running_time() > 9*60) { + $pidfile->kill(); + logger("killed stale process"); + } exit; } } - $d = datetime_convert(); // Only poll from those with suitable relationships, - // and which have a polling address and ignore Diaspora since + // and which have a polling address and ignore Diaspora since // we are unable to match those posts with a Diaspora GUID and prevent duplicates. - $contacts = q("SELECT `contact`.* FROM `contact` + $contacts = q("SELECT `contact`.* FROM `contact` WHERE ( `rel` = %d OR `rel` = %d ) AND `poll` != '' AND NOT `network` IN ( '%s', '%s', '%s' ) AND `contact`.`id` = %d - AND `self` = 0 AND `contact`.`blocked` = 0 AND `contact`.`readonly` = 0 + AND `self` = 0 AND `contact`.`blocked` = 0 AND `contact`.`readonly` = 0 AND `contact`.`archive` = 0 LIMIT 1", intval(CONTACT_IS_SHARING), intval(CONTACT_IS_FRIEND), @@ -331,6 +333,7 @@ function onepoll_run(&$argv, &$argc){ $datarray = array(); $datarray['verb'] = ACTIVITY_POST; + $datarray['object-type'] = ACTIVITY_OBJ_NOTE; // $meta = email_msg_meta($mbox,$msg_uid); // $headers = email_msg_headers($mbox,$msg_uid); @@ -583,8 +586,8 @@ function onepoll_run(&$argv, &$argc){ // load current friends if possible. - if($contact['poco']) { - $r = q("SELECT count(*) as total from glink + if($contact['poco']) { + $r = q("SELECT count(*) as total from glink where `cid` = %d and updated > UTC_TIMESTAMP() - INTERVAL 1 DAY", intval($contact['id']) ); @@ -599,6 +602,6 @@ function onepoll_run(&$argv, &$argc){ } if (array_search(__file__,get_included_files())===0){ - onepoll_run($argv,$argc); + onepoll_run($_SERVER["argv"],$_SERVER["argc"]); killme(); }