From: jmslbam Date: Mon, 25 Feb 2013 22:42:51 +0000 (+0100) Subject: Added confirmation check before regenerating all images X-Git-Tag: v0.9.0~37^2~26 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=7f905b465f0d3146784fd5756cf2e056f3709026;p=wvm%2Fwvm.git Added confirmation check before regenerating all images --- 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" ) ) {