]> git.mxchange.org Git - friendica.git/commitdiff
"last-child" is not used anymore
authorMichael <heluecht@pirati.ca>
Thu, 18 Jan 2018 06:54:44 +0000 (06:54 +0000)
committerMichael <heluecht@pirati.ca>
Thu, 18 Jan 2018 06:54:44 +0000 (06:54 +0000)
18 files changed:
database.sql
include/api.php
include/conversation.php
include/event.php
include/items.php
include/like.php
mod/dfrn_confirm.php
mod/item.php
mod/photos.php
mod/poke.php
mod/profiles.php
mod/subthread.php
mod/tagger.php
src/Database/DBStructure.php
src/Protocol/DFRN.php
src/Protocol/Diaspora.php
src/Protocol/Feed.php
src/Worker/OnePoll.php

index afd5ad4d1a8ed38f8f74047c912ebef583c3b95b..b55353994a6af09f64ddc6817f0aeab752214ed0 100644 (file)
@@ -499,7 +499,6 @@ CREATE TABLE IF NOT EXISTS `item` (
        `deleted` boolean NOT NULL DEFAULT '0' COMMENT '',
        `origin` boolean NOT NULL DEFAULT '0' COMMENT '',
        `forum_mode` tinyint NOT NULL DEFAULT 0 COMMENT '',
-       `last-child` boolean NOT NULL DEFAULT '1' COMMENT '',
        `mention` boolean NOT NULL DEFAULT '0' COMMENT '',
        `network` varchar(32) NOT NULL DEFAULT '' COMMENT '',
        `rendered-hash` varchar(32) NOT NULL DEFAULT '' COMMENT '',
index d4007564f39aef6973226317e82fd9b20022933d..b4fdb646f90362c2f572e25db463c9fd4e29359e 100644 (file)
@@ -4713,7 +4713,6 @@ function post_photo_item($hash, $allow_cid, $deny_cid, $allow_gid, $deny_gid, $f
        $arr['allow_gid']     = $allow_gid;
        $arr['deny_cid']      = $deny_cid;
        $arr['deny_gid']      = $deny_gid;
-       $arr['last-child']    = 1;
        $arr['visible']       = $visibility;
        $arr['origin']        = 1;
 
index d93b744d91a4c34dfca5dd9eb24eef3cb1dc1eaa..a6edf0d577305ecc7471dac77baa493be2996be6 100644 (file)
@@ -430,7 +430,6 @@ These Fields are not added below (yet). They are here to for bug search.
 `item`.`deleted`,
 `item`.`origin`,
 `item`.`forum_mode`,
-`item`.`last-child`,
 `item`.`mention`,
 `item`.`global`,
 `item`.`gcontact-id`,
index 76044cf981936d89353aaa96a40e163167c6f591..d4c97c750c12d9fa62994d79f43dbe2804799819 100644 (file)
@@ -386,7 +386,6 @@ function event_store($arr) {
                $item_arr['deny_cid']      = $arr['deny_cid'];
                $item_arr['deny_gid']      = $arr['deny_gid'];
                $item_arr['private']       = $arr['private'];
-               $item_arr['last-child']    = 1;
                $item_arr['visible']       = 1;
                $item_arr['verb']          = ACTIVITY_POST;
                $item_arr['object-type']   = ACTIVITY_OBJ_EVENT;
index 6f93f78b312ee787b8e4733c0487852a192ea473..e99799ad6608f58bd151b83eb47b35bc0207d5ff 100644 (file)
@@ -487,7 +487,6 @@ function item_store($arr, $force_parent = false, $notify = false, $dontcache = f
                $arr['wall'] = 1;
                $arr['type'] = 'wall';
                $arr['origin'] = 1;
-               $arr['last-child'] = 1;
                $arr['network'] = NETWORK_DFRN;
                $arr['protocol'] = PROTOCOL_DFRN;
 
@@ -624,7 +623,6 @@ function item_store($arr, $force_parent = false, $notify = false, $dontcache = f
        $arr['title']         = ((x($arr, 'title'))         ? trim($arr['title'])         : '');
        $arr['location']      = ((x($arr, 'location'))      ? trim($arr['location'])      : '');
        $arr['coord']         = ((x($arr, 'coord'))         ? notags(trim($arr['coord']))         : '');
-       $arr['last-child']    = ((x($arr, 'last-child'))    ? intval($arr['last-child'])          : 0 );
        $arr['visible']       = ((x($arr, 'visible') !== false) ? intval($arr['visible'])         : 1 );
        $arr['deleted']       = 0;
        $arr['parent-uri']    = ((x($arr, 'parent-uri'))    ? notags(trim($arr['parent-uri']))    : $arr['uri']);
@@ -1112,18 +1110,6 @@ function item_store($arr, $force_parent = false, $notify = false, $dontcache = f
        create_tags_from_item($current_post);
        Term::createFromItem($current_post);
 
-       /*
-        * If this is now the last-child, force all _other_ children of this parent to *not* be last-child
-        * It is done after the transaction to avoid dead locks.
-        */
-       if ($arr['last-child']) {
-               q("UPDATE `item` SET `last-child` = 0 WHERE `parent-uri` = '%s' AND `uid` = %d AND `id` != %d",
-                       dbesc($arr['uri']),
-                       intval($arr['uid']),
-                       intval($current_post)
-               );
-       }
-
        if ($arr['parent-uri'] === $arr['uri']) {
                Item::addShadow($current_post);
        } else {
index 27832896a57ae86d0c2dee7250790b844632531d..f89b7a82e69ea991aa9f488a27fb8547816386ee 100644 (file)
@@ -238,7 +238,6 @@ EOT;
                'deny_gid'      => $item['deny_gid'],
                'visible'       => 1,
                'unseen'        => 1,
-               'last-child'    => 0
        ];
 
        $new_item_id = item_store($new_item);
index 8baacf0931e5a54da053e1377039bbb93c0a5359..eca16a9e6ce3751ae526cf9eb2fba161a8a20bb4 100644 (file)
@@ -432,8 +432,6 @@ function dfrn_confirm_post(App $a, $handsfree = null)
                                        $arr['object'] .= xmlify('<link rel="photo" type="image/jpeg" href="' . $contact['thumb'] . '" />' . "\n");
                                        $arr['object'] .= '</link></object>' . "\n";
 
-                                       $arr['last-child'] = 1;
-
                                        $arr['allow_cid'] = $user['allow_cid'];
                                        $arr['allow_gid'] = $user['allow_gid'];
                                        $arr['deny_cid']  = $user['deny_cid'];
@@ -696,8 +694,6 @@ function dfrn_confirm_post(App $a, $handsfree = null)
                                        $arr['object'] .= xmlify('<link rel="photo" type="image/jpeg" href="' . $combined['thumb'] . '" />' . "\n");
                                        $arr['object'] .= '</link></object>' . "\n";
 
-                                       $arr['last-child'] = 1;
-
                                        $arr['allow_cid'] = $user['allow_cid'];
                                        $arr['allow_gid'] = $user['allow_gid'];
                                        $arr['deny_cid']  = $user['deny_cid'];
index 19d56638ce45623fd6a20921b8c87c3d38c4b88f..96e289a844cad7a2417cbe01ac1accc7aa964b7b 100644 (file)
@@ -738,7 +738,6 @@ function item_post(App $a) {
        $datarray['gcontact-id']   = GContact::getId(["url" => $datarray['author-link'], "network" => $datarray['network'],
                                                        "photo" => $datarray['author-avatar'], "name" => $datarray['author-name']]);
        $datarray['object']        = $object;
-       $datarray['last-child'] = 1;
 
        /*
         * These fields are for the convenience of plugins...
index f399c3ae80a46f564cf54c7b51dc40f7d1dd2fde..6183ed60b6984b8bf4125d4e53c5e58f20622cfd 100644 (file)
@@ -510,7 +510,6 @@ function photos_post(App $a)
                        $arr['allow_gid']     = $p[0]['allow_gid'];
                        $arr['deny_cid']      = $p[0]['deny_cid'];
                        $arr['deny_gid']      = $p[0]['deny_gid'];
-                       $arr['last-child']    = 1;
                        $arr['visible']       = $visibility;
                        $arr['origin']        = 1;
 
@@ -687,7 +686,6 @@ function photos_post(App $a)
                                        $arr['allow_gid']     = $p[0]['allow_gid'];
                                        $arr['deny_cid']      = $p[0]['deny_cid'];
                                        $arr['deny_gid']      = $p[0]['deny_gid'];
-                                       $arr['last-child']    = 1;
                                        $arr['visible']       = 1;
                                        $arr['verb']          = ACTIVITY_TAG;
                                        $arr['object-type']   = ACTIVITY_OBJ_PERSON;
@@ -924,7 +922,6 @@ function photos_post(App $a)
        $arr['allow_gid']     = $str_group_allow;
        $arr['deny_cid']      = $str_contact_deny;
        $arr['deny_gid']      = $str_group_deny;
-       $arr['last-child']    = 1;
        $arr['visible']       = $visible;
        $arr['origin']        = 1;
 
@@ -1513,7 +1510,7 @@ function photos_content(App $a)
                        }
 
                        if (!DBM::is_result($r)) {
-                               if (($can_post || can_write_wall($owner_uid)) && $link_item['last-child']) {
+                               if (($can_post || can_write_wall($owner_uid))) {
                                        $comments .= replace_macros($cmnt_tpl, [
                                                '$return_path' => '',
                                                '$jsreload' => $return_url,
@@ -1552,7 +1549,7 @@ function photos_content(App $a)
                                        $dislike = format_like($conv_responses['dislike'][$link_item['uri']], $conv_responses['dislike'][$link_item['uri'] . '-l'], 'dislike', $link_item['id']);
                                }
 
-                               if (($can_post || can_write_wall($owner_uid)) && $link_item['last-child']) {
+                               if (($can_post || can_write_wall($owner_uid))) {
                                        $comments .= replace_macros($cmnt_tpl,[
                                                '$return_path' => '',
                                                '$jsreload' => $return_url,
@@ -1625,7 +1622,7 @@ function photos_content(App $a)
                                                '$comment' => $comment
                                        ]);
 
-                                       if (($can_post || can_write_wall($owner_uid)) && $item['last-child']) {
+                                       if (($can_post || can_write_wall($owner_uid))) {
                                                $comments .= replace_macros($cmnt_tpl, [
                                                        '$return_path' => '',
                                                        '$jsreload' => $return_url,
index 8b36b17dceb0f6c0952a3efbcf00a5b053655277..a8410b17d21816dbbdbd0bde08ec8dd3555401e5 100644 (file)
@@ -117,7 +117,6 @@ function poke_init(App $a) {
        $arr['allow_gid']     = $allow_gid;
        $arr['deny_cid']      = $deny_cid;
        $arr['deny_gid']      = $deny_gid;
-       $arr['last-child']    = 1;
        $arr['visible']       = 1;
        $arr['verb']          = $activity;
        $arr['private']       = $private;
index f8d77e27d81fdc73a3d7703a6d160be4bc6bc76c..32ed24346fdd69d42721b69035c72fd379d3a3e6 100644 (file)
@@ -593,7 +593,6 @@ function profile_activity($changed, $value) {
        $arr['object'] .= '<link>' . xmlify('<link rel="alternate" type="text/html" href="' . $self[0]['url'] . '?tab=profile' . '" />' . "\n");
        $arr['object'] .= xmlify('<link rel="photo" type="image/jpeg" href="' . $self[0]['thumb'] . '" />' . "\n");
        $arr['object'] .= '</link></object>' . "\n";
-       $arr['last-child'] = 1;
 
        $arr['allow_cid'] = $a->user['allow_cid'];
        $arr['allow_gid'] = $a->user['allow_gid'];
index 20405ba2d420c0285c514c96f0dc9466dd1667c8..037e2982e779aa00f59e4b682e5819eecacb59a6 100644 (file)
@@ -144,7 +144,6 @@ EOT;
        $arr['deny_gid'] = $item['deny_gid'];
        $arr['visible'] = 1;
        $arr['unseen'] = 1;
-       $arr['last-child'] = 0;
 
        $post_id = item_store($arr);
 
index 90fd2414b8af9bbd5a951f4a4a38bb0db2b3a062..60eafa865fcd25641c8e4b19e0151848ae95492e 100644 (file)
@@ -139,7 +139,6 @@ EOT;
        $arr['deny_gid'] = $item['deny_gid'];
        $arr['visible'] = 1;
        $arr['unseen'] = 1;
-       $arr['last-child'] = 1;
        $arr['origin'] = 1;
 
        $post_id = item_store($arr);
index 91a8ffdaf5d8691b5f046971885831ae3ab4e8c1..973098d460ae717d258458ae94235ec693818285 100644 (file)
@@ -1175,7 +1175,6 @@ class DBStructure {
                                                "deleted" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
                                                "origin" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
                                                "forum_mode" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => ""],
-                                               "last-child" => ["type" => "boolean", "not null" => "1", "default" => "1", "comment" => ""],
                                                "mention" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
                                                "network" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => ""],
                                                "rendered-hash" => ["type" => "varchar(32)", "not null" => "1", "default" => "", "comment" => ""],
index ab1074ac1dc67be2afa65b956c787b44372dbda9..c05b5b3d639d145ed39680d9ec5c5b27ac731427 100644 (file)
@@ -997,7 +997,7 @@ class DFRN
                // "comment-allow" is some old fashioned stuff for old Friendica versions.
                // It is included in the rewritten code for completeness
                if ($comment) {
-                       XML::addElement($doc, $entry, "dfrn:comment-allow", intval($item['last-child']));
+                       XML::addElement($doc, $entry, "dfrn:comment-allow", 1);
                }
 
                if ($item['location']) {
@@ -2117,23 +2117,6 @@ class DFRN
                                Worker::add(PRIORITY_HIGH, "Notifier", "comment-import", $current["id"]);
                        }
                }
-
-               // update last-child if it changes
-               if ($item["last-child"] && ($item["last-child"] != $current["last-child"])) {
-                       $r = q(
-                               "UPDATE `item` SET `last-child` = 0, `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` IN (0, %d)",
-                               dbesc(datetime_convert()),
-                               dbesc($item["parent-uri"]),
-                               intval($importer["importer_uid"])
-                       );
-                       $r = q(
-                               "UPDATE `item` SET `last-child` = %d , `changed` = '%s' WHERE `uri` = '%s' AND `uid` IN (0, %d)",
-                               intval($item["last-child"]),
-                               dbesc(datetime_convert()),
-                               dbesc($item["uri"]),
-                               intval($importer["importer_uid"])
-                       );
-               }
                return $changed;
        }
 
@@ -2459,7 +2442,7 @@ class DFRN
                $item["edited"] = $xpath->query("atom:updated/text()", $entry)->item(0)->nodeValue;
 
                $current = q(
-                       "SELECT `id`, `uid`, `last-child`, `edited`, `body` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
+                       "SELECT `id`, `uid`, `edited`, `body` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
                        dbesc($item["uri"]),
                        intval($importer["importer_uid"])
                );
@@ -2523,7 +2506,6 @@ class DFRN
                // We don't need the content element since "dfrn:env" is always present
                //$item["body"] = $xpath->query("atom:content/text()", $entry)->item(0)->nodeValue;
 
-               $item["last-child"] = $xpath->query("dfrn:comment-allow/text()", $entry)->item(0)->nodeValue;
                $item["location"] = $xpath->query("dfrn:location/text()", $entry)->item(0)->nodeValue;
 
                $georsspoint = $xpath->query("georss:point", $entry);
@@ -2747,22 +2729,6 @@ class DFRN
                                        $parent_uri = $r[0]["parent-uri"];
                                }
 
-                               if (!$is_like) {
-                                       $r1 = q(
-                                               "UPDATE `item` SET `last-child` = 0, `changed` = '%s' WHERE `uid` = %d AND `parent` = %d",
-                                               dbesc(datetime_convert()),
-                                               intval($importer["importer_uid"]),
-                                               intval($r[0]["parent"])
-                                       );
-
-                                       $r2 = q(
-                                               "UPDATE `item` SET `last-child` = 1, `changed` = '%s' WHERE `uid` = %d AND `id` = %d",
-                                               dbesc(datetime_convert()),
-                                               intval($importer["importer_uid"]),
-                                               intval($posted_id)
-                                       );
-                               }
-
                                if ($posted_id && $parent && ($entrytype == DFRN_REPLY_RC)) {
                                        logger("Notifying followers about comment ".$posted_id, LOGGER_DEBUG);
                                        Worker::add(PRIORITY_HIGH, "Notifier", "comment-import", $posted_id);
@@ -2928,28 +2894,7 @@ class DFRN
                                create_tags_from_itemuri($uri, $importer["uid"]);
                                Term::createFromItemURI($uri, $importer["uid"]);
                                update_thread_uri($uri, $importer["importer_uid"]);
-                               if ($item["last-child"]) {
-                                       // ensure that last-child is set in case the comment that had it just got wiped.
-                                       q(
-                                               "UPDATE `item` SET `last-child` = 0, `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` IN (0, %d)",
-                                               dbesc(datetime_convert()),
-                                               dbesc($item["parent-uri"]),
-                                               intval($item["uid"])
-                                       );
-                                       // who is the last child now?
-                                       $r = q(
-                                               "SELECT `id` FROM `item` WHERE `parent-uri` = '%s' AND `type` != 'activity' AND `deleted` = 0 AND `moderated` = 0 AND `uid` = %d
-                                               ORDER BY `created` DESC LIMIT 1",
-                                               dbesc($item["parent-uri"]),
-                                               intval($importer["uid"])
-                                       );
-                                       if (DBM::is_result($r)) {
-                                               q(
-                                                       "UPDATE `item` SET `last-child` = 1 WHERE `id` = %d",
-                                                       intval($r[0]["id"])
-                                               );
-                                       }
-                               }
+
                                // if this is a relayed delete, propagate it to other recipients
 
                                if ($entrytype == DFRN_REPLY_RC) {
index 350fd4eb5b5078dce0f633f9d87a0d885cd7b515..9d42d32124df925e5f235fec046290d9c4d7815e 100644 (file)
@@ -2409,8 +2409,6 @@ class Diaspora
 
                                $arr["object"] = self::constructNewFriendObject($contact);
 
-                               $arr["last-child"] = 1;
-
                                $user = dba::selectFirst('user', ['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid'], ['uid' => $importer["uid"]]);
 
                                $arr["allow_cid"] = $user["allow_cid"];
index b629c4ecb9b934e7cdbb71b9b0709e7955b23482..dc4548b3ead97d9635e7d1b951ba778fb5252ae3 100644 (file)
@@ -198,11 +198,6 @@ class Feed {
 
                $header["contact-id"] = $contact["id"];
 
-               if (!strlen($contact["notify"])) {
-                       // one way feed - no remote comment ability
-                       $header["last-child"] = 0;
-               }
-
                if (!is_object($entries)) {
                        logger("There are no entries in this feed.", LOGGER_DEBUG);
                        return;
index 3c7df172ab7171530044b7bae605fa7ec101c72e..293cd265e26038be91332ee0896694f3580ce1fc 100644 (file)
@@ -531,11 +531,6 @@ class OnePoll
 
                                                        $stored_item = item_store($datarray);
 
-                                                       $condition = ['parent-uri' => $datarray['parent-uri'], 'uid' => $importer_uid];
-                                                       dba::update('item', ['last-child' => false], $condition);
-
-                                                       dba::update('item', ['last-child' => true], ['id' => $stored_item]);
-
                                                        switch ($mailconf['action']) {
                                                                case 0:
                                                                        logger("Mail: Seen before ".$msg_uid." for ".$mailconf['user'].". Doing nothing.", LOGGER_DEBUG);