Merge branch 'dev' into core_fixes
This commit is contained in:
commit
65f2d7fd66
@ -12,7 +12,6 @@ class Queue {
|
|||||||
require_once('include/items.php');
|
require_once('include/items.php');
|
||||||
require_once('include/bbcode.php');
|
require_once('include/bbcode.php');
|
||||||
|
|
||||||
|
|
||||||
if($argc > 1)
|
if($argc > 1)
|
||||||
$queue_id = $argv[1];
|
$queue_id = $argv[1];
|
||||||
else
|
else
|
||||||
@ -62,9 +61,19 @@ class Queue {
|
|||||||
// the site is permanently down, there's no reason to attempt delivery at all, or at most not more than once
|
// the site is permanently down, there's no reason to attempt delivery at all, or at most not more than once
|
||||||
// or twice a day.
|
// or twice a day.
|
||||||
|
|
||||||
$r = q("SELECT * FROM outq WHERE outq_delivered = 0 and outq_scheduled < %s ",
|
$sqlrandfunc = db_getfunc('rand');
|
||||||
|
|
||||||
|
$r = q("SELECT *,$sqlrandfunc as rn FROM outq WHERE outq_delivered = 0 and outq_scheduled < %s order by rn limit 1",
|
||||||
db_utcnow()
|
db_utcnow()
|
||||||
);
|
);
|
||||||
|
while ($r) {
|
||||||
|
foreach($r as $rv) {
|
||||||
|
queue_deliver($rv);
|
||||||
|
}
|
||||||
|
$r = q("SELECT *,$sqlrandfunc as rn FROM outq WHERE outq_delivered = 0 and outq_scheduled < %s order by rn limit 1",
|
||||||
|
db_utcnow()
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(! $r)
|
if(! $r)
|
||||||
return;
|
return;
|
||||||
|
@ -134,7 +134,7 @@ class New_channel extends \Zotlabs\Web\Controller {
|
|||||||
$default_role = '';
|
$default_role = '';
|
||||||
$aid = get_account_id();
|
$aid = get_account_id();
|
||||||
if($aid) {
|
if($aid) {
|
||||||
$r = q("select count(channel_id) as total from channel where channel_account_id = %d",
|
$r = q("select count(channel_id) as total from channel where channel_account_id = %d and channel_removed = 0",
|
||||||
intval($aid)
|
intval($aid)
|
||||||
);
|
);
|
||||||
if($r && (! intval($r[0]['total']))) {
|
if($r && (! intval($r[0]['total']))) {
|
||||||
|
@ -1035,8 +1035,9 @@ function import_mail($channel, $mails, $sync = false) {
|
|||||||
if(! $m)
|
if(! $m)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
$m['aid'] = $channel['channel_account_id'];
|
$m['account_id'] = $channel['channel_account_id'];
|
||||||
$m['uid'] = $channel['channel_id'];
|
$m['channel_id'] = $channel['channel_id'];
|
||||||
|
|
||||||
$mail_id = mail_store($m);
|
$mail_id = mail_store($m);
|
||||||
if($sync && $mail_id) {
|
if($sync && $mail_id) {
|
||||||
Zotlabs\Daemon\Master::Summon(array('Notifier','single_mail',$mail_id));
|
Zotlabs\Daemon\Master::Summon(array('Notifier','single_mail',$mail_id));
|
||||||
|
@ -13,7 +13,7 @@ function update_queue_item($id, $add_priority = 0) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
$y = q("select min(outq_created) as earliest from outq where outq_posturl = '%s'",
|
$y = q("select outq_created as earliest from outq where outq_posturl = '%s' order by earliest limit 1",
|
||||||
dbesc($x[0]['outq_posturl'])
|
dbesc($x[0]['outq_posturl'])
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -4924,12 +4924,13 @@ function zot_reply_pickup($data) {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Everything is good if we made it here, so find all messages that are going to this location
|
* Everything is good if we made it here, so find all messages that are going to this location
|
||||||
* and send them all.
|
* and send them all - or a reasonable number if there are a lot so we don't overflow memory.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$r = q("select * from outq where outq_posturl = '%s'",
|
$r = q("select * from outq where outq_posturl = '%s' limit 100",
|
||||||
dbesc($data['callback'])
|
dbesc($data['callback'])
|
||||||
);
|
);
|
||||||
|
|
||||||
if($r) {
|
if($r) {
|
||||||
logger('mod_zot: successful pickup message received from ' . $data['callback'] . ' ' . count($r) . ' message(s) picked up', LOGGER_DEBUG);
|
logger('mod_zot: successful pickup message received from ' . $data['callback'] . ' ' . count($r) . ' message(s) picked up', LOGGER_DEBUG);
|
||||||
|
|
||||||
@ -4955,6 +4956,19 @@ function zot_reply_pickup($data) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// It's possible that we have more than 100 messages waiting to be sent.
|
||||||
|
|
||||||
|
// See if there are any more messages in the queue.
|
||||||
|
$x = q("select * from outq where outq_posturl = '%s' order by outq_created limit 1",
|
||||||
|
dbesc($data['callback'])
|
||||||
|
);
|
||||||
|
|
||||||
|
// If so, kick off a new delivery notification for the next batch
|
||||||
|
if ($x) {
|
||||||
|
logger("Send additional pickup request.", LOGGER_DEBUG);
|
||||||
|
queue_deliver($x[0],true);
|
||||||
|
}
|
||||||
|
|
||||||
// this is a bit of a hack because we don't have the hubloc_url here, only the callback url.
|
// this is a bit of a hack because we don't have the hubloc_url here, only the callback url.
|
||||||
// worst case is we'll end up using aes256cbc if they've got a different post endpoint
|
// worst case is we'll end up using aes256cbc if they've got a different post endpoint
|
||||||
|
|
||||||
@ -4966,6 +4980,8 @@ function zot_reply_pickup($data) {
|
|||||||
$encrypted = crypto_encapsulate(json_encode($ret),$sitekey,$algorithm);
|
$encrypted = crypto_encapsulate(json_encode($ret),$sitekey,$algorithm);
|
||||||
|
|
||||||
json_return_and_die($encrypted);
|
json_return_and_die($encrypted);
|
||||||
|
// @FIXME: There is a possibility that the transmission will get interrupted
|
||||||
|
// and fail - in which case this packet of messages will be lost.
|
||||||
/* pickup: end */
|
/* pickup: end */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user