2021-12-03 03:01:39 +00:00
< ? php
/** @file */
2018-07-03 05:43:41 +00:00
2022-02-16 04:08:28 +00:00
namespace Code\Lib ;
use Code\Lib\Libzot ;
use Code\Web\HTTPSig ;
use Code\Lib\Activity ;
use Code\Lib\ActivityStreams ;
use Code\Lib\Channel ;
2022-02-16 04:50:35 +00:00
use Code\Nomad\Receiver ;
use Code\Nomad\NomadHandler ;
2022-02-16 04:08:28 +00:00
use Code\Extend\Hook ;
2018-07-03 05:43:41 +00:00
2021-12-02 23:02:31 +00:00
class Queue
{
2018-07-03 05:43:41 +00:00
2021-12-02 23:02:31 +00:00
public static function update ( $id , $add_priority = 0 )
{
2018-07-03 05:43:41 +00:00
2021-12-02 23:02:31 +00:00
logger ( 'queue: requeue item ' . $id , LOGGER_DEBUG );
2018-07-03 05:43:41 +00:00
2021-12-02 23:02:31 +00:00
// This queue item failed. Perhaps it was rejected. Perhaps the site is dead.
// Since we don't really know, check and see if we've got something else destined
// for that server and give it priority. At a minimum it will keep the queue from
// getting stuck on a particular message when another one with different content
// might actually succeed.
2018-07-03 05:43:41 +00:00
2021-12-03 03:01:39 +00:00
$x = q (
" select outq_created, outq_hash, outq_posturl from outq where outq_hash = '%s' limit 1 " ,
2021-12-02 23:02:31 +00:00
dbesc ( $id )
);
if ( ! $x ) {
return ;
}
2018-07-03 05:43:41 +00:00
2021-12-03 03:01:39 +00:00
$g = q (
" select outq_created, outq_hash, outq_posturl from outq where outq_posturl = '%s' and outq_hash != '%s' limit 1 " ,
2021-12-02 23:02:31 +00:00
dbesc ( $x [ 0 ][ 'outq_posturl' ]),
dbesc ( $id )
);
2018-07-03 05:43:41 +00:00
2021-12-02 23:02:31 +00:00
// swap them
2018-07-03 05:43:41 +00:00
2021-12-02 23:02:31 +00:00
if ( $g ) {
$x = $g ;
}
2018-07-03 05:43:41 +00:00
2021-12-03 03:01:39 +00:00
$y = q (
" select min(outq_created) as earliest from outq where outq_posturl = '%s' " ,
2021-12-02 23:02:31 +00:00
dbesc ( $x [ 0 ][ 'outq_posturl' ])
);
2018-07-03 05:43:41 +00:00
2021-12-02 23:02:31 +00:00
// look for the oldest queue entry with this destination URL. If it's older than a couple of days,
// the destination is considered to be down and only scheduled once an hour, regardless of the
// age of the current queue item.
2018-07-03 05:43:41 +00:00
2021-12-02 23:02:31 +00:00
$might_be_down = false ;
2018-07-03 05:43:41 +00:00
2021-12-03 03:01:39 +00:00
if ( $y ) {
2021-12-02 23:02:31 +00:00
$might_be_down = (( datetime_convert ( 'UTC' , 'UTC' , $y [ 0 ][ 'earliest' ]) < datetime_convert ( 'UTC' , 'UTC' , 'now - 2 days' )) ? true : false );
2021-12-03 03:01:39 +00:00
}
2018-07-03 05:43:41 +00:00
2021-12-02 23:02:31 +00:00
// Set all other records for this destination way into the future.
// The queue delivers by destination. We'll keep one queue item for
// this destination (this one) with a shorter delivery. If we succeed
// once, we'll try to deliver everything for that destination.
// The delivery will be set to at most once per hour, and if the
// queue item is less than 12 hours old, we'll schedule for fifteen
// minutes.
2021-04-13 01:19:27 +00:00
2021-12-03 03:01:39 +00:00
$r = q (
" UPDATE outq SET outq_scheduled = '%s' WHERE outq_posturl = '%s' " ,
2021-12-02 23:02:31 +00:00
dbesc ( datetime_convert ( 'UTC' , 'UTC' , 'now + 5 days' )),
dbesc ( $x [ 0 ][ 'outq_posturl' ])
);
2018-07-03 05:43:41 +00:00
2021-12-02 23:02:31 +00:00
$since = datetime_convert ( 'UTC' , 'UTC' , $y [ 0 ][ 'earliest' ]);
2018-07-03 05:43:41 +00:00
2021-12-02 23:02:31 +00:00
if (( $might_be_down ) || ( $since < datetime_convert ( 'UTC' , 'UTC' , 'now - 12 hour' ))) {
$next = datetime_convert ( 'UTC' , 'UTC' , 'now + 1 hour' );
} else {
$next = datetime_convert ( 'UTC' , 'UTC' , 'now + ' . intval ( $add_priority ) . ' minutes' );
}
2021-04-13 01:19:27 +00:00
2021-12-03 03:01:39 +00:00
q (
" UPDATE outq SET outq_updated = '%s',
2018-07-03 05:43:41 +00:00
outq_priority = outq_priority + % d ,
outq_scheduled = '%s'
WHERE outq_hash = '%s' " ,
2021-12-02 23:02:31 +00:00
dbesc ( datetime_convert ()),
intval ( $add_priority ),
dbesc ( $next ),
dbesc ( $x [ 0 ][ 'outq_hash' ])
);
}
2018-07-03 05:43:41 +00:00
2021-12-02 23:02:31 +00:00
public static function remove ( $id , $channel_id = 0 )
{
logger ( 'queue: remove queue item ' . $id , LOGGER_DEBUG );
$sql_extra = (( $channel_id ) ? " and outq_channel = " . intval ( $channel_id ) . " " : '' );
2021-04-06 02:21:28 +00:00
2021-12-03 03:01:39 +00:00
q (
" DELETE FROM outq WHERE outq_hash = '%s' $sql_extra " ,
2021-12-02 23:02:31 +00:00
dbesc ( $id )
);
}
2021-04-13 01:19:27 +00:00
2021-12-02 23:02:31 +00:00
public static function remove_by_posturl ( $posturl )
{
logger ( 'queue: remove queue posturl ' . $posturl , LOGGER_DEBUG );
2018-08-23 06:04:37 +00:00
2021-12-03 03:01:39 +00:00
q (
" DELETE FROM outq WHERE outq_posturl = '%s' " ,
2021-12-02 23:02:31 +00:00
dbesc ( $posturl )
);
}
2018-08-23 06:04:37 +00:00
2020-12-23 23:05:54 +00:00
2021-12-02 23:02:31 +00:00
public static function set_delivered ( $id , $channel = 0 )
{
logger ( 'queue: set delivered ' . $id , LOGGER_DEBUG );
$sql_extra = (( $channel_id ) ? " and outq_channel = " . intval ( $channel_id ) . " " : '' );
2018-08-23 06:04:37 +00:00
2021-12-02 23:02:31 +00:00
// Set the next scheduled run date so far in the future that it will be expired
// long before it ever makes it back into the delivery chain.
2018-09-26 03:41:06 +00:00
2021-12-03 03:01:39 +00:00
q (
" update outq set outq_delivered = 1, outq_updated = '%s', outq_scheduled = '%s' where outq_hash = '%s' $sql_extra " ,
2021-12-02 23:02:31 +00:00
dbesc ( datetime_convert ()),
dbesc ( datetime_convert ( 'UTC' , 'UTC' , 'now + 5 days' )),
dbesc ( $id )
);
}
2018-07-03 05:43:41 +00:00
2021-12-02 23:02:31 +00:00
public static function insert ( $arr )
{
2018-07-03 05:43:41 +00:00
2021-12-02 23:02:31 +00:00
logger ( 'insert: ' . print_r ( $arr , true ), LOGGER_DATA );
2018-07-03 05:43:41 +00:00
2021-12-02 23:02:31 +00:00
// do not queue anything with no destination
2018-07-03 05:43:41 +00:00
2021-12-02 23:02:31 +00:00
if ( ! ( array_key_exists ( 'posturl' , $arr ) && trim ( $arr [ 'posturl' ]))) {
logger ( 'no destination' );
return false ;
}
2018-07-03 05:43:41 +00:00
2021-04-13 01:19:27 +00:00
2021-12-03 03:01:39 +00:00
$x = q (
" insert into outq ( outq_hash, outq_account, outq_channel, outq_driver, outq_posturl, outq_async, outq_priority,
2018-07-03 05:43:41 +00:00
outq_created , outq_updated , outq_scheduled , outq_notify , outq_msg )
values ( '%s' , % d , % d , '%s' , '%s' , % d , % d , '%s' , '%s' , '%s' , '%s' , '%s' ) " ,
2021-12-02 23:02:31 +00:00
dbesc ( $arr [ 'hash' ]),
intval ( $arr [ 'account_id' ]),
intval ( $arr [ 'channel_id' ]),
2021-12-06 21:19:19 +00:00
dbesc (( isset ( $arr [ 'driver' ]) && $arr [ 'driver' ]) ? $arr [ 'driver' ] : 'nomad' ),
2021-12-02 23:02:31 +00:00
dbesc ( $arr [ 'posturl' ]),
intval ( 1 ),
intval (( isset ( $arr [ 'priority' ])) ? $arr [ 'priority' ] : 0 ),
dbesc ( datetime_convert ()),
dbesc ( datetime_convert ()),
dbesc (( isset ( $arr [ 'scheduled' ])) ? $arr [ 'scheduled' ] : datetime_convert ()),
dbesc ( $arr [ 'notify' ]),
dbesc (( $arr [ 'msg' ]) ? $arr [ 'msg' ] : '' )
);
return $x ;
}
public static function deliver ( $outq , $immediate = false )
{
$base = null ;
$h = parse_url ( $outq [ 'outq_posturl' ]);
if ( $h !== false ) {
$base = $h [ 'scheme' ] . '://' . $h [ 'host' ] . (( isset ( $h [ 'port' ]) && intval ( $h [ 'port' ])) ? ':' . $h [ 'port' ] : '' );
}
if (( $base ) && ( $base !== z_root ()) && ( $immediate )) {
2021-12-03 03:01:39 +00:00
$y = q (
" select site_update, site_dead from site where site_url = '%s' " ,
2021-12-02 23:02:31 +00:00
dbesc ( $base )
);
if ( $y ) {
if ( intval ( $y [ 0 ][ 'site_dead' ])) {
2021-12-03 03:01:39 +00:00
q (
" update dreport set dreport_result = '%s' where dreport_queue = '%s' " ,
2021-12-02 23:02:31 +00:00
dbesc ( 'site dead' ),
dbesc ( $outq [ 'outq_hash' ])
);
self :: remove_by_posturl ( $outq [ 'outq_posturl' ]);
logger ( 'dead site ignored ' . $base );
return ;
}
if ( $y [ 0 ][ 'site_update' ] < datetime_convert ( 'UTC' , 'UTC' , 'now - 1 month' )) {
2021-12-03 03:01:39 +00:00
q (
" update dreport set dreport_log = '%s' where dreport_queue = '%s' " ,
2021-12-02 23:02:31 +00:00
dbesc ( 'site deferred' ),
dbesc ( $outq [ 'outq_hash' ])
);
self :: update ( $outq [ 'outq_hash' ], 10 );
logger ( 'immediate delivery deferred for site ' . $base );
return ;
}
} else {
// zot sites should all have a site record, unless they've been dead for as long as
// your site has existed. Since we don't know for sure what these sites are,
// call them unknown
site_store_lowlevel (
[
'site_url' => $base ,
'site_update' => datetime_convert (),
'site_dead' => 0 ,
'site_type' => (( in_array ( $outq [ 'outq_driver' ], [ 'post' , 'activitypub' ])) ? SITE_TYPE_NOTZOT : SITE_TYPE_UNKNOWN ),
'site_crypto' => ''
]
);
}
}
$arr = array ( 'outq' => $outq , 'base' => $base , 'handled' => false , 'immediate' => $immediate );
2022-02-12 08:50:48 +00:00
Hook :: call ( 'queue_deliver' , $arr );
2021-12-03 03:01:39 +00:00
if ( $arr [ 'handled' ]) {
2021-12-02 23:02:31 +00:00
return ;
2021-12-03 03:01:39 +00:00
}
2021-12-02 23:02:31 +00:00
// "post" queue driver - used for diaspora and friendica-over-diaspora communications.
if ( $outq [ 'outq_driver' ] === 'post' ) {
$result = z_post_url ( $outq [ 'outq_posturl' ], $outq [ 'outq_msg' ]);
if ( $result [ 'success' ] && $result [ 'return_code' ] < 300 ) {
logger ( 'deliver: queue post success to ' . $outq [ 'outq_posturl' ], LOGGER_DEBUG );
if ( $base ) {
2021-12-03 03:01:39 +00:00
q (
" update site set site_update = '%s', site_dead = 0 where site_url = '%s' " ,
2021-12-02 23:02:31 +00:00
dbesc ( datetime_convert ()),
dbesc ( $base )
);
}
2021-12-03 03:01:39 +00:00
q (
" update dreport set dreport_result = '%s', dreport_time = '%s' where dreport_queue = '%s' " ,
2021-12-02 23:02:31 +00:00
dbesc ( 'accepted for delivery' ),
dbesc ( datetime_convert ()),
dbesc ( $outq [ 'outq_hash' ])
);
self :: remove ( $outq [ 'outq_hash' ]);
// server is responding - see if anything else is going to this destination and is piled up
// and try to send some more. We're relying on the fact that do_delivery() results in an
// immediate delivery otherwise we could get into a queue loop.
if ( ! $immediate ) {
2021-12-03 03:01:39 +00:00
$x = q (
" select outq_hash from outq where outq_posturl = '%s' and outq_delivered = 0 " ,
2021-12-02 23:02:31 +00:00
dbesc ( $outq [ 'outq_posturl' ])
);
$piled_up = [];
if ( $x ) {
foreach ( $x as $xx ) {
$piled_up [] = $xx [ 'outq_hash' ];
}
}
if ( $piled_up ) {
// call do_delivery() with the force flag
do_delivery ( $piled_up , true );
}
}
} else {
logger ( 'deliver: queue post returned ' . $result [ 'return_code' ]
. ' from ' . $outq [ 'outq_posturl' ], LOGGER_DEBUG );
self :: update ( $outq [ 'outq_hash' ], 10 );
}
return ;
}
if ( $outq [ 'outq_driver' ] === 'asfetch' ) {
2022-01-25 01:26:12 +00:00
$channel = Channel :: from_id ( $outq [ 'outq_channel' ]);
2021-12-02 23:02:31 +00:00
if ( ! $channel ) {
logger ( 'missing channel: ' . $outq [ 'outq_channel' ]);
return ;
}
if ( ! ActivityStreams :: is_url ( $outq [ 'outq_posturl' ])) {
logger ( 'fetch item is not url: ' . $outq [ 'outq_posturl' ]);
self :: remove ( $outq [ 'outq_hash' ]);
return ;
}
$j = Activity :: fetch ( $outq [ 'outq_posturl' ], $channel );
if ( $j ) {
$AS = new ActivityStreams ( $j , null , true );
if ( $AS -> is_valid () && isset ( $AS -> data [ 'type' ])) {
if ( ActivityStreams :: is_an_actor ( $AS -> data [ 'type' ])) {
Activity :: actor_store ( $AS -> data [ 'id' ], $AS -> data );
}
if ( strpos ( $AS -> data [ 'type' ], 'Collection' ) !== false ) {
// we are probably fetching a collection already - and do not support collection recursion at this time
self :: remove ( $outq [ 'outq_hash' ]);
return ;
}
$item = Activity :: decode_note ( $AS , true );
if ( $item ) {
Activity :: store ( $channel , $channel [ 'channnel_hash' ], $AS , $item , true , true );
}
}
logger ( 'deliver: queue fetch success from ' . $outq [ 'outq_posturl' ], LOGGER_DEBUG );
self :: remove ( $outq [ 'outq_hash' ]);
// server is responding - see if anything else is going to this destination and is piled up
// and try to send some more. We're relying on the fact that do_delivery() results in an
// immediate delivery otherwise we could get into a queue loop.
if ( ! $immediate ) {
2021-12-03 03:01:39 +00:00
$x = q (
" select outq_hash from outq where outq_driver = 'asfetch' and outq_channel = %d and outq_delivered = 0 " ,
2021-12-02 23:02:31 +00:00
dbesc ( $outq [ 'outq_channel' ])
);
$piled_up = [];
if ( $x ) {
foreach ( $x as $xx ) {
$piled_up [] = $xx [ 'outq_hash' ];
}
}
if ( $piled_up ) {
do_delivery ( $piled_up , true );
}
}
} else {
logger ( 'deliver: queue fetch failed' . ' from ' . $outq [ 'outq_posturl' ], LOGGER_DEBUG );
self :: update ( $outq [ 'outq_hash' ], 10 );
}
return ;
}
if ( $outq [ 'outq_driver' ] === 'activitypub' ) {
2022-01-25 01:26:12 +00:00
$channel = Channel :: from_id ( $outq [ 'outq_channel' ]);
2021-12-02 23:02:31 +00:00
if ( ! $channel ) {
logger ( 'missing channel: ' . $outq [ 'outq_channel' ]);
return ;
}
$retries = 0 ;
$m = parse_url ( $outq [ 'outq_posturl' ]);
$headers = [];
$headers [ 'Content-Type' ] = 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"' ;
$ret = $outq [ 'outq_msg' ];
logger ( 'ActivityPub send: ' . jindent ( $ret ), LOGGER_DATA );
$headers [ 'Date' ] = datetime_convert ( 'UTC' , 'UTC' , 'now' , 'D, d M Y H:i:s \\G\\M\\T' );
$headers [ 'Digest' ] = HTTPSig :: generate_digest_header ( $ret );
$headers [ 'Host' ] = $m [ 'host' ];
$headers [ '(request-target)' ] = 'post ' . get_request_string ( $outq [ 'outq_posturl' ]);
2022-01-25 01:26:12 +00:00
$xhead = HTTPSig :: create_sig ( $headers , $channel [ 'channel_prvkey' ], Channel :: url ( $channel ));
2021-12-02 23:02:31 +00:00
if ( strpos ( $outq [ 'outq_posturl' ], 'http' ) !== 0 ) {
logger ( 'bad url: ' . $outq [ 'outq_posturl' ]);
self :: remove ( $outq [ 'outq_hash' ]);
}
$result = z_post_url ( $outq [ 'outq_posturl' ], $outq [ 'outq_msg' ], $retries , [ 'headers' => $xhead ]);
if ( $result [ 'success' ] && $result [ 'return_code' ] < 300 ) {
logger ( 'deliver: queue post success to ' . $outq [ 'outq_posturl' ], LOGGER_DEBUG );
if ( $base ) {
2021-12-03 03:01:39 +00:00
q (
" update site set site_update = '%s', site_dead = 0 where site_url = '%s' " ,
2021-12-02 23:02:31 +00:00
dbesc ( datetime_convert ()),
dbesc ( $base )
);
}
2021-12-03 03:01:39 +00:00
q (
" update dreport set dreport_result = '%s', dreport_time = '%s' where dreport_queue = '%s' " ,
2021-12-02 23:02:31 +00:00
dbesc ( 'accepted for delivery' ),
dbesc ( datetime_convert ()),
dbesc ( $outq [ 'outq_hash' ])
);
self :: remove ( $outq [ 'outq_hash' ]);
// server is responding - see if anything else is going to this destination and is piled up
// and try to send some more. We're relying on the fact that do_delivery() results in an
// immediate delivery otherwise we could get into a queue loop.
if ( ! $immediate ) {
2021-12-03 03:01:39 +00:00
$x = q (
" select outq_hash from outq where outq_posturl = '%s' and outq_delivered = 0 " ,
2021-12-02 23:02:31 +00:00
dbesc ( $outq [ 'outq_posturl' ])
);
$piled_up = [];
if ( $x ) {
foreach ( $x as $xx ) {
$piled_up [] = $xx [ 'outq_hash' ];
}
}
if ( $piled_up ) {
do_delivery ( $piled_up , true );
}
}
2022-01-21 20:54:25 +00:00
}
elseif ( $result [ 'return_code' ] >= 400 && $result [ 'return_code' ] < 500 ) {
q (
" update dreport set dreport_result = '%s', dreport_time = '%s' where dreport_queue = '%s' " ,
dbesc ( 'delivery rejected' . ' ' . $result [ 'return_code' ]),
dbesc ( datetime_convert ()),
dbesc ( $outq [ 'outq_hash' ])
);
self :: remove ( $outq [ 'outq_hash' ]);
}
else {
$dr = q (
" select * from dreport where dreport_queue = '%s' " ,
dbesc ( $outq [ 'outq_hash' ])
);
if ( $dr ) {
// update every queue entry going to this site with the most recent communication error
2021-12-03 03:01:39 +00:00
q (
2022-01-21 20:54:25 +00:00
" update dreport set dreport_log = '%s' where dreport_site = '%s' " ,
dbesc ( z_curl_error ( $result )),
dbesc ( $dr [ 0 ][ 'dreport_site' ])
2021-12-02 23:02:31 +00:00
);
}
self :: update ( $outq [ 'outq_hash' ], 10 );
}
2022-01-21 20:54:25 +00:00
logger ( 'deliver: queue post returned ' . $result [ 'return_code' ] . ' from ' . $outq [ 'outq_posturl' ], LOGGER_DEBUG );
2021-12-02 23:02:31 +00:00
return ;
}
// normal zot delivery
logger ( 'deliver: dest: ' . $outq [ 'outq_posturl' ], LOGGER_DEBUG );
if ( $outq [ 'outq_posturl' ] === z_root () . '/zot' ) {
// local delivery
2022-02-16 04:50:35 +00:00
$zot = new Receiver ( new NomadHandler (), $outq [ 'outq_notify' ]);
2021-12-02 23:02:31 +00:00
$result = $zot -> run ();
logger ( 'returned_json: ' . json_encode ( $result , JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ), LOGGER_DATA );
logger ( 'deliver: local zot delivery succeeded to ' . $outq [ 'outq_posturl' ]);
Libzot :: process_response ( $outq [ 'outq_posturl' ], [ 'success' => true , 'body' => json_encode ( $result )], $outq );
if ( ! $immediate ) {
2021-12-03 03:01:39 +00:00
$x = q (
" select outq_hash from outq where outq_posturl = '%s' and outq_delivered = 0 " ,
2021-12-02 23:02:31 +00:00
dbesc ( $outq [ 'outq_posturl' ])
);
$piled_up = [];
if ( $x ) {
foreach ( $x as $xx ) {
$piled_up [] = $xx [ 'outq_hash' ];
}
}
if ( $piled_up ) {
do_delivery ( $piled_up , true );
}
}
} else {
logger ( 'remote' );
$channel = null ;
if ( $outq [ 'outq_channel' ]) {
2022-01-25 01:26:12 +00:00
$channel = Channel :: from_id ( $outq [ 'outq_channel' ], true );
2021-12-02 23:02:31 +00:00
}
$host_crypto = null ;
if ( $channel && $base ) {
2021-12-03 03:01:39 +00:00
$h = q (
2022-04-06 23:12:46 +00:00
" select hubloc_sitekey, site_crypto from hubloc left join site on hubloc_url = site_url where site_url = '%s' and hubloc_network in ('zot6','nomad') and hubloc_deleted = 0 order by hubloc_id desc limit 1 " ,
2021-12-02 23:02:31 +00:00
dbesc ( $base )
);
if ( $h ) {
$host_crypto = $h [ 0 ];
}
}
$msg = $outq [ 'outq_notify' ];
2021-10-28 20:02:31 +00:00
if ( $outq [ 'outq_driver' ] === 'nomad' ) {
$result = Libzot :: nomad ( $outq [ 'outq_posturl' ], $msg , $channel , $host_crypto );
}
else {
$result = Libzot :: zot ( $outq [ 'outq_posturl' ], $msg , $channel , $host_crypto );
}
2018-07-03 05:43:41 +00:00
2021-12-02 23:02:31 +00:00
if ( $result [ 'success' ]) {
2021-12-06 21:19:19 +00:00
logger ( 'deliver: remote nomad/zot delivery succeeded to ' . $outq [ 'outq_posturl' ]);
2021-12-02 23:02:31 +00:00
Libzot :: process_response ( $outq [ 'outq_posturl' ], $result , $outq );
} else {
2021-12-03 03:01:39 +00:00
$dr = q (
" select * from dreport where dreport_queue = '%s' " ,
2021-12-02 23:02:31 +00:00
dbesc ( $outq [ 'outq_hash' ])
);
// update every queue entry going to this site with the most recent communication error
2021-12-03 03:01:39 +00:00
q (
" update dreport set dreport_log = '%s' where dreport_site = '%s' " ,
2021-12-02 23:02:31 +00:00
dbesc ( z_curl_error ( $result )),
dbesc ( $dr [ 0 ][ 'dreport_site' ])
);
2021-12-06 21:19:19 +00:00
logger ( 'deliver: remote nomad/zot delivery failed to ' . $outq [ 'outq_posturl' ]);
logger ( 'deliver: remote nomad/zot delivery fail data: ' . print_r ( $result , true ), LOGGER_DATA );
2021-12-02 23:02:31 +00:00
self :: update ( $outq [ 'outq_hash' ], 10 );
}
}
return ;
}
2018-07-03 05:43:41 +00:00
}