Skip to content
Open
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
0ccc287
feat: add --all flag to comment delete command
shawnhooper Oct 15, 2025
be45039
fix: linting errors
shawnhooper Oct 15, 2025
24f1c4c
fix: phpstan issues
shawnhooper Oct 15, 2025
c4d8775
fix: phpstan issues
shawnhooper Oct 15, 2025
ea5d314
fix: incorrect return type
shawnhooper Oct 15, 2025
846b801
fix: always return array
shawnhooper Oct 15, 2025
6dbf62d
fix: code style
shawnhooper Oct 15, 2025
e0f124b
fix: update test expectations to handle comment deletion order
shawnhooper Oct 15, 2025
000c832
fix: remove $exclude code
shawnhooper Oct 16, 2025
860bb2b
fix: defer comment counts
shawnhooper Oct 20, 2025
3af6933
fix: strict comparison on mixed
shawnhooper Oct 20, 2025
3c9ea3c
fix: strict comparison on mixed
shawnhooper Oct 20, 2025
95e7211
fix: phpcs comparison
shawnhooper Oct 20, 2025
1e396e8
fix: behat tests. Add checks for multiple success lines
shawnhooper Oct 20, 2025
a7849ca
fix: behat tests. Add checks for multiple success lines
shawnhooper Oct 20, 2025
669caae
test: Delete comments with explicit defer-term-counting flag
shawnhooper Oct 20, 2025
8a3df5b
test: Success/Error returns
shawnhooper Oct 20, 2025
db90889
fix: remove --defer-comment-count flag, not referenced in coommand def
shawnhooper Oct 21, 2025
1c8144c
test: return to STDERR
shawnhooper Oct 21, 2025
37c0ba6
test: combined success/warning output to STDOUT
shawnhooper Oct 21, 2025
61f74b6
test: trying to get combined success/fail ouput
shawnhooper Oct 21, 2025
d33e0b8
test: add blank line to return
shawnhooper Oct 21, 2025
fc0e2a2
test: could it be STDERR, now that we have the foramtting fixed?
shawnhooper Oct 21, 2025
fb2d6be
test: Separates STDOUT and STDERR
shawnhooper Oct 21, 2025
d0dd60a
Last try on STDOUT
shawnhooper Oct 21, 2025
a8bdff2
test: ah, the problem was I try vs I run
shawnhooper Oct 21, 2025
c26733a
revert: comment change
shawnhooper Oct 28, 2025
6efbeed
lint: use @var instead of not is_array check
shawnhooper Oct 28, 2025
3c52d46
doc: include warning about potential slow command
shawnhooper Oct 28, 2025
bc3cc1d
lint: remove additional spaces
shawnhooper Oct 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: phpcs comparison
  • Loading branch information
shawnhooper committed Oct 20, 2025
commit 95e7211612ea1e30c7d3ccd4b36e8f2feb5717a7
16 changes: 5 additions & 11 deletions src/Comment_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -475,14 +475,12 @@ public function delete( $args, $assoc_args ) {

if ( ! $result ) {
$response = [ 'error', "Failed deleting comment {$comment_id}." ];
$status = $this->success_or_failure( $response );
// Keep status as 1 (error) if any deletion fails
} else {
$verb = ( $force || 'trash' === $comment_status ) ? 'Deleted' : 'Trashed';
$response = [ 'success', "{$verb} comment {$comment_id}." ];
++$successfully_deleted;
}

$status = $this->success_or_failure( $response );
if ( $status ) {
$this->success_or_failure( $response );
++$successfully_deleted;
}
}
Expand All @@ -491,18 +489,14 @@ public function delete( $args, $assoc_args ) {
wp_defer_term_counting( false );
}

if ( $status ) {
if ( 0 === $status ) {
WP_CLI::success( "Deleted {$successfully_deleted} comments." );
} else {
$error_count = $total - $successfully_deleted;
WP_CLI::error( "Failed deleting {$error_count} comments." );
}

if ( $status ) {
exit( 0 );
} else {
exit( 1 );
}
exit( $status );
}

private function call( $args, $status, $success, $failure ) {
Expand Down
Loading