]> git.mxchange.org Git - friendica-addons.git/blobdiff - fbsync/fbsync.php
Merge pull request #384 from annando/1609-ignorelist-rendertime
[friendica-addons.git] / fbsync / fbsync.php
index 39931d5b42d44acb7225874d875196eaf54085b2..5a429ad81137c309be06d0c09789ddc5be0930a6 100644 (file)
@@ -4,6 +4,7 @@
  * Description: Synchronizes the Facebook Newsfeed
  * Version: 1.0
  * Author: Michael Vogel <https://pirati.ca/profile/heluecht>
+ * Status: Unsupported
  */
 
 /* To-Do
@@ -172,9 +173,24 @@ function fbsync_cron($a,$b) {
        }
        logger('fbsync_cron: cron_start');
 
+       $abandon_days = intval(get_config('system','account_abandon_days'));
+       if ($abandon_days < 1)
+               $abandon_days = 0;
+
+       $abandon_limit = date("Y-m-d H:i:s", time() - $abandon_days * 86400);
+
        $r = q("SELECT * FROM `pconfig` WHERE `cat` = 'fbsync' AND `k` = 'sync' AND `v` = '1' ORDER BY RAND()");
        if(count($r)) {
                foreach($r as $rr) {
+
+                       if ($abandon_days != 0) {
+                               $user = q("SELECT `login_date` FROM `user` WHERE uid=%d AND `login_date` >= '%s'", $rr['uid'], $abandon_limit);
+                               if (!count($user)) {
+                                       logger('abandoned account: timeline from user '.$rr['uid'].' will not be imported');
+                                       continue;
+                               }
+                       }
+
                        fbsync_get_self($rr['uid']);
 
                        logger('fbsync_cron: importing timeline from user '.$rr['uid']);
@@ -600,6 +616,8 @@ function fbsync_createcomment($a, $uid, $self_id, $self, $user, $contacts, $appl
                return;
 
        $item = item_store($postarray);
+       $postarray["id"] = $item;
+
        logger('fbsync_createcomment: UID '.$uid.' - CID '.$postarray['contact-id'].' - Nick '.$contact_nick.' posted comment '.$item, LOGGER_DEBUG);
 
        if ($item == 0)