Merge pull request #12562 from MrPetovan/bug/notices

Ward againt contact_id = 0 in UpdateContact worker
This commit is contained in:
Philipp 2023-01-02 00:34:21 +01:00 committed by GitHub
commit 4faf08c064
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 71 additions and 17 deletions

View file

@ -44,6 +44,7 @@ use Friendica\Util\Images;
use Friendica\Util\Network;
use Friendica\Util\ParseUrl;
use Friendica\Util\Proxy;
use Friendica\Worker\UpdateContact;
/**
* Photo Module
@ -351,8 +352,12 @@ class Photo extends BaseModule
Logger::debug('Got return code for avatar', ['return code' => $curlResult->getReturnCode(), 'cid' => $id, 'url' => $contact['url'], 'avatar' => $url]);
}
if ($update) {
Logger::info('Invalid file, contact update initiated', ['cid' => $id, 'url' => $contact['url'], 'avatar' => $url]);
Worker::add(Worker::PRIORITY_LOW, 'UpdateContact', $id);
try {
UpdateContact::add(Worker::PRIORITY_LOW, $id);
Logger::info('Invalid file, contact update initiated', ['cid' => $id, 'url' => $contact['url'], 'avatar' => $url]);
} catch (\InvalidArgumentException $e) {
Logger::notice($e->getMessage(), ['id' => $id, 'contact' => $contact]);
}
} else {
Logger::info('Invalid file', ['cid' => $id, 'url' => $contact['url'], 'avatar' => $url]);
}