Cleaning the code from several tests.

This commit is contained in:
Michael Vogel 2015-05-30 21:08:24 +02:00
parent 4750775752
commit a3118e0a6e
3 changed files with 16 additions and 17 deletions

View File

@ -115,7 +115,7 @@ function get_feed_for(&$a, $dfrn_id, $owner_nick, $last_update, $direction = 0,
else else
$sort = 'ASC'; $sort = 'ASC';
// Include answers to status.net posts in public feeds // Include answers to status.net posts in pubsub feeds
if($forpubsub) { if($forpubsub) {
$sql_post_table = "INNER JOIN `thread` ON `thread`.`iid` = `item`.`parent` "; $sql_post_table = "INNER JOIN `thread` ON `thread`.`iid` = `item`.`parent` ";
$visibility = "OR (`item`.`network` = 'dfrn' AND `thread`.`network`='stat')"; $visibility = "OR (`item`.`network` = 'dfrn' AND `thread`.`network`='stat')";

View File

@ -46,9 +46,8 @@ function handle_pubsubhubbub() {
if ($new_push > 30) // OK, let's give up if ($new_push > 30) // OK, let's give up
$new_push = 0; $new_push = 0;
q("UPDATE `push_subscriber` SET `push` = %d, last_update = '%s' WHERE id = %d", q("UPDATE `push_subscriber` SET `push` = %d WHERE id = %d",
$new_push, $new_push,
dbesc($date_now),
intval($rr['id'])); intval($rr['id']));
} }
} }

View File

@ -62,13 +62,13 @@ function get_salmon_key($uri,$keyhash) {
return ''; return '';
} }
function slapper($owner,$url,$slap) { function slapper($owner,$url,$slap) {
logger('slapper called for '.$owner['url'].' to '.$url.' . Data: ' . $slap); logger('slapper called. Data: ' . $slap);
// does contact have a salmon endpoint? // does contact have a salmon endpoint?
if(! strlen($url)) if(! strlen($url))
return; return;
@ -87,16 +87,16 @@ $namespaces = <<< EOT
xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:thr="http://purl.org/syndication/thread/1.0"
xmlns:at="http://purl.org/atompub/tombstones/1.0" xmlns:at="http://purl.org/atompub/tombstones/1.0"
xmlns:media="http://purl.org/syndication/atommedia" xmlns:media="http://purl.org/syndication/atommedia"
xmlns:dfrn="http://purl.org/macgirvin/dfrn/1.0" xmlns:dfrn="http://purl.org/macgirvin/dfrn/1.0"
xmlns:as="http://activitystrea.ms/spec/1.0/" xmlns:as="http://activitystrea.ms/spec/1.0/"
xmlns:georss="http://www.georss.org/georss" xmlns:georss="http://www.georss.org/georss"
xmlns:poco="http://portablecontacts.net/spec/1.0" xmlns:poco="http://portablecontacts.net/spec/1.0"
xmlns:ostatus="http://ostatus.org/schema/1.0" xmlns:ostatus="http://ostatus.org/schema/1.0"
xmlns:statusnet="http://status.net/schema/api/1/" > > xmlns:statusnet="http://status.net/schema/api/1/" > >
EOT; EOT;
$slap = str_replace('<entry>',$namespaces,$slap); $slap = str_replace('<entry>',$namespaces,$slap);
// create a magic envelope // create a magic envelope
$data = base64url_encode($slap); $data = base64url_encode($slap);
@ -125,7 +125,7 @@ EOT;
'$signature' => $signature '$signature' => $signature
)); ));
// slap them // slap them
post_url($url,$salmon, array( post_url($url,$salmon, array(
'Content-type: application/magic-envelope+xml', 'Content-type: application/magic-envelope+xml',
'Content-length: ' . strlen($salmon) 'Content-length: ' . strlen($salmon)
@ -152,7 +152,7 @@ EOT;
'$signature' => $signature2 '$signature' => $signature2
)); ));
// slap them // slap them
post_url($url,$salmon, array( post_url($url,$salmon, array(
'Content-type: application/magic-envelope+xml', 'Content-type: application/magic-envelope+xml',
'Content-length: ' . strlen($salmon) 'Content-length: ' . strlen($salmon)
@ -166,7 +166,7 @@ EOT;
// Entirely likely that their salmon implementation is // Entirely likely that their salmon implementation is
// non-compliant. Let's try once more, this time only signing // non-compliant. Let's try once more, this time only signing
// the data, without the precomputed blob // the data, without the precomputed blob
$salmon = replace_macros($salmon_tpl,array( $salmon = replace_macros($salmon_tpl,array(
'$data' => $data, '$data' => $data,
@ -176,7 +176,7 @@ EOT;
'$signature' => $signature3 '$signature' => $signature3
)); ));
// slap them // slap them
post_url($url,$salmon, array( post_url($url,$salmon, array(
'Content-type: application/magic-envelope+xml', 'Content-type: application/magic-envelope+xml',
'Content-length: ' . strlen($salmon) 'Content-length: ' . strlen($salmon)
@ -184,7 +184,7 @@ EOT;
$return_code = $a->get_curl_code(); $return_code = $a->get_curl_code();
} }
} }
logger('slapper returned ' . $return_code); logger('slapper returned ' . $return_code);
if(! $return_code) if(! $return_code)
return(-1); return(-1);
if(($return_code == 503) && (stristr($a->get_curl_headers(),'retry-after'))) if(($return_code == 503) && (stristr($a->get_curl_headers(),'retry-after')))