mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-27 00:09:13 +01:00
fix not updated jpegphoto, if changed in AD
This commit is contained in:
parent
951ce7cb9f
commit
85fbfe3e63
@ -423,6 +423,7 @@ class Import
|
|||||||
// photo and public keys are not stored in SQL but in filesystem, fetch it to compare
|
// photo and public keys are not stored in SQL but in filesystem, fetch it to compare
|
||||||
$contact['files'] = 0;
|
$contact['files'] = 0;
|
||||||
if ($contact['jpegphoto'] === false) $contact['jpegphoto'] = null;
|
if ($contact['jpegphoto'] === false) $contact['jpegphoto'] = null;
|
||||||
|
Api\Vfs::$is_root = true;
|
||||||
foreach($this->files2attrs as $file => [$attr, $mask, $regexp])
|
foreach($this->files2attrs as $file => [$attr, $mask, $regexp])
|
||||||
{
|
{
|
||||||
if (isset($contact[$attr]))
|
if (isset($contact[$attr]))
|
||||||
@ -439,6 +440,7 @@ class Import
|
|||||||
}
|
}
|
||||||
$last_attr = $attr;
|
$last_attr = $attr;
|
||||||
}
|
}
|
||||||
|
Api\Vfs::$is_root = false;
|
||||||
$to_update = array_merge($sql_contact, array_filter($contact, static function ($attr) {
|
$to_update = array_merge($sql_contact, array_filter($contact, static function ($attr) {
|
||||||
return $attr !== null && $attr !== '';
|
return $attr !== null && $attr !== '';
|
||||||
}));
|
}));
|
||||||
@ -471,16 +473,17 @@ class Import
|
|||||||
}
|
}
|
||||||
Api\Vfs::$is_root = false;
|
Api\Vfs::$is_root = false;
|
||||||
*/
|
*/
|
||||||
// photo_unchanged=true must be set, to no delete the photo, if it's not in LDAP
|
// photo_unchanged=true must be set, to not delete the photo, if it's not in LDAP
|
||||||
$this->contacts_sql->data['photo_unchanged'] = !isset($diff['files']) ||
|
$diff['photo_unchanged'] = $this->contacts_sql->data['photo_unchanged'] =
|
||||||
($to_update['files']&Api\Contacts::FILES_BIT_PHOTO) === ($sql_contact['files']&Api\Contacts::FILES_BIT_PHOTO);
|
!isset($diff['jpegphoto']) && (!isset($diff['files']) ||
|
||||||
|
($to_update['files']&Api\Contacts::FILES_BIT_PHOTO) === ($sql_contact['files']&Api\Contacts::FILES_BIT_PHOTO));
|
||||||
if ($need_update && $this->contacts_sql->save($to_update))
|
if ($need_update && $this->contacts_sql->save($to_update))
|
||||||
{
|
{
|
||||||
$this->logger("Error updating contact data of '$account[account_lid]' (#$account_id)", 'error');
|
$this->logger("Error updating contact data of '$account[account_lid]' (#$account_id)", 'error');
|
||||||
++$errors;
|
++$errors;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$hide_binary = !empty($contact['jpegphoto']) ? ['jpegphoto' => bytes($contact['jpegphoto']).' bytes binary data'] : [];
|
$hide_binary = !empty($diff['jpegphoto']) ? ['jpegphoto' => bytes($diff['jpegphoto']).' bytes binary data'] : [];
|
||||||
$this->logger("Successful updated contact data of '$account[account_lid]' (#$account_id): ".
|
$this->logger("Successful updated contact data of '$account[account_lid]' (#$account_id): ".
|
||||||
json_encode($hide_binary+$diff, JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE), 'detail');
|
json_encode($hide_binary+$diff, JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE), 'detail');
|
||||||
if (!$new) $new = false;
|
if (!$new) $new = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user