Some speed improvements
authorMichael <heluecht@pirati.ca>
Sun, 15 Jan 2017 12:23:40 +0000 (12:23 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 15 Jan 2017 12:23:40 +0000 (12:23 +0000)
gpluspost/gpluspost.php
jappixmini/jappixmini.php
pumpio/pumpio.php

index 43a1635e3800715a4279de110a6dad539d2b4270..a3ed1f9cdf2c4b525f59ee6b64524ba0311d9b2a 100644 (file)
@@ -434,7 +434,7 @@ function gpluspost_init() {
                foreach ($items AS $item)
                        gpluspost_feeditem($item, $uid);
        } else {
-               $items = q("SELECT `id` FROM `item` FORCE INDEX (`received`) WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0 AND `item`.`allow_cid` = ''  AND `item`.`allow_gid` = '' AND `item`.`deny_cid`  = '' AND `item`.`deny_gid`  = '' AND `item`.`private` = 0 AND `item`.`wall` = 1 AND `item`.`id` = `item`.`parent` ORDER BY `received` DESC LIMIT 10");
+               $items = q("SELECT `id` FROM `item` WHERE `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0 AND `item`.`allow_cid` = ''  AND `item`.`allow_gid` = '' AND `item`.`deny_cid`  = '' AND `item`.`deny_gid`  = '' AND `item`.`private` = 0 AND `item`.`wall` = 1 AND `item`.`id` = `item`.`parent` ORDER BY `received` DESC LIMIT 10");
                foreach ($items AS $item)
                        gpluspost_feeditem($item["id"], $uid);
        }
index 08d821128db7c34d3ce0507d2db4c40566ebf593..44b69a4e5843bcd43a2b26ef17a8dd2822474159 100644 (file)
@@ -550,7 +550,8 @@ function jappixmini_cron(&$a, $d) {
                $uid = $row["uid"];
 
                // for each user, go through list of contacts
-               $contacts = q("SELECT * FROM `contact` WHERE `uid`=%d AND ((LENGTH(`dfrn-id`) AND LENGTH(`pubkey`)) OR (LENGTH(`issued-id`) AND LENGTH(`prvkey`)))", intval($uid));
+               $contacts = q("SELECT * FROM `contact` WHERE `uid`=%d AND ((LENGTH(`dfrn-id`) AND LENGTH(`pubkey`)) OR (LENGTH(`issued-id`) AND LENGTH(`prvkey`))) AND `network` = '%s'",
+                       intval($uid), dbesc(NETWORK_DFRN));
                foreach ($contacts as $contact_row) {
                        $request = $contact_row["request"];
                        if (!$request) continue;
index 1b3c587f93a9f560b2db7deb04946435dd5d4bb7..69dd5d3140af47f72493be64b502b6352f1f4ef5 100644 (file)
@@ -864,6 +864,11 @@ function pumpio_dounlike(&$a, $uid, $self, $post, $own_id) {
 function pumpio_dolike(&$a, $uid, $self, $post, $own_id, $threadcompletion = true) {
        require_once('include/items.php');
 
+       if ($post->object->id == "") {
+               logger('Got empty like: '.print_r($post, true), LOGGER_DEBUG);
+               return;
+       }
+
        // Searching for the liked post
        // Two queries for speed issues
        $r = q("SELECT * FROM `item` WHERE `uri` = '%s' AND `uid` = %d AND `network` = '%s' LIMIT 1",
@@ -899,8 +904,8 @@ function pumpio_dolike(&$a, $uid, $self, $post, $own_id, $threadcompletion = tru
                $post->actor->url = $self[0]['url'];
                $post->actor->image->url = $self[0]['photo'];
        } else {
-               $r = q("SELECT * FROM `contact` WHERE `url` = '%s' AND `uid` = %d AND `blocked` = 0 AND `readonly` = 0 LIMIT 1",
-                       dbesc($post->actor->url),
+               $r = q("SELECT * FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d AND `blocked` = 0 AND `readonly` = 0 LIMIT 1",
+                       dbesc(normalise_link($post->actor->url)),
                        intval($uid)
                );