diff options
author | Friendika <info@friendika.com> | 2011-10-15 03:26:37 -0700 |
---|---|---|
committer | Friendika <info@friendika.com> | 2011-10-15 03:26:37 -0700 |
commit | 5dcc10a5d9d2be79070716fbcaf5c054f7ed9efa (patch) | |
tree | 24fe6816289c5334c1e5c9ee895fc0bd1aff530e /include | |
parent | af6ab381000346f487d1b5b07623510640dd7ee5 (diff) | |
download | volse-hubzilla-5dcc10a5d9d2be79070716fbcaf5c054f7ed9efa.tar.gz volse-hubzilla-5dcc10a5d9d2be79070716fbcaf5c054f7ed9efa.tar.bz2 volse-hubzilla-5dcc10a5d9d2be79070716fbcaf5c054f7ed9efa.zip |
working on long-term solution to relay issue
Diffstat (limited to 'include')
-rw-r--r-- | include/items.php | 18 | ||||
-rw-r--r-- | include/notifier.php | 11 |
2 files changed, 16 insertions, 13 deletions
diff --git a/include/items.php b/include/items.php index 36851b01f..0c3c8b1d7 100644 --- a/include/items.php +++ b/include/items.php @@ -818,18 +818,10 @@ function item_store($arr,$force_parent = false) { // find the item we just created - $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `uid` = %d ORDER BY `id` ASC LIMIT 1", + $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `uid` = %d ORDER BY `id` ASC ", $arr['uri'], // already dbesc'd intval($arr['uid']) ); - if(! count($r)) { - // This is not good, but perhaps we encountered a rare race/cache condition, so back off and try again. - sleep(3); - $r = q("SELECT `id` FROM `item` WHERE `uri` = '%s' AND `uid` = %d ORDER BY `id` ASC LIMIT 1", - $arr['uri'], // already dbesc'd - intval($arr['uid']) - ); - } if(count($r)) { $current_post = $r[0]['id']; @@ -1873,13 +1865,14 @@ function local_delivery($importer,$data) { $r = q("select `item`.`id`, `contact`.`name`, `contact`.`url`, `contact`.`thumb` from `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` - WHERE `contact`.`self` = 1 AND `item`.`wall` = 1 AND `item`.`uri` = '%s' AND `item`.`uid` = %d LIMIT 1", + WHERE `contact`.`self` = 1 AND `item`.`wall` = 1 AND `item`.`uri` = '%s' AND `item`.`parent-uri` = '%s' + AND `item`.`uid` = %d LIMIT 1", + dbesc($parent_uri), dbesc($parent_uri), intval($importer['importer_uid']) ); if($r && count($r)) { - logger('local_delivery: received remote comment'); $is_like = false; // remote reply to our post. Import and then notify everybody else. @@ -2388,6 +2381,9 @@ function atom_entry($item,$type,$author,$owner,$comment = false) { $a = get_app(); + if(! $item['parent']) + return; + if($item['deleted']) return '<at:deleted-entry ref="' . xmlify($item['uri']) . '" when="' . xmlify(datetime_convert('UTC','UTC',$item['edited'] . '+00:00',ATOM_TIME)) . '" />' . "\r\n"; diff --git a/include/notifier.php b/include/notifier.php index bbddee109..18ad07012 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -142,7 +142,7 @@ function notifier_run($argv, $argc){ $item['deleted'] = 1; } - if((count($items) == 1) && ($items[0]['uri'] === $items[0]['parent-uri'])) { + if((count($items) == 1) && ($items[0]['id'] === $target_item['id']) && ($items[0]['uri'] === $items[0]['parent-uri'])) { logger('notifier: top level post'); $top_level = true; } @@ -205,13 +205,20 @@ function notifier_run($argv, $argc){ /** * - * Be VERY CAREFUL if you make any changes to the following line. Seemingly innocuous changes + * Be VERY CAREFUL if you make any changes to the following lines. Seemingly innocuous changes * have been known to cause runaway conditions which affected several servers, along with * permissions issues. * */ + $relay_to_owner = false; + if((! $top_level) && ($parent['wall'] == 0) && (! $expire) && (stristr($target_item['uri'],$localhost))) { + $relay_to_owner = true; + } + + + if($relay_to_owner) { logger('notifier: followup', LOGGER_DEBUG); // local followup to remote post $followup = true; |