]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #1511 from annando/1504-contact-last-item
authorTobias Diekershoff <tobias.diekershoff@gmx.net>
Sun, 12 Apr 2015 13:09:47 +0000 (15:09 +0200)
committerTobias Diekershoff <tobias.diekershoff@gmx.net>
Sun, 12 Apr 2015 13:09:47 +0000 (15:09 +0200)
New field in the contact table to better detect "dead profiles"

boot.php
database.sql
include/dbstructure.php
include/items.php
update.php

index cb380ed99591932f7b22ec563d2eaf88ac8cac2f..5e0a70db1f748ee625b76cd2ff5195f18960fc68 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -18,7 +18,7 @@ define ( 'FRIENDICA_PLATFORM',     'Friendica');
 define ( 'FRIENDICA_CODENAME',     'Lily of the valley');
 define ( 'FRIENDICA_VERSION',      '3.4.0' );
 define ( 'DFRN_PROTOCOL_VERSION',  '2.23'    );
-define ( 'DB_UPDATE_VERSION',      1182      );
+define ( 'DB_UPDATE_VERSION',      1183      );
 define ( 'EOL',                    "<br />\r\n"     );
 define ( 'ATOM_TIME',              'Y-m-d\TH:i:s\Z' );
 
index 8babeb4d4f532c4bf31860a4a6345cc3077d5ac1..ab597825cd2ca653a228da81700258935c1ca705 100644 (file)
@@ -1,6 +1,6 @@
 -- ------------------------------------------
--- Friendica 3.4.0 (Ginger)
--- DB_UPDATE_VERSION 1182
+-- Friendica 3.4.0 (Lily of the valley)
+-- DB_UPDATE_VERSION 1183
 -- ------------------------------------------
 
 
@@ -140,6 +140,7 @@ CREATE TABLE IF NOT EXISTS `contact` (
        `uri-date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
        `avatar-date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
        `term-date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
+       `last-item` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
        `priority` tinyint(3) NOT NULL DEFAULT 0,
        `blocked` tinyint(1) NOT NULL DEFAULT 1,
        `readonly` tinyint(1) NOT NULL DEFAULT 0,
index f131abe64f13b489621c85114536ce3b3f6524cd..d25834edff801bae2b81a6bf98c7519073cc0084 100644 (file)
@@ -453,6 +453,7 @@ function db_definition() {
                                        "uri-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
                                        "avatar-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
                                        "term-date" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
+                                       "last-item" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
                                        "priority" => array("type" => "tinyint(3)", "not null" => "1", "default" => "0"),
                                        "blocked" => array("type" => "tinyint(1)", "not null" => "1", "default" => "1"),
                                        "readonly" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0"),
index 3832b80b318f30f51a0f8b716d87c752f65ac855..8a0deb437b041582bc2846592089e24dbfd40c06 100644 (file)
@@ -1391,12 +1391,24 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
                $current_post = $r[0]['id'];
                logger('item_store: created item ' . $current_post);
 
-               // Set "success_update" to the date of the last time we heard from this contact
-               // This can be used to filter for inactive contacts and poco.
+               // Set "success_update" and "last-item" to the date of the last time we heard from this contact
+               // This can be used to filter for inactive contacts.
                // Only do this for public postings to avoid privacy problems, since poco data is public.
                // Don't set this value if it isn't from the owner (could be an author that we don't know)
-               if (!$arr['private'] AND (($arr["author-link"] === $arr["owner-link"]) OR ($arr["parent-uri"] === $arr["uri"])))
-                       q("UPDATE `contact` SET `success_update` = '%s' WHERE `id` = %d",
+
+               $update = (!$arr['private'] AND (($arr["author-link"] === $arr["owner-link"]) OR ($arr["parent-uri"] === $arr["uri"])));
+
+               // Is it a forum? Then we don't care about the rules from above
+               if (!$update AND ($arr["network"] == NETWORK_DFRN) AND ($arr["parent-uri"] === $arr["uri"])) {
+                       $isforum = q("SELECT `forum` FROM `contact` WHERE `id` = %d AND `forum`",
+                                       intval($arr['contact-id']));
+                       if ($isforum)
+                               $update = true;
+               }
+
+               if ($update)
+                       q("UPDATE `contact` SET `success_update` = '%s', `last-item` = '%s' WHERE `id` = %d",
+                               dbesc($arr['received']),
                                dbesc($arr['received']),
                                intval($arr['contact-id'])
                        );
index 5b0b4cd25117de503a10529e88c9a0714deaa460..35aaff2c064eec7a9ed0cdb20e748ffb51dc63b1 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-define( 'UPDATE_VERSION' , 1182 );
+define( 'UPDATE_VERSION' , 1183 );
 
 /**
  *