mirror of
https://github.com/friendica/friendica
synced 2025-04-19 11:10:10 +00:00
Rename selectOne to selectFirst
This commit is contained in:
parent
c7a7658316
commit
ae66bcaff3
51 changed files with 821 additions and 821 deletions
|
@ -103,7 +103,7 @@ class Contact extends BaseObject
|
|||
return true;
|
||||
}
|
||||
|
||||
$user = dba::selectOne('user', ['uid', 'username', 'nickname'], ['uid' => $uid]);
|
||||
$user = dba::selectFirst('user', ['uid', 'username', 'nickname'], ['uid' => $uid]);
|
||||
if (!DBM::is_result($user)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ class Contact extends BaseObject
|
|||
public static function remove($id)
|
||||
{
|
||||
// We want just to make sure that we don't delete our "self" contact
|
||||
$r = dba::selectOne('contact', ['uid'], ['id' => $id, 'self' => false]);
|
||||
$r = dba::selectFirst('contact', ['uid'], ['id' => $id, 'self' => false]);
|
||||
|
||||
if (!DBM::is_result($r) || !intval($r['uid'])) {
|
||||
return;
|
||||
|
@ -490,7 +490,7 @@ class Contact extends BaseObject
|
|||
return $menu;
|
||||
}
|
||||
|
||||
$r = dba::selectOne('contact', [], ['nurl' => $contact['nurl'], 'network' => $contact['network'], 'uid' => $uid]);
|
||||
$r = dba::selectFirst('contact', [], ['nurl' => $contact['nurl'], 'network' => $contact['network'], 'uid' => $uid]);
|
||||
if ($r) {
|
||||
return self::photoMenu($r, $uid);
|
||||
} else {
|
||||
|
@ -653,18 +653,18 @@ class Contact extends BaseObject
|
|||
|
||||
/// @todo Verify if we can't use Contact::getDetailsByUrl instead of the following
|
||||
// We first try the nurl (http://server.tld/nick), most common case
|
||||
$contact = dba::selectOne('contact', ['id', 'avatar-date'], ['nurl' => normalise_link($url), 'uid' => $uid]);
|
||||
$contact = dba::selectFirst('contact', ['id', 'avatar-date'], ['nurl' => normalise_link($url), 'uid' => $uid]);
|
||||
|
||||
// Then the addr (nick@server.tld)
|
||||
if (!DBM::is_result($contact)) {
|
||||
$contact = dba::selectOne('contact', ['id', 'avatar-date'], ['addr' => $url, 'uid' => $uid]);
|
||||
$contact = dba::selectFirst('contact', ['id', 'avatar-date'], ['addr' => $url, 'uid' => $uid]);
|
||||
}
|
||||
|
||||
// Then the alias (which could be anything)
|
||||
if (!DBM::is_result($contact)) {
|
||||
// The link could be provided as http although we stored it as https
|
||||
$ssl_url = str_replace('http://', 'https://', $url);
|
||||
$r = dba::selectOne('contact', ['id', 'avatar', 'avatar-date'], ['`alias` IN (?, ?, ?) AND `uid` = ?', $url, normalise_link($url), $ssl_url, $uid]);
|
||||
$r = dba::selectFirst('contact', ['id', 'avatar', 'avatar-date'], ['`alias` IN (?, ?, ?) AND `uid` = ?', $url, normalise_link($url), $ssl_url, $uid]);
|
||||
$contact = dba::fetch($r);
|
||||
dba::close($r);
|
||||
}
|
||||
|
@ -697,7 +697,7 @@ class Contact extends BaseObject
|
|||
}
|
||||
|
||||
// Get data from the gcontact table
|
||||
$gcontacts = dba::selectOne('gcontact', ['name', 'nick', 'url', 'photo', 'addr', 'alias', 'network'], ['nurl' => normalise_link($url)]);
|
||||
$gcontacts = dba::selectFirst('gcontact', ['name', 'nick', 'url', 'photo', 'addr', 'alias', 'network'], ['nurl' => normalise_link($url)]);
|
||||
if (!DBM::is_result($gcontacts)) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -735,7 +735,7 @@ class Contact extends BaseObject
|
|||
$contact_id = $contacts[0]["id"];
|
||||
|
||||
// Update the newly created contact from data in the gcontact table
|
||||
$gcontact = dba::selectOne('gcontact', ['location', 'about', 'keywords', 'gender'], ['nurl' => normalise_link($data["url"])]);
|
||||
$gcontact = dba::selectFirst('gcontact', ['location', 'about', 'keywords', 'gender'], ['nurl' => normalise_link($data["url"])]);
|
||||
if (DBM::is_result($gcontact)) {
|
||||
// Only use the information when the probing hadn't fetched these values
|
||||
if ($data['keywords'] != '') {
|
||||
|
@ -759,7 +759,7 @@ class Contact extends BaseObject
|
|||
self::updateAvatar($data["photo"], $uid, $contact_id);
|
||||
|
||||
$fields = ['url', 'nurl', 'addr', 'alias', 'name', 'nick', 'keywords', 'location', 'about', 'avatar-date', 'pubkey'];
|
||||
$contact = dba::selectOne('contact', $fields, ['id' => $contact_id]);
|
||||
$contact = dba::selectFirst('contact', $fields, ['id' => $contact_id]);
|
||||
|
||||
// This condition should always be true
|
||||
if (!DBM::is_result($contact)) {
|
||||
|
@ -817,7 +817,7 @@ class Contact extends BaseObject
|
|||
return false;
|
||||
}
|
||||
|
||||
$blocked = dba::selectOne('contact', ['blocked'], ['id' => $cid]);
|
||||
$blocked = dba::selectFirst('contact', ['blocked'], ['id' => $cid]);
|
||||
if (!DBM::is_result($blocked)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -837,7 +837,7 @@ class Contact extends BaseObject
|
|||
return false;
|
||||
}
|
||||
|
||||
$hidden = dba::selectOne('contact', ['hidden'], ['id' => $cid]);
|
||||
$hidden = dba::selectFirst('contact', ['hidden'], ['id' => $cid]);
|
||||
if (!DBM::is_result($hidden)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -980,7 +980,7 @@ class Contact extends BaseObject
|
|||
public static function updateAvatar($avatar, $uid, $cid, $force = false)
|
||||
{
|
||||
// Limit = 1 returns the row so no need for dba:inArray()
|
||||
$r = dba::selectOne('contact', ['avatar', 'photo', 'thumb', 'micro', 'nurl'], ['id' => $cid]);
|
||||
$r = dba::selectFirst('contact', ['avatar', 'photo', 'thumb', 'micro', 'nurl'], ['id' => $cid]);
|
||||
if (!DBM::is_result($r)) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -999,7 +999,7 @@ class Contact extends BaseObject
|
|||
|
||||
// Update the public contact (contact id = 0)
|
||||
if ($uid != 0) {
|
||||
$pcontact = dba::selectOne('contact', ['id'], ['nurl' => $r[0]['nurl']]);
|
||||
$pcontact = dba::selectFirst('contact', ['id'], ['nurl' => $r[0]['nurl']]);
|
||||
if (DBM::is_result($pcontact)) {
|
||||
self::updateAvatar($avatar, 0, $pcontact['id'], $force);
|
||||
}
|
||||
|
@ -1023,7 +1023,7 @@ class Contact extends BaseObject
|
|||
This will reliably kill your communication with Friendica contacts.
|
||||
*/
|
||||
|
||||
$r = dba::selectOne('contact', ['url', 'nurl', 'addr', 'alias', 'batch', 'notify', 'poll', 'poco', 'network'], ['id' => $id]);
|
||||
$r = dba::selectFirst('contact', ['url', 'nurl', 'addr', 'alias', 'batch', 'notify', 'poll', 'poco', 'network'], ['id' => $id]);
|
||||
if (!DBM::is_result($r)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1246,7 +1246,7 @@ class Contact extends BaseObject
|
|||
);
|
||||
}
|
||||
|
||||
$r = dba::selectOne('contact', ['url' => $ret['url'], 'network' => $ret['network'], 'uid' => $uid]);
|
||||
$r = dba::selectFirst('contact', ['url' => $ret['url'], 'network' => $ret['network'], 'uid' => $uid]);
|
||||
|
||||
if (!DBM::is_result($r)) {
|
||||
$result['message'] .= t('Unable to retrieve contact information.') . EOL;
|
||||
|
|
|
@ -888,7 +888,7 @@ class GContact
|
|||
'network', 'bd', 'gender',
|
||||
'keywords', 'alias', 'contact-type',
|
||||
'url', 'location', 'about');
|
||||
$old_contact = dba::selectOne('contact', $fields, ['id' => $r[0]["id"]]);
|
||||
$old_contact = dba::selectFirst('contact', $fields, ['id' => $r[0]["id"]]);
|
||||
|
||||
// Update it with the current values
|
||||
$fields = array('name' => $contact['name'], 'nick' => $contact['nick'],
|
||||
|
|
|
@ -39,7 +39,7 @@ class Group extends BaseObject
|
|||
// all the old members are gone, but the group remains so we don't break any security
|
||||
// access lists. What we're doing here is reviving the dead group, but old content which
|
||||
// was restricted to this group may now be seen by the new group members.
|
||||
$group = dba::selectOne('group', ['deleted'], ['id' => $gid]);
|
||||
$group = dba::selectFirst('group', ['deleted'], ['id' => $gid]);
|
||||
if (DBM::is_result($group) && $group['deleted']) {
|
||||
dba::update('group', ['deleted' => 0], ['gid' => $gid]);
|
||||
notice(t('A deleted group with this name was revived. Existing item permissions <strong>may</strong> apply to this group and any future members. If this is not what you intended, please create another group with a different name.') . EOL);
|
||||
|
@ -120,7 +120,7 @@ class Group extends BaseObject
|
|||
return false;
|
||||
}
|
||||
|
||||
$group = dba::selectOne('group', ['id'], ['uid' => $uid, 'name' => $name]);
|
||||
$group = dba::selectFirst('group', ['id'], ['uid' => $uid, 'name' => $name]);
|
||||
if (DBM::is_result($group)) {
|
||||
return $group['id'];
|
||||
}
|
||||
|
@ -139,13 +139,13 @@ class Group extends BaseObject
|
|||
return false;
|
||||
}
|
||||
|
||||
$group = dba::selectOne('group', ['uid'], ['gid' => $gid]);
|
||||
$group = dba::selectFirst('group', ['uid'], ['gid' => $gid]);
|
||||
if (!DBM::is_result($group)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// remove group from default posting lists
|
||||
$user = dba::selectOne('user', ['def_gid', 'allow_gid', 'deny_gid'], ['uid' => $group['uid']]);
|
||||
$user = dba::selectFirst('user', ['def_gid', 'allow_gid', 'deny_gid'], ['uid' => $group['uid']]);
|
||||
if (DBM::is_result($user)) {
|
||||
$change = false;
|
||||
|
||||
|
|
|
@ -38,14 +38,14 @@ class Photo
|
|||
*/
|
||||
public static function store(Image $Image, $uid, $cid, $rid, $filename, $album, $scale, $profile = 0, $allow_cid = '', $allow_gid = '', $deny_cid = '', $deny_gid = '', $desc = '')
|
||||
{
|
||||
$r = dba::selectOne('photo', ['guid'], ["`resource-id` = ? AND `guid` != ?", $rid, '']);
|
||||
$r = dba::selectFirst('photo', ['guid'], ["`resource-id` = ? AND `guid` != ?", $rid, '']);
|
||||
if (DBM::is_result($r)) {
|
||||
$guid = $r['guid'];
|
||||
} else {
|
||||
$guid = get_guid();
|
||||
}
|
||||
|
||||
$x = dba::selectOne('photo', ['id'], ['resource-id' => $rid, 'uid' => $uid, 'contact-id' => $cid, 'scale' => $scale]);
|
||||
$x = dba::selectFirst('photo', ['id'], ['resource-id' => $rid, 'uid' => $uid, 'contact-id' => $cid, 'scale' => $scale]);
|
||||
|
||||
$fields = array(
|
||||
'uid' => $uid,
|
||||
|
@ -88,7 +88,7 @@ class Photo
|
|||
*/
|
||||
public static function importProfilePhoto($photo, $uid, $cid, $quit_on_error = false)
|
||||
{
|
||||
$r = dba::selectOne(
|
||||
$r = dba::selectFirst(
|
||||
'photo', ['resource-id'], ['uid' => $uid, 'contact-id' => $cid, 'scale' => 4, 'album' => 'Contact Photos']
|
||||
);
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ class User
|
|||
return $default_group;
|
||||
}
|
||||
|
||||
$user = dba::selectOne('user', ['def_gid'], ['uid' => $uid]);
|
||||
$user = dba::selectFirst('user', ['def_gid'], ['uid' => $uid]);
|
||||
|
||||
if (DBM::is_result($user)) {
|
||||
$default_group = $user["def_gid"];
|
||||
|
@ -112,7 +112,7 @@ class User
|
|||
if (is_object($user_info)) {
|
||||
$user = (array) $user_info;
|
||||
} elseif (is_int($user_info)) {
|
||||
$user = dba::selectOne('user', ['uid', 'password'],
|
||||
$user = dba::selectFirst('user', ['uid', 'password'],
|
||||
[
|
||||
'uid' => $user_info,
|
||||
'blocked' => 0,
|
||||
|
@ -328,7 +328,7 @@ class User
|
|||
|
||||
if ($insert_result) {
|
||||
$uid = dba::lastInsertId();
|
||||
$user = dba::selectOne('user', [], ['uid' => $uid]);
|
||||
$user = dba::selectFirst('user', [], ['uid' => $uid]);
|
||||
} else {
|
||||
throw new Exception(t('An error occurred during registration. Please try again.'));
|
||||
}
|
||||
|
@ -530,7 +530,7 @@ class User
|
|||
|
||||
logger('Removing user: ' . $uid);
|
||||
|
||||
$user = dba::selectOne('user', [], ['uid' => $uid]);
|
||||
$user = dba::selectFirst('user', [], ['uid' => $uid]);
|
||||
|
||||
call_hooks('remove_user', $user);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue