aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSystem user; apache <apache@saturn.midworld.de>2023-09-15 15:28:13 +0200
committerMario <mario@mariovavti.com>2023-09-15 15:32:38 +0200
commit198070700c3f087b97e431ea64ae6845db8f4062 (patch)
tree95f30cd2cccd3174e7c11c7701b856c297835ceb
parentb628af2258225f029abada5bd71e064947d2c611 (diff)
downloadvolse-hubzilla-198070700c3f087b97e431ea64ae6845db8f4062.tar.gz
volse-hubzilla-198070700c3f087b97e431ea64ae6845db8f4062.tar.bz2
volse-hubzilla-198070700c3f087b97e431ea64ae6845db8f4062.zip
only select the required fields to prevent memory exhaustion on big result sets
(cherry picked from commit 3a01aa40d8f788c89f50f9893214f6591dac7bae)
-rw-r--r--include/items.php9
1 files changed, 6 insertions, 3 deletions
diff --git a/include/items.php b/include/items.php
index d88a676a1..57e5dbb96 100644
--- a/include/items.php
+++ b/include/items.php
@@ -3920,16 +3920,19 @@ function drop_item($id,$interactive = true,$stage = DROPITEM_NORMAL) {
$notify_id = intval($item['id']);
- $items = q("select * from item where parent = %d and uid = %d",
+ $items = q("select id, resource_id, uid, resource_type, mid from item where parent = %d and uid = %d",
intval($item['id']),
intval($item['uid'])
);
+
if($items) {
- foreach($items as $i)
+ foreach($items as $i) {
delete_item_lowlevel($i, $stage);
+ }
}
- else
+ else {
delete_item_lowlevel($item, $stage);
+ }
if(! $interactive)
return 1;