Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 296227

comment_user_cancel() doesn't implement a batch

$
0
0

The problem

When a user with many comments cancels his account, this could lead to php memory issues.

What are the steps required to reproduce the bug?

Cancel the user account of a User with thousands of comments with a php memory limit of 256M.

What behavior were you expecting?

The account will be deleted and all comments are unpublished/updated as well.

What happened instead?

You get a php memory error and not all comments of the canceled user are deleted/updated.

Reason

The code were the comments are loaded and updated has no chunking or batching mechanic.

$comments = entity_load_multiple_by_properties('comment', ['uid' => $account->id()]);
      foreach ($comments as $comment) {
        $comment->setUnpublished();
        $comment->save();
      }

Viewing all articles
Browse latest Browse all 296227

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>