slightly more memory efficient way to drop posts of removed connections
This commit is contained in:
parent
7e736c5359
commit
eedfb7de32
@ -373,23 +373,24 @@ function contact_remove($channel_id, $abook_id) {
|
|||||||
if(intval($abook['abook_self']))
|
if(intval($abook['abook_self']))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
||||||
$r = q("select id from item where (owner_xchan = '%s' or author_xchan = '%s') and uid = %d and item_retained = 0 and item_starred = 0",
|
$r = q("select id from item where (owner_xchan = '%s' or author_xchan = '%s') and uid = %d and item_retained = 0 and item_starred = 0",
|
||||||
dbesc($abook['abook_xchan']),
|
dbesc($abook['abook_xchan']),
|
||||||
dbesc($abook['abook_xchan']),
|
dbesc($abook['abook_xchan']),
|
||||||
intval($channel_id)
|
intval($channel_id)
|
||||||
);
|
);
|
||||||
if($r) {
|
if($r) {
|
||||||
$r = fetch_post_tags($r,true);
|
|
||||||
|
|
||||||
foreach($r as $rr) {
|
foreach($r as $rr) {
|
||||||
$terms = get_terms_oftype($item['term'],TERM_FILE);
|
$x = q("select uid from term where otype = %d and oid = %d ttype = %d limit 1",
|
||||||
if(! $terms) {
|
intval(TERM_OBJ_POST),
|
||||||
drop_item($rr['id'],false);
|
intval($rr['id']),
|
||||||
|
intval(TERM_FILE)
|
||||||
|
);
|
||||||
|
if($x) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
drop_item($rr['id'],false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
q("delete from abook where abook_id = %d and abook_channel = %d",
|
q("delete from abook where abook_id = %d and abook_channel = %d",
|
||||||
intval($abook['abook_id']),
|
intval($abook['abook_id']),
|
||||||
|
Reference in New Issue
Block a user