]> git.mxchange.org Git - friendica.git/commitdiff
Archive and unarchive contacts
authorMichael <heluecht@pirati.ca>
Mon, 4 Dec 2017 19:04:50 +0000 (19:04 +0000)
committerMichael <heluecht@pirati.ca>
Mon, 4 Dec 2017 19:04:50 +0000 (19:04 +0000)
include/items.php
src/Object/Contact.php

index 98149dea591e4fd3011d65718c24aadb6b5d6c1a..73a5ad9cc2d15b40419ffba6992a4e54b25b0d19 100644 (file)
@@ -1165,6 +1165,10 @@ function item_set_last_item($arr) {
        if ($update) {
                dba::update('contact', array('success_update' => $arr['received'], 'last-item' => $arr['received']),
                        array('id' => $arr['contact-id']));
+               $contact = dba::select('contact', [], ['id' => $arr['contact-id']], ['limit' => 1]);
+               if ($contact['term-date'] > NULL_DATE) {
+                        Contact::unmarkForArchival($contact);
+               }
        }
        // Now do the same for the system wide contacts with uid=0
        if (!$arr['private']) {
index 34519401cb168763dafd7dd23498920ac8a7b299..56204395ca4739b8d071e44a26b8665ec96d3347 100644 (file)
@@ -99,7 +99,7 @@ class Contact extends BaseObject
                if ($contact['archive']) {
                        return;
                }
-
+logger('Blubb-m: '.$contact['id'].' - '.System::callstack());
                if ($contact['term-date'] <= NULL_DATE) {
                        dba::update('contact', array('term-date' => datetime_convert()), array('id' => $contact['id']));
 
@@ -139,6 +139,7 @@ class Contact extends BaseObject
         */
        public static function unmarkForArchival(array $contact)
        {
+//logger('Blubb-m: '.$contact['id'].' - '.System::callstack());
                $condition = array('`id` = ? AND (`term-date` > ? OR `archive`)', $contact[`id`], NULL_DATE);
                $exists = dba::exists('contact', $condition);