diff options
author | friendica <info@friendica.com> | 2014-08-26 16:35:06 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2014-08-26 16:35:06 -0700 |
commit | 289ec34ae6890a2d82071b61a12fad866be9f0d0 (patch) | |
tree | bf69fcac7f040e0153feee89d6f69dd31e91f011 /include | |
parent | c99d89e441c742ceaaa299c9de9c2fb322b41993 (diff) | |
download | volse-hubzilla-289ec34ae6890a2d82071b61a12fad866be9f0d0.tar.gz volse-hubzilla-289ec34ae6890a2d82071b61a12fad866be9f0d0.tar.bz2 volse-hubzilla-289ec34ae6890a2d82071b61a12fad866be9f0d0.zip |
take off the kid gloves
Diffstat (limited to 'include')
-rw-r--r-- | include/Contact.php | 14 | ||||
-rw-r--r-- | include/deliver.php | 14 | ||||
-rwxr-xr-x | include/diaspora.php | 63 |
3 files changed, 40 insertions, 51 deletions
diff --git a/include/Contact.php b/include/Contact.php index 140f449af..66c94ef50 100644 --- a/include/Contact.php +++ b/include/Contact.php @@ -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) ); diff --git a/include/deliver.php b/include/deliver.php index 0ad008c23..6edf3d60f 100644 --- a/include/deliver.php +++ b/include/deliver.php @@ -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 diff --git a/include/diaspora.php b/include/diaspora.php index 1e101b4a7..8471cfbd7 100755 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -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); - 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; - } - } + logger('diaspora_transmit: ' . $logid . ' ' . $dest_url, LOGGER_DEBUG); - logger('diaspora_transmit: ' . $logid . ' returns: ' . $return_code); + $hash = random_string(); - if((! $return_code) || (($return_code == 503) && (stristr($a->get_curl_headers(),'retry-after')))) { - logger('diaspora_transmit: queue message'); + $interval = ((get_config('system','delivery_interval') !== false) + ? intval(get_config('system','delivery_interval')) : 2 ); - $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); - } - } + 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) + ); + proc_run('php','include/deliver.php',$hash); + if($interval) + @time_sleep_until(microtime(true) + (float) $interval); - return(($return_code) ? $return_code : (-1)); } - - |