X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fpubsubpublish.php;h=625eefc261b69af08b4011d44265ffd1ddb61a1f;hb=2d4fd30cc38c185ece29151e36a2b040332a70c8;hp=8ac468c313fe3f9c4c486b023dd3032b023f11b7;hpb=3b101c9d98a95057943edd1f5b5094d9bd852e3e;p=friendica.git diff --git a/include/pubsubpublish.php b/include/pubsubpublish.php index 8ac468c313..625eefc261 100644 --- a/include/pubsubpublish.php +++ b/include/pubsubpublish.php @@ -13,18 +13,19 @@ function handle_pubsubhubbub() { $r = q("SELECT * FROM `push_subscriber` WHERE `push` > 0"); foreach($r as $rr) { - //$params = get_feed_for($a, '', $rr['nickname'], $rr['last_update'], 0, true); - $params = ostatus_feed($a, $rr['nickname'], $rr['last_update']); + + logger("Generate feed for user ".$rr['nickname']." - last updated ".$rr['last_update'], LOGGER_DEBUG); + + $params = ostatus::feed($a, $rr['nickname'], $rr['last_update']); $hmac_sig = hash_hmac("sha1", $params, $rr['secret']); $headers = array("Content-type: application/atom+xml", - sprintf("Link: <%s>;rel=hub," . - "<%s>;rel=self", - $a->get_baseurl() . '/pubsubhubbub', - $rr['topic']), - "X-Hub-Signature: sha1=" . $hmac_sig); + sprintf("Link: <%s>;rel=hub,<%s>;rel=self", + $a->get_baseurl().'/pubsubhubbub', + $rr['topic']), + "X-Hub-Signature: sha1=".$hmac_sig); - logger('POST '. print_r($headers, true)."\n".$params, LOGGER_DEBUG); + logger('POST '.print_r($headers, true)."\n".$params, LOGGER_DEBUG); post_url($rr['callback_url'], $params, $headers); $ret = $a->get_curl_code(); @@ -73,25 +74,14 @@ function pubsubpublish_run(&$argv, &$argc){ }; require_once('include/items.php'); - require_once('include/pidfile.php'); load_config('config'); load_config('system'); - $lockpath = get_lockpath(); - if ($lockpath != '') { - $pidfile = new pidfile($lockpath, 'pubsubpublish'); - if($pidfile->is_already_running()) { - logger("Already running"); - if ($pidfile->running_time() > 9*60) { - $pidfile->kill(); - logger("killed stale process"); - // Calling a new instance - proc_run('php',"include/pubsubpublish.php"); - } + // Don't check this stuff if the function is called by the poller + if (App::callstack() != "poller_run") + if (App::is_already_running("pubsubpublish", "include/pubsubpublish.php", 540)) return; - } - } $a->set_baseurl(get_config('system','url'));