X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FWorker%2FRemoveUnusedAvatars.php;h=3d5c796269b265e97fa7a4d5fbfccd743a8288bc;hb=3f309805919671ce0ae22f82f5a751050a07dce4;hp=58670c87350a45bc928e06a79aadb608d4427b0c;hpb=4f6be0bd031af6b6e96843df88292edd54ff6560;p=friendica.git diff --git a/src/Worker/RemoveUnusedAvatars.php b/src/Worker/RemoveUnusedAvatars.php index 58670c8735..3d5c796269 100644 --- a/src/Worker/RemoveUnusedAvatars.php +++ b/src/Worker/RemoveUnusedAvatars.php @@ -1,6 +1,6 @@ $total]); $count = 0; - $contacts = DBA::select('contact', ['id'], $condition); + $contacts = DBA::p("SELECT `contact`.`id` " . $sql, 0, '', '', '', 0); while ($contact = DBA::fetch($contacts)) { - DBA::update('contact', ['photo' => '', 'thumb' => '', 'micro' => ''], ['id' => $contact['id']]); - Photo::delete(['contact-id' => $contact['id'], 'album' => Photo::CONTACT_PHOTOS]); + Contact::update(['photo' => '', 'thumb' => '', 'micro' => ''], ['id' => $contact['id']]); + Photo::delete(['contact-id' => $contact['id'], 'photo-type' => [Photo::CONTACT_AVATAR, Photo::CONTACT_BANNER]]); if ((++$count % 1000) == 0) { if (!Worker::isInMaintenanceWindow()) { Logger::notice('We are outside of the maintenance window, quitting'); return; } - Logger::notice('In removal', ['count' => $count, 'total' => $total]); + Logger::info('In removal', ['count' => $count, 'total' => $total]); } } DBA::close($contacts); @@ -90,7 +95,7 @@ class RemoveUnusedAvatars $updated = true; $updated2++; } - } + } DBA::close($contacts); if (!$updated) { Logger::notice('Photo deleted', ['id' => $photo['id']]);