aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/directory.php26
-rw-r--r--include/notifier.php21
-rw-r--r--include/ratenotif.php20
-rw-r--r--include/zot.php45
4 files changed, 45 insertions, 67 deletions
diff --git a/include/directory.php b/include/directory.php
index 9ab1d805b..8792a15e1 100644
--- a/include/directory.php
+++ b/include/directory.php
@@ -8,6 +8,7 @@ require_once('boot.php');
require_once('include/zot.php');
require_once('include/cli_startup.php');
require_once('include/dir_fns.php');
+require_once('include/queue_fn.php');
/**
* @brief
@@ -83,20 +84,17 @@ function directory_run($argv, $argc){
*/
$hash = random_string();
- q("insert into outq ( outq_hash, outq_account, outq_channel, outq_driver, outq_posturl, outq_async, outq_created, outq_updated, outq_notify, outq_msg )
- values ( '%s', %d, %d, '%s', '%s', %d, '%s', '%s', '%s', '%s' )",
- dbesc($hash),
- intval($channel['channel_account_id']),
- intval($channel['channel_id']),
- dbesc('zot'),
- dbesc($url),
- intval(1),
- dbesc(datetime_convert()),
- dbesc(datetime_convert()),
- dbesc($packet),
- dbesc('')
- );
- } else {
+
+ queue_insert(array(
+ 'hash' => $hash,
+ 'account_id' => $channel['channel_account_id'],
+ 'channel_id' => $channel['channel_id'],
+ 'posturl' => $url,
+ 'notify' => $packet,
+ ));
+
+ }
+ else {
q("update channel set channel_dirdate = '%s' where channel_id = %d",
dbesc(datetime_convert()),
intval($channel['channel_id'])
diff --git a/include/notifier.php b/include/notifier.php
index 6ff2666bb..c5c1ec75b 100644
--- a/include/notifier.php
+++ b/include/notifier.php
@@ -159,23 +159,16 @@ function notifier_run($argv, $argc){
));
if($data) {
$hash = random_string();
- q("insert into outq ( outq_hash, outq_account, outq_channel, outq_driver, outq_posturl, outq_async, outq_created, outq_updated, outq_notify, outq_msg )
- values ( '%s', %d, %d, '%s', '%s', %d, '%s', '%s', '%s', '%s' )",
- dbesc($hash),
- intval($s[0]['channel_account_id']),
- intval($s[0]['channel_id']),
- dbesc('zot'),
- dbesc($hh['hubloc_callback']),
- intval(1),
- dbesc(datetime_convert()),
- dbesc(datetime_convert()),
- dbesc($data),
- dbesc('')
- );
+ queue_insert(array(
+ 'hash' => $hash,
+ 'account_id' => $s[0]['channel_account_id'],
+ 'channel_id' => $s[0]['channel_id'],
+ 'posturl' => $hh['hubloc_callback'],
+ 'notify' => $data,
+ ));
$deliveries[] = $hash;
}
}
-
}
}
diff --git a/include/ratenotif.php b/include/ratenotif.php
index 63fd7c2ee..e94f30247 100644
--- a/include/ratenotif.php
+++ b/include/ratenotif.php
@@ -82,18 +82,14 @@ function ratenotif_run($argv, $argc){
$hash = random_string();
$n = zot_build_packet($channel,'notify',null,null,$hash);
- q("insert into outq ( outq_hash, outq_account, outq_channel, outq_driver, outq_posturl, outq_async, outq_created, outq_updated, outq_notify, outq_msg ) values ( '%s', %d, %d, '%s', '%s', %d, '%s', '%s', '%s', '%s' )",
- dbesc($hash),
- intval($channel['channel_account_id']),
- intval($channel['channel_id']),
- dbesc('zot'),
- dbesc($h . '/post'),
- intval(1),
- dbesc(datetime_convert()),
- dbesc(datetime_convert()),
- dbesc($n),
- dbesc(json_encode($encoded_item))
- );
+ queue_insert(array(
+ 'hash' => $hash,
+ 'account_id' => $channel['channel_account_id'],
+ 'channel_id' => $channel['channel_id'],
+ 'posturl' => $h . '/post',
+ 'notify' => $n,
+ 'msg' => json_encode($encoded_item)
+ ));
$deliver[] = $hash;
diff --git a/include/zot.php b/include/zot.php
index 390407e4e..6655f1c2c 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -12,6 +12,7 @@ require_once('include/crypto.php');
require_once('include/items.php');
require_once('include/hubloc.php');
require_once('include/DReport.php');
+require_once('include/queue_fn.php');
/**
@@ -2974,24 +2975,19 @@ function build_sync_packet($uid = 0, $packet = null, $groups_changed = false) {
$interval = ((get_config('system','delivery_interval') !== false)
? intval(get_config('system','delivery_interval')) : 2 );
-
logger('build_sync_packet: packet: ' . print_r($info,true), LOGGER_DATA);
foreach($synchubs as $hub) {
$hash = random_string();
$n = zot_build_packet($channel,'notify',$env_recips,$hub['hubloc_sitekey'],$hash);
- q("insert into outq ( outq_hash, outq_account, outq_channel, outq_driver, outq_posturl, outq_async, outq_created, outq_updated, outq_notify, outq_msg ) values ( '%s', %d, %d, '%s', '%s', %d, '%s', '%s', '%s', '%s' )",
- dbesc($hash),
- intval($channel['channel_account']),
- intval($channel['channel_id']),
- dbesc('zot'),
- dbesc($hub['hubloc_callback']),
- intval(1),
- dbesc(datetime_convert()),
- dbesc(datetime_convert()),
- dbesc($n),
- dbesc(json_encode($info))
- );
+ queue_insert(array(
+ 'hash' => $hash,
+ 'account_id' => $channel['channel_account_id'],
+ 'channel_id' => $channel['channel_id'],
+ 'posturl' => $hub['hubloc_callback'],
+ 'notify' => $n,
+ 'msg' => json_encode($info)
+ ));
proc_run('php', 'include/deliver.php', $hash);
if($interval)
@@ -3554,20 +3550,15 @@ function zot_reply_message_request($data) {
*/
$n = zot_build_packet($c[0],'notify',$env_recips,(($private) ? $hub['hubloc_sitekey'] : null),$hash,array('message_id' => $data['message_id']));
- q("insert into outq ( outq_hash, outq_account, outq_channel, outq_driver, outq_posturl, outq_async,
- outq_created, outq_updated, outq_notify, outq_msg )
- values ( '%s', %d, %d, '%s', '%s', %d, '%s', '%s', '%s', '%s' )",
- dbesc($hash),
- intval($c[0]['channel_account_id']),
- intval($c[0]['channel_id']),
- dbesc('zot'),
- dbesc($hub['hubloc_callback']),
- intval(1),
- dbesc(datetime_convert()),
- dbesc(datetime_convert()),
- dbesc($n),
- dbesc($data_packet)
- );
+
+ queue_insert(array(
+ 'hash' => $hash,
+ 'account_id' => $c[0]['channel_account_id'],
+ 'channel_id' => $c[0]['channel_id'],
+ 'posturl' => $hub['hubloc_callback'],
+ 'notify' => $n,
+ 'msg' => json_encode($data_packet)
+ ));
/*
* invoke delivery to send out the notify packet