From 9da0e637a39635c0ea7edd9025975d1aef50de6e Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 24 May 2022 19:47:49 +0000 Subject: [PATCH] Quit on invalid avatars --- src/Console/MoveToAvatarCache.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Console/MoveToAvatarCache.php b/src/Console/MoveToAvatarCache.php index e7358c09d2..60d87dee18 100644 --- a/src/Console/MoveToAvatarCache.php +++ b/src/Console/MoveToAvatarCache.php @@ -92,7 +92,7 @@ HELP; echo $this->l10n->t('no resource in photo %s', $contact['photo']) . ' '; } - $this->storeAvatar($resourceid, $contact); + $this->storeAvatar($resourceid, $contact, false); } $count = 0; @@ -103,12 +103,12 @@ HELP; continue; } echo ++$count . "\t" . $contact['id'] . "\t" . $contact['url'] . "\t"; - $this->storeAvatar($photo['resource-id'], $contact); + $this->storeAvatar($photo['resource-id'], $contact, true); } return 0; } - private function storeAvatar(string $resourceid, array $contact) + private function storeAvatar(string $resourceid, array $contact, bool $quit_on_invalid) { $valid = !empty($resourceid); if ($valid) { @@ -145,6 +145,11 @@ HELP; $fields = ['photo' => '', 'thumb' => '', 'micro' => '']; } + if ($quit_on_invalid && $fields['photo'] == '') { + echo ' ' . $this->l10n->t('Quit') . "\n"; + return; + } + echo '5'; Contact::update($fields, ['uri-id' => $contact['uri-id']]); echo '6'; -- 2.39.5