]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/deleteuser.php
Background deletion of user accounts. Notices are deleted in chunks, then the user...
[quix0rs-gnu-social.git] / actions / deleteuser.php
index c4f84fad2d82d03711b703891bd1045c8862b8ff..4e6b27395389406f627cec8bed330ebfe62b274f 100644 (file)
@@ -162,7 +162,15 @@ class DeleteuserAction extends ProfileFormAction
     function handlePost()
     {
         if (Event::handle('StartDeleteUser', array($this, $this->user))) {
-            $this->user->delete();
+            // Mark the account as deleted and shove low-level deletion tasks
+            // to background queues. Removing a lot of posts can take a while...
+            if (!$this->user->hasRole(Profile_role::DELETED)) {
+                $this->user->grantRole(Profile_role::DELETED);
+            }
+
+            $qm = QueueManager::get();
+            $qm->enqueue($this->user, 'deluser');
+
             Event::handle('EndDeleteUser', array($this, $this->user));
         }
     }