mirror of
https://github.com/friendica/friendica
synced 2025-04-23 01:10:11 +00:00
Fix user-contact rows not being updated in Contact\User::updateByContactUpdate
- Add new update function to regenerate potentially outdated user-contact rows
This commit is contained in:
parent
fd0d17df31
commit
f7714c09e6
2 changed files with 22 additions and 12 deletions
|
@ -95,16 +95,17 @@ class User
|
|||
$update_fields = self::preparedFields($fields);
|
||||
if (!empty($update_fields)) {
|
||||
$contacts = DBA::select('contact', ['uri-id', 'uid'], $condition);
|
||||
while ($row = DBA::fetch($contacts)) {
|
||||
if (empty($row['uri-id']) || empty($contact['uid'])) {
|
||||
while ($contact = DBA::fetch($contacts)) {
|
||||
if (empty($contact['uri-id']) || empty($contact['uid'])) {
|
||||
continue;
|
||||
}
|
||||
$ret = DBA::update('user-contact', $update_fields, ['uri-id' => $row['uri-id'], 'uid' => $row['uid']]);
|
||||
Logger::info('Updated user contact', ['uid' => $row['uid'], 'uri-id' => $row['uri-id'], 'ret' => $ret]);
|
||||
$ret = DBA::update('user-contact', $update_fields, ['uri-id' => $contact['uri-id'], 'uid' => $contact['uid']]);
|
||||
Logger::info('Updated user contact', ['uid' => $contact['uid'], 'uri-id' => $contact['uri-id'], 'ret' => $ret]);
|
||||
}
|
||||
|
||||
DBA::close($contacts);
|
||||
}
|
||||
|
||||
DBA::commit();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue