prefix . 'adminkeep_path_redirects'; // Plugin-owned table; the name is $wpdb->prefix plus a literal and DDL has no prepared form. $wpdb->query( "DROP TABLE IF EXISTS {$adminkeep_table}" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery, WordPress.DB.PreparedSQL, PluginCheck.Security.DirectDB.UnescapedDBParameter delete_option( 'adminkeep_redirect_schema' ); // The email log holds other people's addresses and, by default, what was written to them. // Unlike the redirect table nobody's links depend on it, so there is no case for keeping it. $adminkeep_log_table = $wpdb->prefix . 'adminkeep_email_log'; $wpdb->query( "DROP TABLE IF EXISTS {$adminkeep_log_table}" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery, WordPress.DB.PreparedSQL, PluginCheck.Security.DirectDB.UnescapedDBParameter delete_option( 'adminkeep_email_log_schema' ); delete_option( 'adminkeep_email_log_import' ); wp_clear_scheduled_hook( 'adminkeep_email_log_purge' ); $wpdb->delete( $wpdb->postmeta, array( 'meta_key' => '_adminkeep_live_draft_of' ), array( '%s' ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery, WordPress.DB.SlowDBQuery // Retained previous versions of replaced media. The files themselves are left on disk on // purpose: deleting user uploads during an uninstall is not this plugin's call to make. $wpdb->delete( $wpdb->postmeta, array( 'meta_key' => '_adminkeep_replaced_file' ), array( '%s' ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery, WordPress.DB.SlowDBQuery wp_clear_scheduled_hook( 'adminkeep_cleanup_replaced_media' ); // Names 1.1.0 stored under, for a site uninstalled before the rename in 1.2.0 ever ran. delete_option( 'wp_pro_admin_settings' ); delete_option( 'wp_pro_admin_redirect_schema' ); $adminkeep_old_table = $wpdb->prefix . 'wppa_path_redirects'; $wpdb->query( "DROP TABLE IF EXISTS {$adminkeep_old_table}" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery, WordPress.DB.PreparedSQL, PluginCheck.Security.DirectDB.UnescapedDBParameter $wpdb->delete( $wpdb->postmeta, array( 'meta_key' => '_wppa_live_draft_of' ), array( '%s' ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery, WordPress.DB.SlowDBQuery $wpdb->delete( $wpdb->postmeta, array( 'meta_key' => '_wppa_replaced_file' ), array( '%s' ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery, WordPress.DB.SlowDBQuery wp_clear_scheduled_hook( 'wp_pro_admin_cleanup_replaced_media' ); } // Everything above is per-site — the option, the table prefix and the meta table all differ per // blog — so on multisite every site gets the full clean, not just the option. if ( is_multisite() ) { $adminkeep_site_ids = get_sites( array( 'fields' => 'ids', 'number' => 0, 'update_site_meta_cache' => false, ) ); foreach ( $adminkeep_site_ids as $adminkeep_site_id ) { switch_to_blog( $adminkeep_site_id ); adminkeep_uninstall_current_site(); restore_current_blog(); } } else { adminkeep_uninstall_current_site(); } // User meta belongs to no single site, so it is removed once, for every user. delete_metadata( 'user', 0, 'adminkeep_hide_unused', '', true );