X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FWorker%2FRemoveUser.php;h=e209aec07f18c23056e0f523a190df712bac65fd;hb=a662245c744f4d2faa1b533977f7d21b4de6a724;hp=10ede55763d47ea2071866fdd6de59acac32239a;hpb=1e873a28153fbc22d74e0a5b41deb61a39019a2d;p=friendica.git diff --git a/src/Worker/RemoveUser.php b/src/Worker/RemoveUser.php index 10ede55763..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) { @@ -22,11 +40,11 @@ class RemoveUser { // Now we delete all user items $condition = ['uid' => $uid, 'deleted' => false]; do { - $items = Item::select(['id'], $condition, ['limit' => 100]); - while ($item = Item::fetch($items)) { - Item::deleteById($item['id'], PRIORITY_NEGLIGIBLE); + $items = Post::select(['id'], $condition, ['limit' => 100]); + while ($item = Post::fetch($items)) { + Item::markForDeletionById($item['id'], PRIORITY_NEGLIGIBLE); } DBA::close($items); - } while (Item::exists($condition)); + } while (Post::exists($condition)); } }