From: Michael Date: Sun, 15 Jan 2017 12:23:40 +0000 (+0000) Subject: Some speed improvements X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=21605a52c975074df20710b23d72e553e067217a;p=friendica-addons.git Some speed improvements --- diff --git a/gpluspost/gpluspost.php b/gpluspost/gpluspost.php index 43a1635e..a3ed1f9c 100644 --- a/gpluspost/gpluspost.php +++ b/gpluspost/gpluspost.php @@ -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); } diff --git a/jappixmini/jappixmini.php b/jappixmini/jappixmini.php index 08d82112..44b69a4e 100644 --- a/jappixmini/jappixmini.php +++ b/jappixmini/jappixmini.php @@ -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; diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index 1b3c587f..69dd5d31 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -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) );