mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-20 04:15:12 +00:00
take off the kid gloves
This commit is contained in:
parent
c99d89e441
commit
289ec34ae6
4 changed files with 41 additions and 52 deletions
|
@ -245,12 +245,12 @@ function channel_remove($channel_id, $local = true, $unset_session=true) {
|
|||
intval($channel_id)
|
||||
);
|
||||
|
||||
$r = q("update hubloc set hubloc_flags = hubloc_flags | %d where hubloc_hash = '%s'",
|
||||
$r = q("update hubloc set hubloc_flags = (hubloc_flags | %d) where hubloc_hash = '%s'",
|
||||
intval(HUBLOC_FLAGS_DELETED),
|
||||
dbesc($channel['channel_hash'])
|
||||
);
|
||||
|
||||
$r = q("update xchan set xchan_flags = xchan_flags | %d where xchan_hash = '%s'",
|
||||
$r = q("update xchan set xchan_flags = (xchan_flags | %d) where xchan_hash = '%s'",
|
||||
intval(XCHAN_FLAGS_DELETED),
|
||||
dbesc($channel['channel_hash'])
|
||||
);
|
||||
|
@ -274,7 +274,7 @@ function channel_remove($channel_id, $local = true, $unset_session=true) {
|
|||
q("DELETE FROM `spam` WHERE `uid` = %d", intval($channel_id));
|
||||
|
||||
|
||||
q("delete from abook where abook_xchan = '%s' and abook_flags & %d limit 1",
|
||||
q("delete from abook where abook_xchan = '%s' and (abook_flags & %d) limit 1",
|
||||
dbesc($channel['channel_hash']),
|
||||
dbesc(ABOOK_FLAG_SELF)
|
||||
);
|
||||
|
@ -285,13 +285,13 @@ function channel_remove($channel_id, $local = true, $unset_session=true) {
|
|||
intval($channel_id)
|
||||
);
|
||||
|
||||
$r = q("update hubloc set hubloc_flags = hubloc_flags | %d where hubloc_hash = '%s' and hubloc_url = '%s' ",
|
||||
$r = q("update hubloc set hubloc_flags = (hubloc_flags | %d) where hubloc_hash = '%s' and hubloc_url = '%s' ",
|
||||
intval(HUBLOC_FLAGS_DELETED),
|
||||
dbesc($channel['channel_hash']),
|
||||
dbesc(z_root())
|
||||
);
|
||||
|
||||
$r = q("update xchan set xchan_flags = xchan_flags | %d where xchan_hash = '%s' ",
|
||||
$r = q("update xchan set xchan_flags = (xchan_flags | %d) where xchan_hash = '%s' ",
|
||||
intval(XCHAN_FLAGS_DELETED),
|
||||
dbesc($channel['channel_hash'])
|
||||
);
|
||||
|
@ -435,12 +435,12 @@ function remove_all_xchan_resources($xchan, $channel_id = 0) {
|
|||
|
||||
// directory servers need to keep the record around for sync purposes - mark it deleted
|
||||
|
||||
$r = q("update hubloc set hubloc_flags = hubloc_flags | %d where hubloc_hash = '%s'",
|
||||
$r = q("update hubloc set hubloc_flags = (hubloc_flags | %d) where hubloc_hash = '%s'",
|
||||
intval(HUBLOC_FLAGS_DELETED),
|
||||
dbesc($xchan)
|
||||
);
|
||||
|
||||
$r = q("update xchan set xchan_flags = xchan_flags | %d where xchan_hash = '%s'",
|
||||
$r = q("update xchan set xchan_flags = (xchan_flags | %d) where xchan_hash = '%s'",
|
||||
intval(XCHAN_FLAGS_DELETED),
|
||||
dbesc($xchan)
|
||||
);
|
||||
|
|
|
@ -20,6 +20,20 @@ function deliver_run($argv, $argc) {
|
|||
dbesc($argv[$x])
|
||||
);
|
||||
if($r) {
|
||||
if($r[0]['outq_driver'] === 'post') {
|
||||
$result = z_post_url($r[0]['outq_posturl'],$r[0]['outq_msg']);
|
||||
if($result['success'] && $result['status_code'] < 300) {
|
||||
logger('deliver: queue post success to ' . $r[0]['outq_posturl'], LOGGER_DEBUG);
|
||||
}
|
||||
else {
|
||||
$y = q("update outq set outq_updated = '%s' where outq_hash = '%s' limit 1",
|
||||
dbesc(datetime_convert()),
|
||||
dbesc($argv[$x])
|
||||
);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if($r[0]['outq_posturl'] === z_root() . '/post') {
|
||||
logger('deliver: local delivery', LOGGER_DEBUG);
|
||||
// local delivery
|
||||
|
|
|
@ -2741,56 +2741,31 @@ function diaspora_transmit($owner,$contact,$slap,$public_batch,$queue_run=false)
|
|||
if(intval(get_config('system','diaspora_test')))
|
||||
return 200;
|
||||
|
||||
|
||||
|
||||
return 200;
|
||||
|
||||
|
||||
$a = get_app();
|
||||
$logid = random_string(4);
|
||||
$dest_url = (($public_batch) ? $contact['batch'] : $contact['notify']);
|
||||
if(! $dest_url) {
|
||||
logger('diaspora_transmit: no url for contact: ' . $contact['id'] . ' batch mode =' . $public_batch);
|
||||
return 0;
|
||||
}
|
||||
|
||||
logger('diaspora_transmit: ' . $logid . ' ' . $dest_url);
|
||||
logger('diaspora_transmit: ' . $logid . ' ' . $dest_url, LOGGER_DEBUG);
|
||||
|
||||
if( (! $queue_run) && (was_recently_delayed($contact['id'])) ) {
|
||||
$return_code = 0;
|
||||
}
|
||||
else {
|
||||
if (!intval(get_config('system','diaspora_test'))) {
|
||||
post_url($dest_url . '/', $slap);
|
||||
$return_code = $a->get_curl_code();
|
||||
} else {
|
||||
logger('diaspora_transmit: test_mode');
|
||||
return 200;
|
||||
}
|
||||
}
|
||||
$hash = random_string();
|
||||
|
||||
logger('diaspora_transmit: ' . $logid . ' returns: ' . $return_code);
|
||||
$interval = ((get_config('system','delivery_interval') !== false)
|
||||
? intval(get_config('system','delivery_interval')) : 2 );
|
||||
|
||||
if((! $return_code) || (($return_code == 503) && (stristr($a->get_curl_headers(),'retry-after')))) {
|
||||
logger('diaspora_transmit: queue message');
|
||||
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($owner['account_id']),
|
||||
intval($owner['channel_id']),
|
||||
dbesc('post'),
|
||||
dbesc($dest_url),
|
||||
intval(1),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(datetime_convert()),
|
||||
dbesc(''),
|
||||
dbesc($slap)
|
||||
);
|
||||
|
||||
$r = q("SELECT id from queue where cid = %d and network = '%s' and content = '%s' and batch = %d limit 1",
|
||||
intval($contact['id']),
|
||||
dbesc(NETWORK_DIASPORA),
|
||||
dbesc($slap),
|
||||
intval($public_batch)
|
||||
);
|
||||
if(count($r)) {
|
||||
logger('diaspora_transmit: add_to_queue ignored - identical item already in queue');
|
||||
}
|
||||
else {
|
||||
// queue message for redelivery
|
||||
add_to_queue($contact['id'],NETWORK_DIASPORA,$slap,$public_batch);
|
||||
}
|
||||
}
|
||||
proc_run('php','include/deliver.php',$hash);
|
||||
if($interval)
|
||||
@time_sleep_until(microtime(true) + (float) $interval);
|
||||
|
||||
|
||||
return(($return_code) ? $return_code : (-1));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
2014-08-25.778
|
||||
2014-08-26.779
|
||||
|
|
Loading…
Reference in a new issue