Some speed improvements
This commit is contained in:
parent
7b24476b81
commit
21605a52c9
|
@ -434,7 +434,7 @@ function gpluspost_init() {
|
||||||
foreach ($items AS $item)
|
foreach ($items AS $item)
|
||||||
gpluspost_feeditem($item, $uid);
|
gpluspost_feeditem($item, $uid);
|
||||||
} else {
|
} 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)
|
foreach ($items AS $item)
|
||||||
gpluspost_feeditem($item["id"], $uid);
|
gpluspost_feeditem($item["id"], $uid);
|
||||||
}
|
}
|
||||||
|
|
|
@ -550,7 +550,8 @@ function jappixmini_cron(&$a, $d) {
|
||||||
$uid = $row["uid"];
|
$uid = $row["uid"];
|
||||||
|
|
||||||
// for each user, go through list of contacts
|
// 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) {
|
foreach ($contacts as $contact_row) {
|
||||||
$request = $contact_row["request"];
|
$request = $contact_row["request"];
|
||||||
if (!$request) continue;
|
if (!$request) continue;
|
||||||
|
|
|
@ -864,6 +864,11 @@ function pumpio_dounlike(&$a, $uid, $self, $post, $own_id) {
|
||||||
function pumpio_dolike(&$a, $uid, $self, $post, $own_id, $threadcompletion = true) {
|
function pumpio_dolike(&$a, $uid, $self, $post, $own_id, $threadcompletion = true) {
|
||||||
require_once('include/items.php');
|
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
|
// Searching for the liked post
|
||||||
// Two queries for speed issues
|
// Two queries for speed issues
|
||||||
$r = q("SELECT * FROM `item` WHERE `uri` = '%s' AND `uid` = %d AND `network` = '%s' LIMIT 1",
|
$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->url = $self[0]['url'];
|
||||||
$post->actor->image->url = $self[0]['photo'];
|
$post->actor->image->url = $self[0]['photo'];
|
||||||
} else {
|
} else {
|
||||||
$r = q("SELECT * FROM `contact` WHERE `url` = '%s' AND `uid` = %d AND `blocked` = 0 AND `readonly` = 0 LIMIT 1",
|
$r = q("SELECT * FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d AND `blocked` = 0 AND `readonly` = 0 LIMIT 1",
|
||||||
dbesc($post->actor->url),
|
dbesc(normalise_link($post->actor->url)),
|
||||||
intval($uid)
|
intval($uid)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user