From 7f905b465f0d3146784fd5756cf2e056f3709026 Mon Sep 17 00:00:00 2001 From: jmslbam Date: Mon, 25 Feb 2013 23:42:51 +0100 Subject: [PATCH] Added confirmation check before regenerating all images --- php/commands/media.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/php/commands/media.php b/php/commands/media.php index 5b11fb50..28cb8b42 100644 --- a/php/commands/media.php +++ b/php/commands/media.php @@ -16,18 +16,20 @@ class Media_Command extends WP_CLI_Command { /** * Regenerate thumbnail(s) * - * @synopsis [--id=] + * @synopsis [--id=] [--yes] * props @benmay & @Viper007Bond */ function regenerate( $args, $assoc_args = array() ) { global $wpdb; $vars = wp_parse_args( $assoc_args, array( - 'id' => false, + 'id' => false ) ); extract($vars, EXTR_SKIP); + WP_CLI::confirm('Do you realy want to regenerate all images?', $assoc_args); + $where_clause = ( $id ) ? "AND ID = $id" : ''; if ( !$images = $wpdb->get_results( "SELECT ID FROM $wpdb->posts WHERE post_type = 'attachment' $where_clause AND post_mime_type LIKE 'image/%' ORDER BY ID DESC" ) ) { -- 2.11.0