Privacy & Data): * the {prefix}ld_enrollment_logs table, the settings and the database version option. * Otherwise the audit trail and settings are kept so a reinstall reuses them. * Runs once per site on multisite. * * @package Enrollment_Verifier_Logger */ if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { exit; } /** * Clean up one site. * * @return void */ function evlfl_uninstall_site() { global $wpdb; foreach ( array( 'evlfl_send_digest', 'evlfl_send_overflow', 'evlfl_cleanup' ) as $hook ) { wp_clear_scheduled_hook( $hook ); } delete_option( 'evlfl_plugin_version' ); delete_option( 'evlfl_activated_at' ); delete_option( 'evlfl_pending_digest' ); // Hourly rate-limit counters. $like = $wpdb->esc_like( '_transient_evlfl_mail_rate_' ) . '%'; $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->options} WHERE option_name LIKE %s OR option_name LIKE %s", $like, $wpdb->esc_like( '_transient_timeout_evlfl_mail_rate_' ) . '%' ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching -- One-off uninstall clean-up of this plugin's own transients. $settings = get_option( 'evlfl_settings', array() ); $wipe = is_array( $settings ) && ! empty( $settings['privacy']['delete_on_uninstall'] ); if ( $wipe ) { $table = $wpdb->prefix . 'ld_enrollment_logs'; $wpdb->query( "DROP TABLE IF EXISTS `{$table}`" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.SchemaChange,WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Plugin-owned table named from $wpdb->prefix; opted in by the site owner. delete_option( 'evlfl_settings' ); delete_option( 'evlfl_db_version' ); } } if ( is_multisite() ) { foreach ( get_sites( array( 'fields' => 'ids', 'number' => 0 ) ) as $evlfl_site_id ) { // phpcs:ignore WordPress.WP.PostsPerPage -- Clean-up must visit every site. switch_to_blog( (int) $evlfl_site_id ); evlfl_uninstall_site(); restore_current_blog(); } } else { evlfl_uninstall_site(); }