3 * @file src/Worker/RemoveUser.php
4 * @brief Removes orphaned data from deleted users
6 namespace Friendica\Worker;
8 use Friendica\Database\DBA;
9 use Friendica\Model\Item;
12 public static function execute($uid)
14 // Only delete if the user is archived
15 $condition = ['account_removed' => true, 'uid' => $uid];
16 if (!DBA::exists('user', $condition)) {
20 // Now we delete all user items
21 $condition = ['uid' => $uid, 'deleted' => false];
23 $items = Item::select(['id'], $condition, ['limit' => 100]);
24 while ($item = Item::fetch($items)) {
25 Item::deleteById($item['id'], PRIORITY_NEGLIGIBLE);
28 } while (Item::exists($condition));