From bd791b95ac7a59140b66df0021d7a541677c7db6 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 9 Dec 2016 16:23:42 +0000 Subject: [PATCH] pump.io: Store the id, optimized SQL query --- pumpio/pumpio.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index f7786bee..1b3c587f 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -775,6 +775,10 @@ function pumpio_fetchtimeline(&$a, $uid) { $_REQUEST["profile_uid"] = $uid; $_REQUEST["source"] = "pump.io"; + if (isset($post->object->id)) { + $_REQUEST['message_id'] = NETWORK_PUMPIO.":".$post->object->id; + } + if ($post->object->displayName != "") $_REQUEST["title"] = html2bbcode($post->object->displayName); else @@ -1352,9 +1356,10 @@ function pumpio_fetchinbox(&$a, $uid) { $self = q("SELECT * FROM `contact` WHERE `self` = 1 AND `uid` = %d LIMIT 1", intval($uid)); - $lastitems = q("SELECT uri FROM `item` WHERE `network` = '%s' AND `uid` = %d AND - `extid` != '' AND `id` = `parent` - ORDER BY `commented` DESC LIMIT 10", + $lastitems = q("SELECT `uri` FROM `thread` + INNER JOIN `item` ON `item`.`id` = `thread`.`iid` + WHERE `thread`.`network` = '%s' AND `thread`.`uid` = %d AND `item`.`extid` != '' + ORDER BY `thread`.`commented` DESC LIMIT 10", dbesc(NETWORK_PUMPIO), intval($uid) );