aboutsummaryrefslogtreecommitdiffstats
path: root/include/queue_fn.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2020-03-29 15:18:49 +0000
committerMario <mario@mariovavti.com>2020-03-29 15:18:49 +0000
commitb739f91caa1522522a4ce093d7c63f0f4c777085 (patch)
tree363847c74a9068f3c8cf5110a5ac377c5d40fba1 /include/queue_fn.php
parentb1590ad645eca3f9d35e6fb7250547f2244c3140 (diff)
downloadvolse-hubzilla-b739f91caa1522522a4ce093d7c63f0f4c777085.tar.gz
volse-hubzilla-b739f91caa1522522a4ce093d7c63f0f4c777085.tar.bz2
volse-hubzilla-b739f91caa1522522a4ce093d7c63f0f4c777085.zip
use Libsync::build_sync_packet() in mod item, default Lib/Queue driver to zot6 and some whitespace cleanup in queue_deliver()
Diffstat (limited to 'include/queue_fn.php')
-rw-r--r--include/queue_fn.php80
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;