Replace old database queries with the new ones

This commit is contained in:
Michael 2018-05-02 19:26:15 +00:00
parent 8f9757aba5
commit 4ad655ab80
12 changed files with 42 additions and 181 deletions

View file

@ -239,10 +239,8 @@ class GContact
if ($alternate && ($gcontact['network'] == NETWORK_OSTATUS)) {
// Delete the old entry - if it exists
$r = q("SELECT `id` FROM `gcontact` WHERE `nurl` = '%s'", dbesc(normalise_link($orig_profile)));
if (DBM::is_result($r)) {
q("DELETE FROM `gcontact` WHERE `nurl` = '%s'", dbesc(normalise_link($orig_profile)));
q("DELETE FROM `glink` WHERE `gcid` = %d", intval($r[0]["id"]));
if (dba::exists('item', ['nurl' => normalise_link($orig_profile)])) {
dba::delete('gcontact', ['nurl' => normalise_link($orig_profile)]);
}
}
}

View file

@ -29,8 +29,7 @@ class Term
}
// Clean up all tags
dba::e("DELETE FROM `term` WHERE `otype` = ? AND `oid` = ? AND `type` IN (?, ?)",
TERM_OBJ_POST, $itemid, TERM_HASHTAG, TERM_MENTION);
dba::delete('term', ['otype' => TERM_OBJ_POST, 'oid' => $itemid, 'type' => [TERM_HASHTAG, TERM_MENTION]]);
if ($message['deleted']) {
return;
@ -135,11 +134,7 @@ class Term
}
// Clean up all tags
q("DELETE FROM `term` WHERE `otype` = %d AND `oid` = %d AND `type` IN (%d, %d)",
intval(TERM_OBJ_POST),
intval($itemid),
intval(TERM_FILE),
intval(TERM_CATEGORY));
dba::delete('term', ['otype' => TERM_OBJ_POST, 'oid' => $itemid, 'type' => [TERM_FILE, TERM_CATEGORY]]);
if ($message["deleted"]) {
return;