SQL improvements. New parameter for a maximum amount of comments per thread
This commit is contained in:
parent
285584e8d6
commit
3b4a20f987
3 changed files with 75 additions and 33 deletions
|
@ -2108,11 +2108,20 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0)
|
|||
$datarray['type'] = 'activity';
|
||||
$datarray['gravity'] = GRAVITY_LIKE;
|
||||
// only one like or dislike per person
|
||||
$r = q("select id from item where uid = %d and `contact-id` = %d and verb ='%s' and deleted = 0 and (`parent-uri` = '%s' OR `thr-parent` = '%s') limit 1",
|
||||
// splitted into two queries for performance issues
|
||||
$r = q("select id from item where uid = %d and `contact-id` = %d and verb ='%s' and deleted = 0 and (`parent-uri` = '%s') limit 1",
|
||||
intval($datarray['uid']),
|
||||
intval($datarray['contact-id']),
|
||||
dbesc($datarray['verb']),
|
||||
dbesc($parent_uri)
|
||||
);
|
||||
if($r && count($r))
|
||||
continue;
|
||||
|
||||
$r = q("select id from item where uid = %d and `contact-id` = %d and verb ='%s' and deleted = 0 and (`thr-parent` = '%s') limit 1",
|
||||
intval($datarray['uid']),
|
||||
intval($datarray['contact-id']),
|
||||
dbesc($datarray['verb']),
|
||||
dbesc($parent_uri),
|
||||
dbesc($parent_uri)
|
||||
);
|
||||
if($r && count($r))
|
||||
|
@ -3009,11 +3018,21 @@ function local_delivery($importer,$data) {
|
|||
$datarray['gravity'] = GRAVITY_LIKE;
|
||||
$datarray['last-child'] = 0;
|
||||
// only one like or dislike per person
|
||||
$r = q("select id from item where uid = %d and `contact-id` = %d and verb = '%s' and (`thr-parent` = '%s' or `parent-uri` = '%s') and deleted = 0 limit 1",
|
||||
// splitted into two queries for performance issues
|
||||
$r = q("select id from item where uid = %d and `contact-id` = %d and verb = '%s' and (`parent-uri` = '%s') and deleted = 0 limit 1",
|
||||
intval($datarray['uid']),
|
||||
intval($datarray['contact-id']),
|
||||
dbesc($datarray['verb']),
|
||||
dbesc($datarray['parent-uri'])
|
||||
|
||||
);
|
||||
if($r && count($r))
|
||||
continue;
|
||||
|
||||
$r = q("select id from item where uid = %d and `contact-id` = %d and verb = '%s' and (`thr-parent` = '%s') and deleted = 0 limit 1",
|
||||
intval($datarray['uid']),
|
||||
intval($datarray['contact-id']),
|
||||
dbesc($datarray['verb']),
|
||||
dbesc($datarray['parent-uri']),
|
||||
dbesc($datarray['parent-uri'])
|
||||
|
||||
);
|
||||
|
@ -3181,11 +3200,20 @@ function local_delivery($importer,$data) {
|
|||
$datarray['type'] = 'activity';
|
||||
$datarray['gravity'] = GRAVITY_LIKE;
|
||||
// only one like or dislike per person
|
||||
$r = q("select id from item where uid = %d and `contact-id` = %d and verb ='%s' and deleted = 0 and (`parent-uri` = '%s' OR `thr-parent` = '%s') limit 1",
|
||||
// splitted into two queries for performance issues
|
||||
$r = q("select id from item where uid = %d and `contact-id` = %d and verb ='%s' and deleted = 0 and (`parent-uri` = '%s') limit 1",
|
||||
intval($datarray['uid']),
|
||||
intval($datarray['contact-id']),
|
||||
dbesc($datarray['verb']),
|
||||
dbesc($parent_uri)
|
||||
);
|
||||
if($r && count($r))
|
||||
continue;
|
||||
|
||||
$r = q("select id from item where uid = %d and `contact-id` = %d and verb ='%s' and deleted = 0 and (`thr-parent` = '%s') limit 1",
|
||||
intval($datarray['uid']),
|
||||
intval($datarray['contact-id']),
|
||||
dbesc($datarray['verb']),
|
||||
dbesc($parent_uri),
|
||||
dbesc($parent_uri)
|
||||
);
|
||||
if($r && count($r))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue