a8cteam51 / safety-net

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

Multisite Support #135

Open gin0115 opened 1 month ago

gin0115 commented 1 month ago

Just ran on local version of awakentheworld and noticed this only handles single sites

I added to mu-plugins/safety-net/includes/scrub-options.php as a dirty fix

// Checks if the site is a multisite
if ( is_multisite() ) {
    // Get all multisite blogs
    $blogs = $wpdb->get_results( "SELECT blog_id FROM $wpdb->blogs" );

    // Switch to each site and update the option
    foreach ( $blogs as $blog ) {
        switch_to_blog( $blog->blog_id );
        update_option( $option_name, $option_value );
        restore_current_blog();
    }
}

It seemed to run fine SELECT * FROM `wp_10_options`;

image

But I did get an error from Automattic\WooCommerce\Utilities\ArrayUtil::get_value_or_default

image

gin0115 commented 1 month ago

Ok this has opened up lots of issues where options are serialised arrays and not actual arrays and other strange bugs.....

IGNORE THE ABOVE SUGGESTION