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]; 'thumb' => DI::baseUrl() . '/photo/avatar/' . $uid .'.' . $file_suffix];
DBA::update('profile', $fields, ['uid' => $uid]); DBA::update('profile', $fields, ['uid' => $uid]);
} }
return $update; return $update;
} }

View File

@ -123,7 +123,7 @@ class Profile
} }
if ($update) { if ($update) {
self::publishUpdate($uid); self::publishUpdate($uid, ($old_owner['net-publish'] != $owner['net-publish']));
} }
return true; return true;
@ -132,14 +132,16 @@ class Profile
/** /**
* Publish a changed 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); $owner = User::getOwnerDataById($uid);
if (empty($owner)) { if (empty($owner)) {
return; return;
} }
if ($owner['net-publish']) {
if ($owner['net-publish'] || $force) {
// Update global directory in background // Update global directory in background
if (Search::getGlobalDirectory()) { if (Search::getGlobalDirectory()) {
Worker::add(PRIORITY_LOW, 'Directory', $owner['url']); Worker::add(PRIORITY_LOW, 'Directory', $owner['url']);