]> git.mxchange.org Git - friendica.git/blobdiff - mod/item.php
Removed commented code
[friendica.git] / mod / item.php
index dec7cc05bfc9b85ba4375eef495e49a086123609..29a210135567ff326f6fd5222372c2b9406fa523 100644 (file)
@@ -1009,61 +1009,24 @@ function item_post(&$a) {
                }
        }
 
-       create_tags_from_item($post_id);
-       create_files_from_item($post_id);
-
        if ($post_id == $parent) {
                add_thread($post_id);
-               q("COMMIT");
-
-               add_shadow_thread($post_id);
        } else {
                update_thread($parent, true);
-               q("COMMIT");
-
-               // Insert an item entry for UID=0 for global entries
-               // We have to remove or change some data before that,
-               // so that the post appear like a regular received post.
-               // Additionally there is some data that isn't a database field.
-               $arr = $datarray;
-
-               $arr['app'] = $arr['source'];
-               unset($arr['source']);
-
-               unset($arr['self']);
-               unset($arr['wall']);
-               unset($arr['origin']);
-               unset($arr['api_source']);
-               unset($arr['message_id']);
-               unset($arr['profile_uid']);
-               unset($arr['post_id']);
-               unset($arr['dropitems']);
-               unset($arr['commenter']);
-               unset($arr['return']);
-               unset($arr['preview']);
-               unset($arr['post_id_random']);
-               unset($arr['emailcc']);
-               unset($arr['pubmail_enable']);
-               unset($arr['category']);
-               unset($arr['jsreload']);
-
-               if (in_array($arr['type'], array("net-comment", "wall-comment"))) {
-                       $arr['type'] = 'remote-comment';
-               } elseif ($arr['type'] == 'wall') {
-                       $arr['type'] = 'remote';
-               }
-               add_shadow_entry($arr);
        }
 
-       // This is a real juggling act on shared hosting services which kill your processes
-       // e.g. dreamhost. We used to start delivery to our native delivery agents in the background
-       // and then run our plugin delivery from the foreground. We're now doing plugin delivery first,
-       // because as soon as you start loading up a bunch of remote delivey processes, *this* page is
-       // likely to get killed off. If you end up looking at an /item URL and a blank page,
-       // it's very likely the delivery got killed before all your friends could be notified.
-       // Currently the only realistic fixes are to use a reliable server - which precludes shared hosting,
-       // or cut back on plugins which do remote deliveries.
+       q("COMMIT");
+
+       create_tags_from_item($post_id);
+       create_files_from_item($post_id);
+
+       // Insert an item entry for UID=0 for global entries.
+       // We now do it in the background to save some time.
+       // This is important in interactive environments like the frontend or the API.
+       // We don't fork a new process since this is done anyway with the following command
+       proc_run(array('priority' => PRIORITY_HIGH, 'dont_fork' => true), "include/create_shadowentry.php", $post_id);
 
+       // Call the background process that is delivering the item to the receivers
        proc_run(PRIORITY_HIGH, "include/notifier.php", $notify_type, $post_id);
 
        logger('post_complete');