feat: add --all flag to comment delete command#546
feat: add --all flag to comment delete command#546shawnhooper wants to merge 30 commits intowp-cli:mainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
src/Comment_Command.php
Outdated
| * : One or more IDs of comments to delete. | ||
| * | ||
| * [--all] | ||
| * : If set, all comments will be deleted. |
There was a problem hiding this comment.
Should we warn that this might be slow?
There was a problem hiding this comment.
@swissspidy Just a warning in the comment like this? Or do we need a warning on the prompt?
|
Sorry I'm late to this but in relation to the linked issue this PR is meant to fix -- when there are tens/hundreds of thousands of these it isn't just 'slow' it can be many, many hours. I don't think the current method is really a solution for that particular problem. The correct method for dealing with spam like that is what is in the linked issue, doing: Which takes a few seconds at most. That issue is asking for a Obviously that doesn't delete the comments normally, doesn't fire hooks, etc... so it does feel like that is different than an Really there is just a fundamental difference between "I want to delete all comments the normal WordPress way" and "My site got tens of thousands of spam comments and I want to remove everything". Unclear if it is possible to incorporate the later into this command in a way that makes sense ( |
|
@mrsdizzie Absolutely agreed that this could get very slow. @swissspidy and I had a discussion about that (see #546 (comment)) with my argument being all --all should consistant with the delete command and process all the action hooks. I propose two possible solutions:
|
It needs to be separate from With an appropriate description of what it does and when you'd want to use that. |
Resolves #538
Contributed as part of WordCamp Canada 2025 Contributor Day. #WCEH