Merge pull request #7437 from MrPetovan/bug/fatal-errors
Replace last instance of Contact::select
This commit is contained in:
commit
eddcb5ebe9
4 changed files with 11 additions and 12 deletions
|
@ -6223,13 +6223,10 @@ function api_friendica_profile_show($type)
|
||||||
|
|
||||||
// select all users from contact table, loop and prepare standard return for user data
|
// select all users from contact table, loop and prepare standard return for user data
|
||||||
$users = [];
|
$users = [];
|
||||||
$nurls = Contact::select(['id', 'nurl'], ['uid' => api_user(), 'profile-id' => $rr['id']]);
|
$nurls = Contact::selectToArray(['id', 'nurl'], ['uid' => api_user(), 'profile-id' => $rr['id']]);
|
||||||
|
foreach ($nurls as $nurl) {
|
||||||
if (DBA::isResult($nurls)) {
|
$user = api_get_user($a, $nurl['nurl']);
|
||||||
foreach ($nurls as $nurl) {
|
($type == "xml") ? $users[$k++ . ":user"] = $user : $users[] = $user;
|
||||||
$user = api_get_user($a, $nurl['nurl']);
|
|
||||||
($type == "xml") ? $users[$k++ . ":user"] = $user : $users[] = $user;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
$profile['users'] = $users;
|
$profile['users'] = $users;
|
||||||
|
|
||||||
|
|
|
@ -1512,16 +1512,18 @@ class Database
|
||||||
public function toArray($stmt, $do_close = true)
|
public function toArray($stmt, $do_close = true)
|
||||||
{
|
{
|
||||||
if (is_bool($stmt)) {
|
if (is_bool($stmt)) {
|
||||||
return $stmt;
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = [];
|
$data = [];
|
||||||
while ($row = $this->fetch($stmt)) {
|
while ($row = $this->fetch($stmt)) {
|
||||||
$data[] = $row;
|
$data[] = $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($do_close) {
|
if ($do_close) {
|
||||||
$this->close($stmt);
|
$this->close($stmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ class Attach extends BaseObject
|
||||||
* @param array $conditions Array of fields for conditions
|
* @param array $conditions Array of fields for conditions
|
||||||
* @param array $params Array of several parameters
|
* @param array $params Array of several parameters
|
||||||
*
|
*
|
||||||
* @return boolean|array
|
* @return array
|
||||||
*
|
*
|
||||||
* @throws \Exception
|
* @throws \Exception
|
||||||
* @see \Friendica\Database\DBA::selectToArray
|
* @see \Friendica\Database\DBA::selectToArray
|
||||||
|
@ -55,7 +55,7 @@ class Attach extends BaseObject
|
||||||
$fields = self::getFields();
|
$fields = self::getFields();
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = DBA::selectToArray('attach', $fields, $conditions, $params);
|
return DBA::selectToArray('attach', $fields, $conditions, $params);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -383,7 +383,7 @@ class Item extends BaseObject
|
||||||
$result = self::select($fields, $condition, $params);
|
$result = self::select($fields, $condition, $params);
|
||||||
|
|
||||||
if (is_bool($result)) {
|
if (is_bool($result)) {
|
||||||
return $result;
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = [];
|
$data = [];
|
||||||
|
@ -392,7 +392,7 @@ class Item extends BaseObject
|
||||||
}
|
}
|
||||||
DBA::close($result);
|
DBA::close($result);
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue