query( $wpdb->prepare( 'DROP TABLE IF EXISTS %i', $wpdb->prefix . $wmcc_table ) ); } // The draft and the published snapshot (Consent\Store), what the public // site reads (Consent\Manifest), the schema version (Database\Schema) // and the opt-in itself (Core\Settings). foreach ( array( 'wmcc_draft', 'wmcc_published', 'wmcc_public', 'wmcc_public_texts', 'wmcc_scan', 'wmcc_scan_pages', 'wmcc_setup_done', 'wmcc_interface', 'wmcc_db_version', 'wmcc_delete_data_on_uninstall' ) as $wmcc_option ) { delete_option( $wmcc_option ); } // Drafts kept for preview (Frontend\Preview), one transient per user, // and the notes of a scan that was under way (Scan\Session). // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- Uninstall-time cleanup; the cache is flushed below. $wmcc_previews = $wpdb->get_col( $wpdb->prepare( "SELECT option_name FROM {$wpdb->options} WHERE option_name LIKE %s OR option_name LIKE %s OR option_name LIKE %s OR option_name LIKE %s", $wpdb->esc_like( '_transient_wmcc_preview_' ) . '%', $wpdb->esc_like( '_transient_timeout_wmcc_preview_' ) . '%', $wpdb->esc_like( '_transient_wmcc_scan_' ) . '%', $wpdb->esc_like( '_transient_timeout_wmcc_scan_' ) . '%' ) ); foreach ( $wmcc_previews as $wmcc_preview ) { delete_option( (string) $wmcc_preview ); } wp_cache_flush(); } }//end if if ( is_multisite() ) { $wmcc_site_ids = get_sites( array( 'fields' => 'ids', 'number' => 0, ) ); foreach ( $wmcc_site_ids as $wmcc_site_id ) { switch_to_blog( (int) $wmcc_site_id ); wmcc_uninstall_site(); restore_current_blog(); } } else { wmcc_uninstall_site(); }