mirror of
https://github.com/friendica/friendica
synced 2025-04-25 14:30:10 +00:00
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:
parent
dfe4413463
commit
7f3fb34c24
21 changed files with 275 additions and 501 deletions
|
@ -288,25 +288,30 @@ function consume_feed($xml, array $importer, array $contact, &$hub, $datedir = 0
|
|||
|
||||
function subscribe_to_hub($url, array $importer, array $contact, $hubmode = 'subscribe')
|
||||
{
|
||||
$a = BaseObject::getApp();
|
||||
$r = null;
|
||||
|
||||
if (!empty($importer)) {
|
||||
$r = q("SELECT `nickname` FROM `user` WHERE `uid` = %d LIMIT 1",
|
||||
intval($importer['uid'])
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
* Diaspora has different message-ids in feeds than they do
|
||||
* through the direct Diaspora protocol. If we try and use
|
||||
* the feed, we'll get duplicates. So don't.
|
||||
*/
|
||||
if ((!DBA::isResult($r)) || $contact['network'] === Protocol::DIASPORA) {
|
||||
if ($contact['network'] === Protocol::DIASPORA) {
|
||||
return;
|
||||
}
|
||||
|
||||
$push_url = System::baseUrl() . '/pubsub/' . $r[0]['nickname'] . '/' . $contact['id'];
|
||||
// Without an importer we don't have a user id - so we quit
|
||||
if (empty($importer)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$a = BaseObject::getApp();
|
||||
|
||||
$user = DBA::selectFirst('user', ['nickname'], ['uid' => $importer['uid']]);
|
||||
|
||||
// No user, no nickname, we quit
|
||||
if (!DBA::isResult($user)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$push_url = System::baseUrl() . '/pubsub/' . $user['nickname'] . '/' . $contact['id'];
|
||||
|
||||
// Use a single verify token, even if multiple hubs
|
||||
$verify_token = ((strlen($contact['hub-verify'])) ? $contact['hub-verify'] : random_string());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue