Don't delete - but only mark as deleted
This commit is contained in:
parent
610f017b28
commit
7be49d9411
1 changed files with 15 additions and 19 deletions
|
@ -131,30 +131,26 @@ class Item
|
||||||
dba::delete('attach', ['id' => $matches[1], 'uid' => $item['uid']]);
|
dba::delete('attach', ['id' => $matches[1], 'uid' => $item['uid']]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// When it is our item we don't delete it here, since we have to send delete messages
|
// Set the item to "deleted"
|
||||||
if ($item['origin'] || $parent['origin']) {
|
dba::update('item', ['deleted' => true, 'title' => '', 'body' => '',
|
||||||
// Set the item to "deleted"
|
'edited' => datetime_convert(), 'changed' => datetime_convert()],
|
||||||
dba::update('item', ['deleted' => true, 'title' => '', 'body' => '',
|
['id' => $item['id']]);
|
||||||
'edited' => datetime_convert(), 'changed' => datetime_convert()],
|
|
||||||
['id' => $item['id']]);
|
|
||||||
|
|
||||||
create_tags_from_item($item['id']);
|
create_tags_from_item($item['id']);
|
||||||
Term::createFromItem($item['id']);
|
Term::createFromItem($item['id']);
|
||||||
delete_thread($item['id'], $item['parent-uri']);
|
delete_thread($item['id'], $item['parent-uri']);
|
||||||
|
|
||||||
// If it's the parent of a comment thread, kill all the kids
|
// If it's the parent of a comment thread, kill all the kids
|
||||||
if ($item['id'] == $item['parent']) {
|
if ($item['id'] == $item['parent']) {
|
||||||
$items = dba::select('item', ['id'], ['parent' => $item['parent']]);
|
$items = dba::select('item', ['id'], ['parent' => $item['parent']]);
|
||||||
while ($row = dba::fetch($items)) {
|
while ($row = dba::fetch($items)) {
|
||||||
self::delete($row['id'], $priority);
|
self::delete($row['id'], $priority);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// send the notification upstream/downstream
|
// send the notification upstream/downstream
|
||||||
|
if ($item['origin'] || $parent['origin']) {
|
||||||
Worker::add(['priority' => $priority, 'dont_fork' => true], "Notifier", "drop", intval($item['id']));
|
Worker::add(['priority' => $priority, 'dont_fork' => true], "Notifier", "drop", intval($item['id']));
|
||||||
} else {
|
|
||||||
// delete it immediately. All related children will be deleted as well.
|
|
||||||
dba::delete('item', ['id' => $item['id']]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue