]> git.mxchange.org Git - friendica.git/blobdiff - include/items.php
Use a 10 minute timeout for high priority processes. This may be better.
[friendica.git] / include / items.php
index 203b7d0eee6755d0699d8261e3d2da2dedae7d46..6d2c830f96ba8cf4a2c9ea63e59e1313371a7915 100644 (file)
@@ -584,6 +584,12 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
                                                                 "photo" => $arr['author-avatar'], "name" => $arr['author-name']));
        }
 
+       if ($arr["author-id"] == 0)
+               $arr["author-id"] = get_contact($arr["author-link"], 0);
+
+       if ($arr["owner-id"] == 0)
+               $arr["owner-id"] = get_contact($arr["owner-link"], 0);
+
        if ($arr['guid'] != "") {
                // Checking if there is already an item with the same guid
                logger('checking for an item for user '.$arr['uid'].' on network '.$arr['network'].' with the guid '.$arr['guid'], LOGGER_DEBUG);
@@ -911,7 +917,7 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
        check_item_notification($current_post, $uid);
 
        if ($notify)
-               proc_run('php', "include/notifier.php", $notify_type, $current_post);
+               proc_run(PRIORITY_HIGH, "include/notifier.php", $notify_type, $current_post);
 
        return $current_post;
 }
@@ -1150,7 +1156,7 @@ function tag_deliver($uid,$item_id) {
        );
        update_thread($item_id);
 
-       proc_run('php','include/notifier.php','tgroup',$item_id);
+       proc_run(PRIORITY_HIGH,'include/notifier.php', 'tgroup', $item_id);
 
 }
 
@@ -1398,16 +1404,8 @@ function new_follower($importer,$contact,$datarray,$item,$sharing = false) {
                                dbesc($url)
                );
                if(count($r)) {
-                               $contact_record = $r[0];
-
-                               $photos = import_profile_photo($photo,$importer["uid"],$contact_record["id"]);
-
-                               q("UPDATE `contact` SET `photo` = '%s', `thumb` = '%s', `micro` = '%s' WHERE `id` = %d",
-                                       dbesc($photos[0]),
-                                       dbesc($photos[1]),
-                                       dbesc($photos[2]),
-                                       intval($contact_record["id"])
-                               );
+                       $contact_record = $r[0];
+                       update_contact_avatar($photo, $importer["uid"], $contact_record["id"], true);
                }
 
 
@@ -1714,7 +1712,7 @@ function item_expire($uid, $days, $network = "", $force = false) {
        } else
                $range = "AND `created` < UTC_TIMESTAMP() - INTERVAL %d DAY ";
 
-       $r = q("SELECT * FROM `item`
+       $r = q("SELECT `file`, `resource-id`, `starred`, `type`, `id` FROM `item`
                WHERE `uid` = %d $range
                AND `id` = `parent`
                $sql_extra
@@ -1765,7 +1763,7 @@ function item_expire($uid, $days, $network = "", $force = false) {
                drop_item($item['id'],false);
        }
 
-       proc_run('php',"include/notifier.php","expire","$uid");
+       proc_run(PRIORITY_HIGH,"include/notifier.php", "expire", $uid);
 
 }
 
@@ -1787,7 +1785,7 @@ function drop_items($items) {
        // multiple threads may have been deleted, send an expire notification
 
        if($uid)
-               proc_run('php',"include/notifier.php","expire","$uid");
+               proc_run(PRIORITY_HIGH,"include/notifier.php", "expire", $uid);
 }
 
 
@@ -2000,7 +1998,7 @@ function drop_item($id,$interactive = true) {
 
                // send the notification upstream/downstream as the case may be
 
-               proc_run('php',"include/notifier.php","drop","$drop_id");
+               proc_run(PRIORITY_HIGH,"include/notifier.php", "drop", $drop_id);
 
                if(! $interactive)
                        return $owner;