logger('Contacts are updated.');
- // update items
- // This is an extreme performance killer
- Item::update(['owner-link' => $relocate["url"]], ['owner-link' => $old["url"], 'uid' => $importer["importer_uid"]]);
- Item::update(['author-link' => $relocate["url"]], ['author-link' => $old["url"], 'uid' => $importer["importer_uid"]]);
-
- logger('Items are updated.');
-
/// @TODO
/// merge with current record, current contents have priority
/// update record, set url-updated
) {
$is_like = true;
$item["type"] = "activity";
- $item["gravity"] = GRAVITY_LIKE;
+ $item["gravity"] = GRAVITY_ACTIVITY;
// only one like or dislike per person
// splitted into two queries for performance issues
- $condition = ['uid' => $item["uid"], 'author-id' => $item["author-id"],
+ $condition = ['uid' => $item["uid"], 'author-id' => $item["author-id"], 'gravity' => GRAVITY_ACTIVITY,
'verb' => $item["verb"], 'parent-uri' => $item["parent-uri"]];
- if (dba::exists('item', $condition)) {
+ if (Item::exists($condition)) {
return false;
}
- $condition = ['uid' => $item["uid"], 'author-id' => $item["author-id"],
+ $condition = ['uid' => $item["uid"], 'author-id' => $item["author-id"], 'gravity' => GRAVITY_ACTIVITY,
'verb' => $item["verb"], 'thr-parent' => $item["parent-uri"]];
- if (dba::exists('item', $condition)) {
+ if (Item::exists($condition)) {
return false;
}
} else {
$item["edited"] = $xpath->query("atom:updated/text()", $entry)->item(0)->nodeValue;
- $current = dba::selectFirst('item',
- ['id', 'uid', 'edited', 'body'],
+ $current = Item::selectFirst(['id', 'uid', 'edited', 'body'],
['uri' => $item["uri"], 'uid' => $importer["importer_uid"]]
);
// Is there an existing item?
return false;
}
- $condition = ["`uri` = ? AND `uid` = ? AND NOT `file` LIKE '%[%'", $uri, $importer["importer_uid"]];
- $item = dba::selectFirst('item', ['id', 'parent', 'contact-id'], $condition);
+ $condition = ['uri' => $uri, 'uid' => $importer["importer_uid"]];
+ $item = Item::selectFirst(['id', 'parent', 'contact-id', 'file'], $condition);
if (!DBM::is_result($item)) {
logger("Item with uri " . $uri . " for user " . $importer["importer_uid"] . " wasn't found.", LOGGER_DEBUG);
return;
}
+ if (strstr($item['file'], '[')) {
+ logger("Item with uri " . $uri . " for user " . $importer["importer_uid"] . " is filed. So it won't be deleted.", LOGGER_DEBUG);
+ return;
+ }
+
// When it is a starting post it has to belong to the person that wants to delete it
if (($item['id'] == $item['parent']) && ($item['contact-id'] != $importer["id"])) {
logger("Item with uri " . $uri . " don't belong to contact " . $importer["id"] . " - ignoring deletion.", LOGGER_DEBUG);
// Comments can be deleted by the thread owner or comment owner
if (($item['id'] != $item['parent']) && ($item['contact-id'] != $importer["id"])) {
$condition = ['id' => $item['parent'], 'contact-id' => $importer["id"]];
- if (!dba::exists('item', $condition)) {
+ if (!Item::exists($condition)) {
logger("Item with uri " . $uri . " wasn't found or mustn't be deleted by contact " . $importer["id"] . " - ignoring deletion.", LOGGER_DEBUG);
return;
}