diff options
author | Max Kostikov <max@kostikov.co> | 2020-03-31 19:54:20 +0200 |
---|---|---|
committer | Max Kostikov <max@kostikov.co> | 2020-03-31 19:54:20 +0200 |
commit | 5a2c62466e773ce043a1b39bd2f1e7003a53d9f2 (patch) | |
tree | 363847c74a9068f3c8cf5110a5ac377c5d40fba1 /include/queue_fn.php | |
parent | c2b691fd0153f0b468f9014b4ca1f0f2b339c617 (diff) | |
parent | b739f91caa1522522a4ce093d7c63f0f4c777085 (diff) | |
download | volse-hubzilla-5a2c62466e773ce043a1b39bd2f1e7003a53d9f2.tar.gz volse-hubzilla-5a2c62466e773ce043a1b39bd2f1e7003a53d9f2.tar.bz2 volse-hubzilla-5a2c62466e773ce043a1b39bd2f1e7003a53d9f2.zip |
Merge branch 'dev' into 'dev'
Sync dev
See merge request kostikov/core!2
Diffstat (limited to 'include/queue_fn.php')
-rw-r--r-- | include/queue_fn.php | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/include/queue_fn.php b/include/queue_fn.php index 865228041..b72730d2f 100644 --- a/include/queue_fn.php +++ b/include/queue_fn.php @@ -228,49 +228,49 @@ function queue_deliver($outq, $immediate = false) { // normal zot delivery - logger('deliver: dest: ' . $outq['outq_posturl'], LOGGER_DEBUG); + logger('deliver: dest: ' . $outq['outq_posturl'] . ' driver: ' . $outq['outq_driver'], LOGGER_DEBUG); if($outq['outq_driver'] === 'zot6') { - if($outq['outq_posturl'] === z_root() . '/zot') { - // local delivery - $zot = new Receiver(new Zot6Handler(),$outq['outq_notify']); - $result = $zot->run(true); - logger('returned_json: ' . json_encode($result,JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES), LOGGER_DATA); - logger('deliver: local zot6 delivery succeeded to ' . $outq['outq_posturl']); - Libzot::process_response($outq['outq_posturl'],[ 'success' => true, 'body' => json_encode($result) ], $outq); - } - else { - logger('remote'); - $channel = null; - - if($outq['outq_channel']) { - $channel = channelx_by_n($outq['outq_channel']); - } - - $host_crypto = null; - if($channel && $base) { - $h = q("select hubloc_sitekey, site_crypto from hubloc left join site on hubloc_url = site_url where site_url = '%s' and hubloc_network = 'zot6' order by hubloc_id desc limit 1", - dbesc($base) - ); - if($h) { - $host_crypto = $h[0]; - } - } - - $msg = $outq['outq_notify']; - - $result = Libzot::zot($outq['outq_posturl'],$msg,$channel,$host_crypto); - - if($result['success']) { - logger('deliver: remote zot6 delivery succeeded to ' . $outq['outq_posturl']); - Libzot::process_response($outq['outq_posturl'],$result, $outq); - } - else { - logger('deliver: remote zot6 delivery failed to ' . $outq['outq_posturl']); - logger('deliver: remote zot6 delivery fail data: ' . print_r($result,true), LOGGER_DATA); - update_queue_item($outq['outq_hash'],10); - } + if($outq['outq_posturl'] === z_root() . '/zot') { + // local delivery + $zot = new Receiver(new Zot6Handler(),$outq['outq_notify']); + $result = $zot->run(true); + logger('returned_json: ' . json_encode($result,JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES), LOGGER_DATA); + logger('deliver: local zot6 delivery succeeded to ' . $outq['outq_posturl']); + Libzot::process_response($outq['outq_posturl'],[ 'success' => true, 'body' => json_encode($result) ], $outq); + } + else { + logger('remote'); + $channel = null; + + if($outq['outq_channel']) { + $channel = channelx_by_n($outq['outq_channel']); + } + + $host_crypto = null; + if($channel && $base) { + $h = q("select hubloc_sitekey, site_crypto from hubloc left join site on hubloc_url = site_url where site_url = '%s' and hubloc_network = 'zot6' order by hubloc_id desc limit 1", + dbesc($base) + ); + if($h) { + $host_crypto = $h[0]; + } + } + + $msg = $outq['outq_notify']; + + $result = Libzot::zot($outq['outq_posturl'],$msg,$channel,$host_crypto); + + if($result['success']) { + logger('deliver: remote zot6 delivery succeeded to ' . $outq['outq_posturl']); + Libzot::process_response($outq['outq_posturl'],$result, $outq); + } + else { + logger('deliver: remote zot6 delivery failed to ' . $outq['outq_posturl']); + logger('deliver: remote zot6 delivery fail data: ' . print_r($result,true), LOGGER_DATA); + update_queue_item($outq['outq_hash'],10); + } } return; |