a8cteam51 / safety-net

Scrub options, deactivate denylisted plugins, and delete user data on development sites.
20 stars 1 forks source link

Compatibility with WooCommerce HPOS #80

Closed NickGreen closed 1 year ago

NickGreen commented 1 year ago

These lines won't work with HPOS:

./mu-plugins/safety-net/includes/anonymize.php:193: $orders = $wpdb->get_results(
./mu-plugins/safety-net/includes/classes/class-actionscheduler-custom-dbstore.php:58:       $sql           = $wpdb->prepare( "{$update} {$where} {$order} LIMIT %d", $params ); // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.PreparedSQLPlaceholders
./mu-plugins/safety-net/includes/delete.php:34: $table_name = $wpdb->prefix . 'woocommerce_order_itemmeta';
./mu-plugins/safety-net/includes/delete.php:36:     $wpdb->query( "DELETE FROM {$wpdb->prefix}woocommerce_order_itemmeta" );
./mu-plugins/safety-net/includes/delete.php:38: $table_name = $wpdb->prefix . 'woocommerce_order_items';
./mu-plugins/safety-net/includes/delete.php:40:     $wpdb->query( "DELETE FROM {$wpdb->prefix}woocommerce_order_items" );
./mu-plugins/safety-net/includes/delete.php:42: $wpdb->query( "DELETE FROM $wpdb->comments WHERE comment_type = 'order_note'" );
./mu-plugins/safety-net/includes/delete.php:43: $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE post_id IN ( SELECT ID FROM {$wpdb->posts} WHERE post_type = 'shop_order' OR post_type = 'shop_subscription' )" );
./mu-plugins/safety-net/includes/delete.php:44: $wpdb->query( "DELETE FROM $wpdb->posts WHERE post_type = 'shop_order'" );
./mu-plugins/safety-net/includes/delete.php:47: $table_name = $wpdb->prefix . 'wc_orders';
./mu-plugins/safety-net/includes/delete.php:49:     $wpdb->query( "DELETE FROM {$wpdb->prefix}wc_orders" );
./mu-plugins/safety-net/includes/delete.php:50:     $wpdb->query( "DELETE FROM {$wpdb->prefix}wc_order_addresses" );
./mu-plugins/safety-net/includes/delete.php:51:     $wpdb->query( "DELETE FROM {$wpdb->prefix}wc_order_operational_data" );
./mu-plugins/safety-net/includes/delete.php:52:     $wpdb->query( "DELETE FROM {$wpdb->prefix}wc_orders_meta" );
./mu-plugins/safety-net/includes/utilities.php:49:      $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_type = 'shop_order' OR post_type = 'shop_subscription' LIMIT 1000 OFFSET %d", $offset ),

More details here: https://github.com/Automattic/woocommerce/issues/247

NickGreen commented 1 year ago

Closing this out.