X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fonepoll.php;h=eb1045de142957dcab4e08d8b66ff8aa3ecb4750;hb=18cbe9f6ff275cbb363fd9a0a5014bc8fe3d9f7b;hp=0e58a776ca2d1c47a801561cfc18c9d71dea5135;hpb=2e8caf7f27197be5f12ea22f4a5e9aae2bb1ee89;p=friendica.git diff --git a/include/onepoll.php b/include/onepoll.php index 0e58a776ca..eb1045de14 100644 --- a/include/onepoll.php +++ b/include/onepoll.php @@ -18,21 +18,19 @@ function onepoll_run(&$argv, &$argc){ } if(is_null($db)) { - @include(".htconfig.php"); - require_once("include/dba.php"); - $db = new dba($db_host, $db_user, $db_pass, $db_data); - unset($db_host, $db_user, $db_pass, $db_data); + @include(".htconfig.php"); + require_once("include/dba.php"); + $db = new dba($db_host, $db_user, $db_pass, $db_data); + unset($db_host, $db_user, $db_pass, $db_data); }; require_once('include/session.php'); require_once('include/datetime.php'); - require_once('library/simplepie/simplepie.inc'); require_once('include/items.php'); require_once('include/Contact.php'); require_once('include/email.php'); require_once('include/socgraph.php'); - require_once('include/pidfile.php'); require_once('include/queue_fn.php'); load_config('config'); @@ -61,18 +59,10 @@ function onepoll_run(&$argv, &$argc){ return; } - $lockpath = get_lockpath(); - if ($lockpath != '') { - $pidfile = new pidfile($lockpath, 'onepoll'.$contact_id); - 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; - } - } + // Don't check this stuff if the function is called by the poller + if (App::callstack() != "poller_run") + if (App::is_already_running('onepoll'.$contact_id, '', 540)) + return; $d = datetime_convert(); @@ -109,9 +99,8 @@ function onepoll_run(&$argv, &$argc){ poco_load($contact['id'],$importer_uid,0,$contact['poco']); } - // To-Do: - // - Check why we don't poll the Diaspora feed at the moment (some guid problem in the items?) - // - Check whether this is possible with Redmatrix + /// @TODO Check why we don't poll the Diaspora feed at the moment (some guid problem in the items?) + /// @TODO Check whether this is possible with Redmatrix if ($contact["network"] == NETWORK_DIASPORA) { if (poco_do_update($contact["created"], $contact["last-item"], $contact["failure_update"], $contact["success_update"])) { $last_updated = poco_last_updated($contact["url"]); @@ -336,7 +325,9 @@ function onepoll_run(&$argv, &$argc){ if($contact['rel'] == CONTACT_IS_FOLLOWER || $contact['blocked'] || $contact['readonly']) return; - $xml = fetch_url($contact['poll']); + $cookiejar = tempnam(get_temppath(), 'cookiejar-onepoll-'); + $xml = fetch_url($contact['poll'], false, $redirects, 0, Null, $cookiejar); + unlink($cookiejar); } elseif($contact['network'] === NETWORK_MAIL || $contact['network'] === NETWORK_MAIL2) { @@ -507,7 +498,7 @@ function onepoll_run(&$argv, &$argc){ logger("Mail: Importing ".$msg_uid." for ".$mailconf[0]['user']); // some mailing lists have the original author as 'from' - add this sender info to msg body. - // todo: adding a gravatar for the original author would be cool + /// @TODO Adding a gravatar for the original author would be cool if(! stristr($meta->from,$contact['addr'])) { $from = imap_mime_header_decode($meta->from); @@ -679,6 +670,6 @@ function onepoll_run(&$argv, &$argc){ } if (array_search(__file__,get_included_files())===0){ - onepoll_run($_SERVER["argv"],$_SERVER["argc"]); - killme(); + onepoll_run($_SERVER["argv"],$_SERVER["argc"]); + killme(); }