drush icon indicating copy to clipboard operation
drush copied to clipboard

Support --limit option in entity:delete command

Open tibezh opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe. I have similar that already described her https://github.com/drush-ops/drush/issues/5784.

On the website with Drupal Commerce I have >5K commerce_order entities, I need to delete ALL of them, and got memory_limit error (with memory_limit=-1 in php.ini) for a command: drush entity:delete commerce_order

Describe the solution you'd like I think we can have a little improvement for the entity:delete command and use a little trick to delete entities with bash loop. I mean run command like: i="0"; while [ $i -lt 100 ]; do $DRUSH entity:delete commerce_order --limit=500; i=$[$i+1]; done

Describe alternatives you've considered I've tried to execute drupal_static_reset() function after each drush batch iteration and it not helped, still have memory leaks.

Additional context Will provide a PR a little bit later.

tibezh avatar May 17 '24 06:05 tibezh

PR is added, could somebody check, please?

tibezh avatar May 17 '24 07:05 tibezh

The https://github.com/drush-ops/drush/pull/6008 PR is merged, so we can close the issue, thank you!

tibezh avatar May 31 '24 06:05 tibezh

Thanks for creating this new feature @tibezh, it's so great to see the Drupal and Drush eco-system constantly improving.

gitressa avatar May 31 '24 07:05 gitressa