Force a directory update if previously published

This commit is contained in:
Michael 2021-06-16 05:23:43 +00:00
parent 1ced04e54c
commit 3796e13142
2 changed files with 7 additions and 4 deletions

View file

@ -725,6 +725,7 @@ class Contact
'thumb' => DI::baseUrl() . '/photo/avatar/' . $uid .'.' . $file_suffix];
DBA::update('profile', $fields, ['uid' => $uid]);
}
return $update;
}

View file

@ -123,7 +123,7 @@ class Profile
}
if ($update) {
self::publishUpdate($uid);
self::publishUpdate($uid, ($old_owner['net-publish'] != $owner['net-publish']));
}
return true;
@ -131,15 +131,17 @@ class Profile
/**
* Publish a changed profile
* @param int $uid
* @param int $uid
* @param bool $force Force publishing to the directory
*/
public static function publishUpdate(int $uid)
public static function publishUpdate(int $uid, bool $force = false)
{
$owner = User::getOwnerDataById($uid);
if (empty($owner)) {
return;
}
if ($owner['net-publish']) {
if ($owner['net-publish'] || $force) {
// Update global directory in background
if (Search::getGlobalDirectory()) {
Worker::add(PRIORITY_LOW, 'Directory', $owner['url']);