sforkowany z mirror/friendica
Delete the photo entries when a user or contact is removed
rodzic
cbdaf6298a
commit
7990d08ad6
|
@ -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);
|
||||
|
|
|
@ -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]);
|
||||
}
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue