]> git.mxchange.org Git - friendica.git/blobdiff - src/Worker/RemoveUser.php
Avoid lock problems, fix foreign key problems with contact-relation
[friendica.git] / src / Worker / RemoveUser.php
index c2441adc90c558a54afc1d063e834c676a0aab33..997329e014b9329cb2645e655cb9a244ba6bad0a 100644 (file)
@@ -23,6 +23,7 @@ namespace Friendica\Worker;
 
 use Friendica\Database\DBA;
 use Friendica\Model\Item;
+use Friendica\Model\Post;
 
 /**
  * Removes orphaned data from deleted users
@@ -39,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));
        }
 }