more work on queue api
This commit is contained in:
parent
76816de3aa
commit
b13241564b
@ -8,6 +8,7 @@ require_once('boot.php');
|
|||||||
require_once('include/zot.php');
|
require_once('include/zot.php');
|
||||||
require_once('include/cli_startup.php');
|
require_once('include/cli_startup.php');
|
||||||
require_once('include/dir_fns.php');
|
require_once('include/dir_fns.php');
|
||||||
|
require_once('include/queue_fn.php');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief
|
* @brief
|
||||||
@ -83,20 +84,17 @@ function directory_run($argv, $argc){
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$hash = random_string();
|
$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' )",
|
queue_insert(array(
|
||||||
dbesc($hash),
|
'hash' => $hash,
|
||||||
intval($channel['channel_account_id']),
|
'account_id' => $channel['channel_account_id'],
|
||||||
intval($channel['channel_id']),
|
'channel_id' => $channel['channel_id'],
|
||||||
dbesc('zot'),
|
'posturl' => $url,
|
||||||
dbesc($url),
|
'notify' => $packet,
|
||||||
intval(1),
|
));
|
||||||
dbesc(datetime_convert()),
|
|
||||||
dbesc(datetime_convert()),
|
}
|
||||||
dbesc($packet),
|
else {
|
||||||
dbesc('')
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
q("update channel set channel_dirdate = '%s' where channel_id = %d",
|
q("update channel set channel_dirdate = '%s' where channel_id = %d",
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
intval($channel['channel_id'])
|
intval($channel['channel_id'])
|
||||||
|
@ -159,23 +159,16 @@ function notifier_run($argv, $argc){
|
|||||||
));
|
));
|
||||||
if($data) {
|
if($data) {
|
||||||
$hash = random_string();
|
$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 )
|
queue_insert(array(
|
||||||
values ( '%s', %d, %d, '%s', '%s', %d, '%s', '%s', '%s', '%s' )",
|
'hash' => $hash,
|
||||||
dbesc($hash),
|
'account_id' => $s[0]['channel_account_id'],
|
||||||
intval($s[0]['channel_account_id']),
|
'channel_id' => $s[0]['channel_id'],
|
||||||
intval($s[0]['channel_id']),
|
'posturl' => $hh['hubloc_callback'],
|
||||||
dbesc('zot'),
|
'notify' => $data,
|
||||||
dbesc($hh['hubloc_callback']),
|
));
|
||||||
intval(1),
|
|
||||||
dbesc(datetime_convert()),
|
|
||||||
dbesc(datetime_convert()),
|
|
||||||
dbesc($data),
|
|
||||||
dbesc('')
|
|
||||||
);
|
|
||||||
$deliveries[] = $hash;
|
$deliveries[] = $hash;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,18 +82,14 @@ function ratenotif_run($argv, $argc){
|
|||||||
$hash = random_string();
|
$hash = random_string();
|
||||||
$n = zot_build_packet($channel,'notify',null,null,$hash);
|
$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' )",
|
queue_insert(array(
|
||||||
dbesc($hash),
|
'hash' => $hash,
|
||||||
intval($channel['channel_account_id']),
|
'account_id' => $channel['channel_account_id'],
|
||||||
intval($channel['channel_id']),
|
'channel_id' => $channel['channel_id'],
|
||||||
dbesc('zot'),
|
'posturl' => $h . '/post',
|
||||||
dbesc($h . '/post'),
|
'notify' => $n,
|
||||||
intval(1),
|
'msg' => json_encode($encoded_item)
|
||||||
dbesc(datetime_convert()),
|
));
|
||||||
dbesc(datetime_convert()),
|
|
||||||
dbesc($n),
|
|
||||||
dbesc(json_encode($encoded_item))
|
|
||||||
);
|
|
||||||
|
|
||||||
$deliver[] = $hash;
|
$deliver[] = $hash;
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ require_once('include/crypto.php');
|
|||||||
require_once('include/items.php');
|
require_once('include/items.php');
|
||||||
require_once('include/hubloc.php');
|
require_once('include/hubloc.php');
|
||||||
require_once('include/DReport.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)
|
$interval = ((get_config('system','delivery_interval') !== false)
|
||||||
? intval(get_config('system','delivery_interval')) : 2 );
|
? intval(get_config('system','delivery_interval')) : 2 );
|
||||||
|
|
||||||
|
|
||||||
logger('build_sync_packet: packet: ' . print_r($info,true), LOGGER_DATA);
|
logger('build_sync_packet: packet: ' . print_r($info,true), LOGGER_DATA);
|
||||||
|
|
||||||
foreach($synchubs as $hub) {
|
foreach($synchubs as $hub) {
|
||||||
$hash = random_string();
|
$hash = random_string();
|
||||||
$n = zot_build_packet($channel,'notify',$env_recips,$hub['hubloc_sitekey'],$hash);
|
$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' )",
|
queue_insert(array(
|
||||||
dbesc($hash),
|
'hash' => $hash,
|
||||||
intval($channel['channel_account']),
|
'account_id' => $channel['channel_account_id'],
|
||||||
intval($channel['channel_id']),
|
'channel_id' => $channel['channel_id'],
|
||||||
dbesc('zot'),
|
'posturl' => $hub['hubloc_callback'],
|
||||||
dbesc($hub['hubloc_callback']),
|
'notify' => $n,
|
||||||
intval(1),
|
'msg' => json_encode($info)
|
||||||
dbesc(datetime_convert()),
|
));
|
||||||
dbesc(datetime_convert()),
|
|
||||||
dbesc($n),
|
|
||||||
dbesc(json_encode($info))
|
|
||||||
);
|
|
||||||
|
|
||||||
proc_run('php', 'include/deliver.php', $hash);
|
proc_run('php', 'include/deliver.php', $hash);
|
||||||
if($interval)
|
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']));
|
$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 )
|
queue_insert(array(
|
||||||
values ( '%s', %d, %d, '%s', '%s', %d, '%s', '%s', '%s', '%s' )",
|
'hash' => $hash,
|
||||||
dbesc($hash),
|
'account_id' => $c[0]['channel_account_id'],
|
||||||
intval($c[0]['channel_account_id']),
|
'channel_id' => $c[0]['channel_id'],
|
||||||
intval($c[0]['channel_id']),
|
'posturl' => $hub['hubloc_callback'],
|
||||||
dbesc('zot'),
|
'notify' => $n,
|
||||||
dbesc($hub['hubloc_callback']),
|
'msg' => json_encode($data_packet)
|
||||||
intval(1),
|
));
|
||||||
dbesc(datetime_convert()),
|
|
||||||
dbesc(datetime_convert()),
|
|
||||||
dbesc($n),
|
|
||||||
dbesc($data_packet)
|
|
||||||
);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* invoke delivery to send out the notify packet
|
* invoke delivery to send out the notify packet
|
||||||
|
Reference in New Issue
Block a user