New function to delete items for users

This commit is contained in:
Michael 2018-05-29 05:22:57 +00:00
parent deb015be12
commit 8329705eba
11 changed files with 53 additions and 55 deletions

View file

@ -2807,15 +2807,13 @@ class DFRN
}
}
$entrytype = self::getEntryType($importer, $item);
if (!$item["deleted"]) {
logger('deleting item '.$item["id"].' uri='.$uri, LOGGER_DEBUG);
} else {
if ($item["deleted"]) {
return;
}
Item::deleteById($item["id"]);
logger('deleting item '.$item["id"].' uri='.$uri, LOGGER_DEBUG);
Item::delete(['id' => $item["id"]]);
}
/**

View file

@ -2785,7 +2785,7 @@ class Diaspora
while ($item = dba::fetch($r)) {
// Fetch the parent item
$parent = dba::selectFirst('item', ['author-link', 'origin'], ['id' => $item["parent"]]);
$parent = dba::selectFirst('item', ['author-link'], ['id' => $item["parent"]]);
// Only delete it if the parent author really fits
if (!link_compare($parent["author-link"], $contact["url"]) && !link_compare($item["author-link"], $contact["url"])) {
@ -2793,7 +2793,7 @@ class Diaspora
continue;
}
Item::deleteById($item["id"]);
Item::delete(['id' => $item["id"]]);
logger("Deleted target ".$target_guid." (".$item["id"].") from user ".$item["uid"]." parent: ".$item["parent"], LOGGER_DEBUG);
}

View file

@ -537,13 +537,12 @@ class OStatus
private static function deleteNotice($item)
{
$condition = ['uid' => $item['uid'], 'author-link' => $item['author-link'], 'uri' => $item['uri']];
$deleted = dba::selectFirst('item', ['id', 'parent-uri'], $condition);
if (!DBM::is_result($deleted)) {
logger('Item from '.$item['author-link'].' with uri '.$item['uri'].' for user '.$item['uid']." wasn't found. We don't delete it. ");
if (!dba::exists('item', $condition)) {
logger('Item from '.$item['author-link'].' with uri '.$item['uri'].' for user '.$item['uid']." wasn't found. We don't delete it.");
return;
}
Item::deleteById($deleted["id"]);
Item::delete($condition);
logger('Deleted item with uri '.$item['uri'].' for user '.$item['uid']);
}