a8cteam51 / safety-net

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

Add WooCommerce Zapier to plugin denylist #104

Closed fmfernandes closed 1 year ago

fmfernandes commented 1 year ago

This should be enough to fix #102, as per the docs. Existing Zaps will be kept intact.

If, instead, we need to remove any saved information we can use something like this:

    $wpdb->query( "DROP TABLE IF EXISTS `{$wpdb->prefix}wc_zapier_history`" );

    // Delete all existing WooCommerce Zapier Webhooks.
    $wpdb->query( "DELETE FROM `{$wpdb->prefix}wc_webhooks` WHERE `name` = 'WooCommerce Zapier' AND `delivery_url` LIKE '%hooks.zapier.com%'" );

    // Delete all existing WooCommerce Zapier REST API Keys.
    $wpdb->query( "DELETE FROM `{$wpdb->prefix}woocommerce_api_keys` WHERE `description` LIKE '%Zapier%'" );

    // Delete all existing 1.9.x Legacy Zapier Feed records.
    foreach ( get_posts(
        array(
            'post_type'      => 'wc_zapier_feed',
            'posts_per_page' => -1,
        )
    ) as $feed ) {
        if ( isset( $feed->ID ) ) {
            wp_delete_post( $feed->ID, false );
        }
    }
    $wpdb->query( "DELETE FROM `$wpdb->options` WHERE option_name LIKE 'wc\_zapier\_%';" );