More "q" calls have been replaced
This commit is contained in:
parent
3634009c0a
commit
763e264196
10 changed files with 105 additions and 222 deletions
|
|
@ -121,14 +121,9 @@ class FContact
|
|||
{
|
||||
Logger::info('fcontact', ['guid' => $fcontact_guid]);
|
||||
|
||||
$r = q(
|
||||
"SELECT `url` FROM `fcontact` WHERE `url` != '' AND `network` = '%s' AND `guid` = '%s'",
|
||||
DBA::escape(Protocol::DIASPORA),
|
||||
DBA::escape($fcontact_guid)
|
||||
);
|
||||
|
||||
if (DBA::isResult($r)) {
|
||||
return $r[0]['url'];
|
||||
$fcontact = DBA::selectFirst('fcontact', ['url'], ["`url` != ? AND `network` = ? AND `guid` = ?", '', Protocol::DIASPORA, $fcontact_guid]);
|
||||
if (DBA::isResult($fcontact)) {
|
||||
return $fcontact['url'];
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
@ -176,7 +171,7 @@ class FContact
|
|||
$suggest['body'] = $note;
|
||||
|
||||
$hash = Strings::getRandomHex();
|
||||
$fields = ['uid' => $suggest['uid'], 'fid' => $fid, 'contact-id' => $suggest['cid'],
|
||||
$fields = ['uid' => $suggest['uid'], 'fid' => $fid, 'contact-id' => $suggest['cid'],
|
||||
'note' => $suggest['body'], 'hash' => $hash, 'datetime' => DateTimeFormat::utcNow(), 'blocked' => false];
|
||||
DBA::insert('intro', $fields);
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ use Friendica\Model\Item;
|
|||
use Friendica\Model\ItemURI;
|
||||
use Friendica\Model\Mail;
|
||||
use Friendica\Model\Notification;
|
||||
use Friendica\Model\Photo;
|
||||
use Friendica\Model\Post;
|
||||
use Friendica\Model\Profile;
|
||||
use Friendica\Model\Tag;
|
||||
|
|
@ -299,15 +300,12 @@ class DFRN
|
|||
DI::config()->set('system', 'site_pubkey', $res['pubkey']);
|
||||
}
|
||||
|
||||
$rp = q(
|
||||
"SELECT `resource-id` , `scale`, type FROM `photo`
|
||||
WHERE `profile` = 1 AND `uid` = %d ORDER BY scale;",
|
||||
$uid
|
||||
);
|
||||
$profilephotos = Photo::selectToArray(['resource-id' , 'scale'], ['profile' => true, 'uid' => $uid], ['order' => ['scale']]);
|
||||
|
||||
$photos = [];
|
||||
$ext = Images::supportedTypes();
|
||||
|
||||
foreach ($rp as $p) {
|
||||
foreach ($profilephotos as $p) {
|
||||
$photos[$p['scale']] = DI::baseUrl().'/photo/'.$p['resource-id'].'-'.$p['scale'].'.'.$ext[$p['type']];
|
||||
}
|
||||
|
||||
|
|
@ -1379,19 +1377,13 @@ class DFRN
|
|||
}
|
||||
|
||||
// update contact
|
||||
$r = q(
|
||||
"SELECT `photo`, `url` FROM `contact` WHERE `id` = %d AND `uid` = %d",
|
||||
intval($importer["id"]),
|
||||
intval($importer["importer_uid"])
|
||||
);
|
||||
$old = Contact::selectFirst(['photo', 'url'], ['id' => $importer["id"], 'uid' => $importer["importer_uid"]]);
|
||||
|
||||
if (!DBA::isResult($r)) {
|
||||
Logger::log("Query failed to execute, no result returned in " . __FUNCTION__);
|
||||
if (!DBA::isResult($old)) {
|
||||
Logger::notice("Query failed to execute, no result returned in " . __FUNCTION__);
|
||||
return false;
|
||||
}
|
||||
|
||||
$old = $r[0];
|
||||
|
||||
// Update the contact table. We try to find every entry.
|
||||
$fields = ['name' => $relocate["name"], 'avatar' => $relocate["avatar"],
|
||||
'url' => $relocate["url"], 'nurl' => Strings::normaliseLink($relocate["url"]),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue