reduce the memory usage of the expire query dramatically.
This commit is contained in:
parent
581a3c5323
commit
3bee6543fb
@ -3282,19 +3282,21 @@ function item_expire($uid,$days) {
|
|||||||
|
|
||||||
$expire_limit = get_config('system','expire_limit');
|
$expire_limit = get_config('system','expire_limit');
|
||||||
if(! intval($expire_limit))
|
if(! intval($expire_limit))
|
||||||
$expire_limit = 2500;
|
$expire_limit = 5000;
|
||||||
|
|
||||||
$item_normal = item_normal();
|
$item_normal = item_normal();
|
||||||
|
|
||||||
$r = q("SELECT * FROM `item`
|
$r = q("SELECT id FROM item
|
||||||
WHERE `uid` = %d
|
WHERE uid = %d
|
||||||
AND `created` < %s - INTERVAL %s
|
AND created < %s - INTERVAL %s
|
||||||
AND `id` = `parent`
|
|
||||||
$sql_extra
|
|
||||||
AND item_retained = 0
|
AND item_retained = 0
|
||||||
$item_normal LIMIT $expire_limit ",
|
AND item_thread_top = 1
|
||||||
|
AND resource_type = ''
|
||||||
|
AND item_starred = 0
|
||||||
|
$sql_extra $item_normal LIMIT $expire_limit ",
|
||||||
intval($uid),
|
intval($uid),
|
||||||
db_utcnow(), db_quoteinterval(intval($days).' DAY')
|
db_utcnow(),
|
||||||
|
db_quoteinterval(intval($days).' DAY')
|
||||||
);
|
);
|
||||||
|
|
||||||
if(! $r)
|
if(! $r)
|
||||||
@ -3312,17 +3314,6 @@ function item_expire($uid,$days) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only expire posts, not photos and photo comments
|
|
||||||
|
|
||||||
if($item['resource_type'] === 'photo') {
|
|
||||||
retain_item($item['id']);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if(intval($item['item_starred'])) {
|
|
||||||
retain_item($item['id']);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
drop_item($item['id'],false);
|
drop_item($item['id'],false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user