Delete the photo entries when a user or contact is removed

2022.09-rc
Michael 2020-08-21 18:39:18 +00:00
rodzic cbdaf6298a
commit 7990d08ad6
2 zmienionych plików z 6 dodań i 2 usunięć

Wyświetl plik

@ -22,6 +22,7 @@
namespace Friendica\Worker;
use Friendica\Database\DBA;
use Friendica\Model\Photo;
use Friendica\Model\User;
/**
@ -51,6 +52,8 @@ class ExpireAndRemoveUsers
DBA::delete('contact', ['nurl' => $self['nurl'], 'self' => false]);
}
Photo::delete(['uid' => $user['uid']]);
DBA::delete('user', ['uid' => $user['uid']]);
}
DBA::close($users);

Wyświetl plik

@ -23,8 +23,8 @@ namespace Friendica\Worker;
use Friendica\Core\Logger;
use Friendica\Database\DBA;
use Friendica\Core\Protocol;
use Friendica\Model\Item;
use Friendica\Model\Photo;
/**
* Removes orphaned data from deleted contacts
@ -33,7 +33,7 @@ class RemoveContact {
public static function execute($id) {
// Only delete if the contact is to be deleted
$contact = DBA::selectFirst('contact', ['uid'], ['deleted' => true]);
$contact = DBA::selectFirst('contact', ['uid'], ['deleted' => true, 'id' => $id]);
if (!DBA::isResult($contact)) {
return;
}
@ -49,6 +49,7 @@ class RemoveContact {
DBA::close($items);
} while (Item::exists($condition));
Photo::delete(['uid' => $contact['uid'], 'contact-id' => $id]);
DBA::delete('contact', ['id' => $id]);
}
}