Some easy to replace "q" calls have been replaced by "DBA" calls (#5632)

* Some easy to replace "q" calls have been replaced by "DBA" calls

* Simplified the GUID creation

* And one in the API ...

* And OStatus has got some DBA calls more

* Just some more replaced database calls

* The event query is now simplified

* Events are now shown again

* subthread is now using the DBA calls as well

* Some more replaced database calls

* And some more replaced database calls and prevented notices

* Better use gravity

* Some more replaced database stuff

* Some more replaced database calls in DFRN.php

* The gcontact class now has got the new DBA functions as well

* The Contact class is now changed to new database functions as well

* Small correction

* We can now delete without cascade

* One more functionality is safe for future changes
This commit is contained in:
Michael Vogel 2018-08-19 14:46:11 +02:00 committed by Hypolite Petovan
parent dfe4413463
commit 7f3fb34c24
21 changed files with 275 additions and 501 deletions

View file

@ -1597,12 +1597,9 @@ class OStatus
}
if (!DBA::isResult($r)) {
$r = q(
"SELECT * FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
DBA::escape(normalise_link($url))
);
$gcontact = DBA::selectFirst('gcontact', [], ['nurl' => normalise_link($url)]);
if (DBA::isResult($r)) {
$contact = $r[0];
$contact = $gcontact;
$contact["uid"] = -1;
$contact["success_update"] = $contact["updated"];
}
@ -1803,14 +1800,11 @@ class OStatus
$item['follow'] = $contact['alias'];
}
$r = q(
"SELECT `id` FROM `contact` WHERE `uid` = %d AND `nurl` = '%s'",
intval($owner['uid']),
DBA::escape(normalise_link($contact["url"]))
);
$condition = ['uid' => $owner['uid'], 'nurl' => normalise_link($contact["url"])];
$user_contact = DBA::selectFirst('contact', ['id'], $condition);
if (DBA::isResult($r)) {
$connect_id = $r[0]['id'];
if (DBA::isResult($user_contact)) {
$connect_id = $user_contact['id'];
} else {
$connect_id = 0;
}