X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FWorker%2FRemoveUser.php;h=e209aec07f18c23056e0f523a190df712bac65fd;hb=60532ee7e4152af9997e0d7b69c7b35262d5528d;hp=dfa5ccc097c7e9ea14c2c6f66d8488e22ab2e710;hpb=7edbef9bdc8336e6e842994c3e45f8f29325328a;p=friendica.git diff --git a/src/Worker/RemoveUser.php b/src/Worker/RemoveUser.php index dfa5ccc097..e209aec07f 100644 --- a/src/Worker/RemoveUser.php +++ b/src/Worker/RemoveUser.php @@ -1,15 +1,33 @@ . + * */ + namespace Friendica\Worker; use Friendica\Database\DBA; use Friendica\Model\Item; +use Friendica\Model\Post; -require_once 'include/dba.php'; - +/** + * Removes orphaned data from deleted users + */ class RemoveUser { public static function execute($uid) { @@ -20,6 +38,13 @@ class RemoveUser { } // Now we delete all user items - Item::delete(['uid' => $uid], PRIORITY_LOW); + $condition = ['uid' => $uid, 'deleted' => false]; + do { + $items = Post::select(['id'], $condition, ['limit' => 100]); + while ($item = Post::fetch($items)) { + Item::markForDeletionById($item['id'], PRIORITY_NEGLIGIBLE); + } + DBA::close($items); + } while (Post::exists($condition)); } }